You have to build a manual agentic loop to get planning into a Claude agent. Don’t use the SDK’s Tool Runner. You need that loop to keep memory and tweak your strategy as you go.
Here is what you need:
1. **Tool Definitions**: Put these in the `tools` parameter of your API request. Each one needs a `name` that fits `^[a-zA-Z0-9_-]{1,64}$`. Add a clear plaintext `description`. Define an `input_schema` as a JSON Schema object. You can add optional `input_examples` to help with complex tasks.
2. **Manual Planning Loop Execution**: Loop until `stop_reason` hits `end_turn`. Follow this pattern: * Send `messages` and `tools` to the API. * If `stop_reason` is `tool_use`, pull the tool blocks. Run the functions in your app. Add the assistant’s response and the new `tool_result` blocks to your `messages` history. * Send the updated `messages` back. * If `stop_reason` is `pause_turn`, append the response and send again to resume.
3. **Architectural Pattern**: Use an orchestrator-worker setup. Let the lead agent (Claude) make the strategy and hand off subtasks. Keep plans in persistent memory for long sessions. This lets the agent assess work, pick tools, and change tactics based on feedback.
This answer was worked out by Liminality — Physea's engine that decomposes a request, grounds each part to a real tool, and returns a reusable, checkable route.
Connect it over MCP: https://mcp.physea.ai/mcp · physea.ai