Back to catalog / Agent tools
Orchestrate tool calls in batches inside a constrained execution environment
Have the model write code that chains API calls inside a code-execution tool and returns only filtered results.
Goal
Reduce round trips for multi-tool data processing while limiting data passed into the final answer.
Steps
- Define callable tools and parameter schemas over the synthetic expense API; keep credentials in the controlled tool layer. [ptc]
- Enable the code-execution tool as in the PTC notebook; constrain generated code to allowed tools and aggregation/filtering. [ptc]
- Audit calls, I/O size, and results in a sandbox; compare latency/tokens against ordinary sequential calls. [ptc]
How to verify
The code-execution environment has no production credentials or unlisted tools; aggregates match per-call fixtures.
Troubleshooting
If generated code prints large data, return only required columns/summaries; stop on failures/timeouts without replaying side effects.
Permissions
Prerequisites
- Python 3.11+, Anthropic SDK >=0.72, an API key, constrained code execution, and synthetic tool APIs.
Permissions
- Use synthetic expense data only; configure no payment, account, or write credentials.
Limitations
PTC requires supported code execution; running generated code is high risk and needs isolation, time/resource limits, and restricted network/filesystem.
Pinned upstream source
- Repository
- anthropics/anthropic-cookbook
- File path
- tool_use/programmatic_tool_calling_ptc.ipynb
- Pinned commit
9c1e493ddd2b82df399d2a61b9c806c539e18be6- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: MIT
Main topic
Take a coding Agent change from context to verification