Anthropic Tool Runner: A Handy Beta Loop With a Clear Boundary
The Tool Runner in the SDK automatically manages the loop, the state, validation, and error wrapping - it removes the manual loop. But it has a clear boundary: per the official documentation, for human in the loop, conditional execution, and full custom logging you should use the manual loop.
What the Tool Runner takes on and what still stays on you is worth keeping in view.
The Tool Runner does · Your code still does
- Calls the Messages API until the final answer - Authorization and trusted context
- Executes the registered functions - Risk classification and the approval boundary
- Forms the tool results - Redaction and a result-size limit
- Keeps the message history inside the runner - Your event log and retention
- Bounds max_iterations - Wall time, cost budget, and a circuit breaker
The Runner calls the Messages API, executes the registered functions, forms the tool results, and keeps the history inside itself. But authorization and trusted context, risk classification and the approval boundary, redaction and a size limit, your event log, wall time, and cost budget - all of that stays your code. The Runner speeds up the loop; it doesn't replace security.
And a caveat about the status, because of which you shouldn't copy old snippets.
The beta status matters. Don't copy an unverified snippet from an old article. Open the current TypeScript tab of the Tool Runner for the installed SDK version and pin it in the lockfile. The direct Messages API contract from the previous chapter remains the stable point of understanding.
The manual loop is worth keeping in a few cases, and it helps to know them in advance.
- You need to stop execution before a preview or side effect.
- Different tools have different concurrency and retry policy.
- You need to save every normalized event in the shared cross-provider shape.
- You run one eval suite against three adapters.
The third provider remains. Google has its own recent way to run an agent loop - the Interactions API.