AgentsOutput
Output
Choose how your agent answers, as streamed text or as JSON in a shape you define.
Your agent can answer in two ways. Stream text for people to read, in a conversation or as a one-off, or return JSON in a shape you define for your code to use.
Generation and streaming
Stream a chat answer with saved history, or one-off text with none.
Structured output
Get JSON that follows your schema, ready for your code.
Which one to use
| You want | Use |
|---|---|
| A chat interface that remembers the conversation | client.chat() |
| A summary, rewrite, or other standalone text | client.completion() |
| Data your code acts on, such as a category or extracted fields | client.object() |
All three run the same agent, with its model, instructions, and tools, and all three count toward your usage and quotas. Only chat keeps history in a session.