Structured output
Programs need data, not paragraphs. See how an agent returns a typed object that matches your schema, through the provider's own feature or through a tool call, and how a wrong value is caught and fixed.
10 minPro
Checking your access…
Inside this lesson
- An animation you play, pause and step through, with each part saying what it is doing.
- The real code beside it, with the lines for each step lit up.
- Practice mode, where you route each message yourself, and a short quiz.
- About 10 minutes.
Written from the official documentation
In this module: Models, tools and agents
- Chat models and messagesinit_chat_model, message types, content blocks and tool calls.Pro
- Tools and bind_toolsDefine tools, bind them to a model and run them with ToolNode.Pro
- Tools that read state and storeToolRuntime gives tools state, context, store and a stream writer.Pro
- Structured outputGet typed results with provider or tool calling strategies.Pro
- The agent loop as a graphModel node, tool node and one conditional edge that loops.Pro
- The prebuilt agent: create_agentA ready made agent graph you shape with middleware.Pro