Budget a multi-turn agent run
plan_agent_runEstimate the total cost of an agent loop that re-sends its growing context every turn, with prompt caching, on many models. Returns total cost, peak context, how many turns fit in each model's context window, how many turns fit in a budget, and a recommended model. Use before starting a long agent task.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"turns": "<turns>"
},
"name": "plan_agent_run"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cache | No | Assume prompt caching of the previous turn. Default true. | |
| turns | Yes | Number of model calls in the loop. | |
| models | No | Model ids to compare, e.g. ["claude-sonnet-5-5", "gpt-6.2-sol", "gemini-3.8-flash"]. Omit to compare every listed model. list_models gives every id. | |
| providers | No | Only these providers. | |
| budget_usd | No | ||
| task_tokens | No | Tokens of the first user message. | |
| tools_tokens | No | Tokens of tool definitions sent every turn. | |
| system_tokens | No | ||
| output_tokens_per_turn | No | Default 800. | |
| tool_result_tokens_per_turn | No | Default 1500. |