- Server registry: JSON schema metadata so models know tool names and arguments.
- App-defined tool: your code that runs when the model asks to call that tool.
Register one tool
This example defines aparse_pdf tool with a single required string argument file_path.
Python
List tools
Python
App-defined tool contract
For Python integrations, handlers use this signature:- Signature:
async def tool(args: dict, agent_id: str, task_id: int) -> str - Return: a string. For structured output, return JSON text (for example
json.dumps({...})).
args: model-supplied arguments for that tool call.agent_id: which workflow invoked the tool (lets one handler support multiple agents).task_id: the specific run id for logging, tracing, and run-scoped lookups.
SSE runtime path
For streaming runs, register handlers withset_tools before execute_agent / run_agent. The client invokes them automatically when the run pauses for tool calls.
Webhook runtime path
If you run with webhooks, parse webhook payloads and submit tool responses explicitly:tool_results = await client.process_webhook_tools(request, tools_map)await client.send_tool_responses(request.agent_id, request.task_id, tool_results.results)