Output types and tool use behavior
Three agent settings decide what a run gives back. See output_type return a typed object, tool_choice force the model to call a tool, and tool_use_behavior decide whether the tool or the model has the last word.
11 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 11 minutes.
Written from the official documentation
In this module: Agents in depth
- Instructions, prompt templates and cloningStatic or dynamic instructions, stored prompts and agent copies.Pro
- Output types and tool use behaviorTyped final output, forced tool calls and when a run stops.Pro
- Lifecycle hooksRun code when agents, tools and model calls start and end.Pro
- Context and RunContextWrapperPass your own data to tools and hooks without showing the model.Pro