Agent Wealth HubFree public resources
中文 EN العربية

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

  1. Define callable tools and parameter schemas over the synthetic expense API; keep credentials in the controlled tool layer. [ptc]
  2. Enable the code-execution tool as in the PTC notebook; constrain generated code to allowed tools and aggregation/filtering. [ptc]
  3. 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

Permissions

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

https://github.com/anthropics/anthropic-cookbook/blob/9c1e493ddd2b82df399d2a61b9c806c539e18be6/tool_use/programmatic_tool_calling_ptc.ipynb

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

Related resources