Skip to main content
Claude APIAI-агентыАвтоматизация

Claude Programmatic Tool Calling: Reliable Agents & Lower Costs

Anthropic has released Programmatic Tool Calling for Claude in production. The model can now write and execute Python code in a sandbox to batch-call tools. For business, this means reduced latency, fewer errors in agent scenarios, context window savings, and more predictable automation of complex processes.

Technical Context: What Changed and Why It Matches the Game

I carefully analyzed Anthropic's documentation on Programmatic Tool Calling (PTC) and identified the main point: this isn't just "another tool use," but a shift in orchestration mechanics. Claude can now generate a Python script, execute it in a sandbox, and perform multiple tool calls, process data, and return only the final result to the context within that single execution.

The key element is the code execution tool code_execution_20260120. In the classic approach, an agent creates a chain: call tool → get raw response → inference again → next call. With PTC, I get a single "executive block": loops, conditions, error handling, and aggregations are moved by Claude into the code, rather than being smeared across reasoning tokens.

The most practical detail is the security model via allowed_callers. If I want a tool to be callable from sandbox code, I explicitly define "allowed_callers": ["code_execution_20260120"] (or add “direct” if dual modes are needed). This disciplines the architecture: I do not allow dangerous operations (payments, deletions, any "irreversible" actions) into the programmatic loop.

And one more thing many overlook: Anthropic directly encourages describing tool outputs as structurally as possible (JSON schemas, fields, types). In PTC, this isn't cosmetic—the stability with which the code parses answers and filters noise depends on the quality of these schemas.

Business Impact and Automation: Where You Win and Where You Can "Break Prod"

In my terms, this is about three metrics: latency, context cost, and predictability. When an agent needs to perform 20–200 similar actions (exports, checks, reconciliations, enrichment), sequential round-trip calls turn the system into something slow and expensive. PTC packages a series of steps into one executable scenario and sharply reduces overhead costs for repeated inferences.

The second benefit is that the context stops bloating with intermediate results. I can run thousands of transaction lines or warehouse positions through tools, aggregate them, and return only the summary and exceptions to the model. This is a direct lever for AI automation in accounting, logistics, procurement, compliance, and analytics, where "raw tables" usually kill the context window.

But I also see a new class of risks. If a team without experience starts "allowing everything from code," they accidentally open a path to undesirable operations. In Nahornyi AI Lab projects, I establish a tool policy: read-only by default, write-tools only with additional checks, and irreversible actions via a separate human or service gate.

Who wins? Companies with a lot of process routine and data, not just a chatbot. Who loses? Those who counted on "gluing an agent together with prompts" without engineering discipline: PTC raises the bar for AI solution architecture and testing.

Strategic View: How I Would Build Agent Stacks for PTC in 2026

I perceive PTC as a step towards a "microservice" agent model: the model becomes the orchestrator, and business logic breaks down into instrumental loops with clear contracts. In our implementations, I would highlight three layers: a tool catalog with contracts, a policy layer (who can call what and from where), and an observability layer (tracing, budgets, sandbox limits).

An unobservable PTC system will be expensive to support. Therefore, I design telemetry immediately: which tools are called, how long the execution block takes, how much data is filtered, and where retries occur. This turns the "magical agent" into a manageable production component that can be optimized like a regular backend.

My non-obvious forecast: via PTC, many companies will start moving part of their ETL and reconciliations from BI scripts directly into agent chains. This is possible, but only if artificial intelligence implementation is done with data quality control, schema versioning, and regression tests on typical cases. Otherwise, you get "smart" automation that sometimes silently makes mistakes.

This analysis was prepared by Vadim Nahornyi—Lead Expert at Nahornyi AI Lab on AI architecture and automation. I treat PTC as a practical tool for production agents: from allowed_callers policies to observability and safe AI integration into your systems. Write to me—we will analyze your process, select tools, design security perimeters, and bring the agent to stable operation in prod.

Share this article