Skip to main content
Create AgentTool values and pass them through define_tool(...). Tools can define:
  • JSON parameters shown to the model
  • callable input_schema, output_schema, and event_schema validators
  • timeout_ms and execute(input, runtime)
  • boolean or callable require_approval
  • on_tool_called and on_response_received for interactive work
  • next_turn_params and on_error="return-to-model"
Call runtime.emit_progress(value) for preliminary results and runtime.set_context(value) when later turns need updated application context. Use AgentToolExecutionConfig(tool_concurrency=...) for independent tools. Saved results retain model call order even when execution overlaps.
Last modified on July 26, 2026