AgentTool値を作成し、define_tool(...)に渡します。ツールには次の項目を定義できます。
- モデルに提示するJSONの
parameters - 呼び出し可能な
input_schema、output_schema、event_schemaバリデーター timeout_msとexecute(input, runtime)- 真偽値または呼び出し可能な
require_approval - インタラクティブな処理向けの
on_tool_calledとon_response_received next_turn_paramsとon_error="return-to-model"
runtime.emit_progress(value)を、後続ターンで最新のアプリケーションコンテキストが必要な場合はruntime.set_context(value)を呼び出します。
独立したツールにはAgentToolExecutionConfig(tool_concurrency=...)を使います。実行が重なっても、保存された結果はモデル呼び出し順を保ちます。