output

Appends to the agent's output. Output is streamed to the user as the agent writes it. An agent that runs to answer a query must set its output.

Value

ValueTypeDefaultDescription
the command's valuedynamic string or list or dynamic dictAppends to the agent's output. Strings are markdown text. HTML can be added using { "contentType": "html", "text": "...HTML code..." } and images using { "contentType": "image", "text": "...Base64-encoded...", "mimeType": "" }. A list adds several parts at once, and an LLM result can be assigned directly. An agent that answers a query must set its output.

Output parts

textparthtmlpartimagepartllm textparttextparteach output command appends one or more parts; the client renders them as they arriveprogress and trace go to separate channels and are not part of the output
Output is a stream of parts, appended as commands run

Output is a list of parts. Each output command appends one or more parts:

  • A string is a text part, rendered as Markdown.
  • An object { "contentType": "html", "text": "..." } is an HTML part. The part is rendered after harmful content is removed; Markdown is not applied.
  • An object { "contentType": "image", "text": "<base64>", "mimeType": "image/png" } is an image.
  • A list appends several parts at once.
  • The result of an llm command may be assigned directly. The answer's text and any images become parts. The streamOutput flag on the llm command does the same thing automatically.

Output is append-only and keeps its order. Output is saved with the conversation, so the user sees the same output again when the conversation is opened later.

Example

"output": "{ f'Found **{len(orders)}** open orders.' }",
"output.table": {
  "contentType": "html",
  "text": "{ '<table>' + ''.join(f'<tr><td>{o['id']}</td><td>{o['total']}</td></tr>' for o in orders) + '</table>' }"
}

Rules

  • A dict without a valid contentType fails. To show a dict or a list as text, convert the value first: "{ str(result) }".
  • An image part needs a mimeType.
  • output does not change control flow. The agent continues with the next command.