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 write output.

Value

ValueTypeDefaultDescription
the command's valuedynamic string or list or dynamic dictAppends to the agent's output. Strings are markdown text. Images can be added using { "contentType": "image", "data": "...Base64-encoded...", "mimeType": "image/png" }. 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:

  • A string is a text part, rendered as Markdown.
  • An object { "contentType": "text", "text": "..." } is the same text part, written out.
  • An object { "contentType": "image", "data": "<base64>", "mimeType": "image/png" } is an image.
  • A list appends several parts at once.
  • The result of an llm command may be given as the value 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. It 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.chart": {
  "contentType": "image",
  "data": "{ chart }",
  "mimeType": "image/png"
}

Rules

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