Overview
Custom tools let the agent call functions you define. Instead of the agent completing everything in one shot, it can pause to request data or actions from your system, then continue once you provide the results. This enables use cases like:- Looking up order details from your database
- Sending emails through your email service
- Querying your internal APIs
- Creating records in your CRM
How It Works
- You send a request with
message+tools(your function definitions) - The agent decides which tools to call based on the message
- If tools are needed, the API returns
status: "requires_tool_outputs"with the tool calls - You execute the functions in your system and submit the results
- The agent continues until it has a final answer (or needs more tool calls)
Credits are charged once on the initial request. Tool output submissions are free.
Defining Tools
Each tool needs aname, description, and parameters (JSON Schema format):
Tool Schema Rules
| Field | Type | Required | Constraints |
|---|---|---|---|
name | string | Yes | Alphanumeric + underscores, max 64 chars |
description | string | Yes | Max 1,024 chars |
parameters | object | Yes | Must have "type": "object" |
- Maximum 20 tools per request
- Maximum 10 tool call rounds per execution
- 5-minute timeout between submissions
- Maximum 100KB per tool output
Complete Example
Step 1: Send a request with tools
Step 2: Handle requires_tool_outputs
The response tells you which tools the agent wants to call:
Step 3: Execute and submit results
Run the function in your system, then submit the output:Step 4: Get the final response
The agent may return anotherrequires_tool_outputs (e.g., to send the email), or a completed response:
Handling the Loop
In production, wrap the tool call flow in a loop:Machine Affinity
The_compute_instance field ensures your tool output submissions are routed to the same server that holds the execution context. Always pass it back in subsequent requests.
Limitations
| Constraint | Limit |
|---|---|
| Tools per request | 20 |
| Tool call rounds | 10 |
| Context TTL | 5 minutes |
| Output size per tool | 100KB |
| Streaming | Not supported with tools |
| Platform capabilities | Chat only (no browser, code, etc.) |
Error Codes
| Code | HTTP | Description |
|---|---|---|
invalid_tools | 400 | Tool definitions are malformed |
invalid_tool_outputs | 400 | Tool outputs array is malformed |
context_expired | 404 | Execution context expired (5-min TTL) |
tool_output_too_large | 400 | Single output exceeds 100KB |

