1. Plain chat (no tools)
agent.run() loops until the model stops calling tools and returns final text. For chat-only agents, pass an empty tools array.
2. Agent with a tool
Define a tool withdefineTool, pass it to the agent, and ask a question that requires it:
get_weather → your execute runs → result goes back to the model → model writes the final answer.
3. Stream text to your UI
AddonText to show tokens as they arrive:
agent.stream()).
What’s next?
Handoffs
Delegate to billing, support, or other specialist agents.
Time-travel context
Undo, edit, or branch conversations without extra API cost.
Schema Validation & Coercion
Recover when the model sends bad tool arguments.
Agent API
Full reference for run(), stream(), and options.