> ## Documentation Index
> Fetch the complete documentation index at: https://dataleap-469bb19d-docs-from-request-2026-08-21-templates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Programmatic tool calling

> Your agent writes a script that runs tool calls directly from code — instead of calling tools one by one.

Like [sub-agents](/scale/sub-agents-and-intelligence-levels), programmatic tool calling (PTC) is a concept to understand, not something to configure: **Dataleap applies it automatically** when a workflow is repetitive, data-heavy, and deterministic. This page explains what it does — and the one question worth asking.

<Tip>
  **The one thing you can do:** ask your agent, right in its chat — *"Would PTC make sense here?"* or *"Do you use PTC?"* It checks its own workflow, tells you honestly whether code would help, and restructures itself if it does. Worth asking whenever an agent feels slow or expensive on a repetitive job.
</Tip>

## What it does

Without PTC, the model sits in the loop for every single tool call. With PTC, it writes one script that batches the calls — and only the clean summary ever touches the context:

<Frame caption="Same workflow, two ways: 570 seconds and 200 credits — or 60 seconds and 40 credits.">
  <img src="https://mintcdn.com/dataleap-469bb19d-docs-from-request-2026-08-21-templates/iMeviPFpPq0-XJVh/images/ptc-comparison.png?fit=max&auto=format&n=iMeviPFpPq0-XJVh&q=85&s=baa24a77f31c10f6981985ea7317d5cb" alt="Comparison: one call at a time keeps the model in the loop for 17 round-trips costing 570 seconds and 200 credits, while one script with parallel calls finishes in 60 seconds for 40 credits" width="2397" height="948" data-path="images/ptc-comparison.png" />
</Frame>

On deterministic workflows, PTC is tremendously cheaper — typically **30–80% fewer credits**, and much faster. Combined with the [model tier strategy](/scale/sub-agents-and-intelligence-levels#model-tiers), repetitive workflows cost a fraction of their naive version.

## Where it helps — and where it doesn't

| ✅ PTC pays off                                                       | ❌ Plain tool use is better                              |
| -------------------------------------------------------------------- | ------------------------------------------------------- |
| Repetitive, deterministic work — the same call over hundreds of rows | One-off calls, or a couple of steps that need reasoning |
| Data-heavy loops where only the summary matters                      | Judgment-heavy flows — deciding based on what it finds  |
| Multi-step pipelines: fetch → transform → write                      | Highly variable flows where the path changes every run  |

That's also why Dataleap doesn't use PTC everywhere: code is rigid. It's fast and cheap on a fixed path, but a workflow that needs flexibility is better off reasoning step by step — and Dataleap makes that call for you.

<Card title="Watch: Programmatic Tool Calling" icon="clapperboard" href="/video-series/section-3#programmatic-tool-calling" horizontal>
  See programmatic tool calling in action.
</Card>

<CardGroup cols={2}>
  <Card title="Chapter 4: Sharing is Caring" icon="users" href="/share/overview">
    Next chapter: bring your team along.
  </Card>

  <Card title="Credits & usage" icon="chart-line" href="/admin/credits-and-usage">
    All the cost levers in one place.
  </Card>
</CardGroup>
