H-08Action & ErgonomicsEngineering

Compositional Accelerators

Lower Semantic Impedance by letting agents filter, batch and compute on the computer's side of the boundary instead of through chatty turn loops.

Human UXAgent AXFlexibility and efficiency of use→Compositional accelerators

How many tool calls does it take to count 58 customers? On a Monday morning, two days before the board meeting, a finance lead types one question into the company's analytics agent: "Which customers churned last quarter, and what did they pay us?" A human analyst would answer it with one query against the warehouse. The agent has a different set of tools.

The customer API it was given has three of them. list_customers returns IDs, fifty per page, and accepts a status but no dates. get_customer returns one full customer record. get_invoices returns one customer's invoices. Nothing can filter by date, fetch many records at once, or add anything up.

So the agent does the only thing the tools allow. It pages through 140 churned customers, then opens each record to read the churn date. Fifty-seven fall in the third quarter. It fetches invoices for each of those, one call at a time, and adds the totals in its own reasoning. That is 200 tool calls, about 17 minutes, and roughly 96,000 tokens of customer records in its context window.

The answer arrives looking confident: 57 customers, $684,250. It goes into the board deck. The real numbers are 58 customers and $702,910. Somewhere around call 120 the harness compressed early turns to free up space, and one customer fell out of the summary. Nobody can tell from the answer that anything went wrong, and the warehouse query that would have caught it runs in under a second.

Why it happens

Every tool call is a round trip. The model writes a call, the harness runs it, the result is appended to the context, and the model reads everything again to decide the next step. A person clicking through a slow web app pays a few seconds per page. The agent pays a full turn of generation, latency and reading for every single record. That per-call overhead, multiplied by how often a chatty interface forces it, is the round-trip taxLexicon · 39Round-Trip TaxTurn latency and overhead from chaining overly atomic tool calls..

The deeper problem is a mismatch of size. The agent's intent was one thought: "churned in Q3, joined to what they paid, summed." The interface only offers actions the size of one row. Engineers know the feeling from electronics, where a mismatched load reflects power back instead of using it. The Guide gives the agent version a name: semantic impedanceLexicon · 34Semantic ImpedanceMismatch between the granularity of agent reasoning and available actions., the gap between the granularity of what the agent means and the granularity of what it can do. High impedance turns one idea into 200 calls.

Jakob Nielsen's seventh usability heuristic, flexibility and efficiency of use, covers the human side. It asks for accelerators, shortcuts unseen by the novice that let an expert do in one step what would otherwise take many. Spreadsheets have filters and SUM. Admin panels have bulk select and CSV export. A person facing 140 customer pages gets bored by page ten and goes looking for one of these. The agent has no boredom to rescue it. It keeps clicking.

The figure below shows the hook's task both ways. Follow each row from the calls to the answer, and notice where the filtering, the join and the arithmetic happen: in the agent's head or in the database.

The callsWhere the work happensWhat the agent holdsThe answerOne record per calllist_customers×3get_customer×140get_invoices×57200 calls, about 17 minutesIn the agent’s headIt reads 140 records, filtersthem by churn date, joinsinvoices and adds 57 amountsin its own context~96,000 tokensof recordsCompaction dropsone customer57 customers,$684,250Wrong, and nothingsays soOne composed queryquery_customers( where, fields, sum)1 callIn the databaseIt filters by churn date, joinsinvoices and sums them wherethe data livesOne small response:58 rows and the total,~1,550 tokens58 customers,$702,910Correct
Fig. 8.1Where the work happens. With one record per call, the agent makes 200 calls and filters, joins and sums in its own head, where compaction drops a customer and the answer comes out wrong. With one composed query, the database does that work and sends back one small, correct answer.

In the top row, the database does almost nothing and the agent does everything, badly. Dates are compared in prose, records are joined by memory, and 57 dollar amounts are added by a language model. In the bottom row, each side does what it is good at. The agent says what it wants, and the database does the looping and the math.

That split has a name in systems design. Policy decides what should happen, and mechanism carries it out. The Guide applies it to tools as policy vs. mechanismLexicon · 37Policy vs. MechanismSeparating high-level semantic planning (agent) from low-level execution (interface).: the agent should own the policy (which customers, which quarter, which total) and the interface should own the mechanism (iterate, filter, join, sum). A chatty interface pushes the mechanism across the boundary into the agent, where it is slow, expensive and error-prone.

What it costs

Tokens and time. Each get_customer response in the hook is about 300 tokens, mostly addresses and billing contacts the question never needed. The agent reads all 140 of them, and then reads them again on every later turn because they stay in context. The total in the agent's window is the context loadLexicon · 13Context LoadTotal tokens competing for attention inside the context window., and here it grows by a few hundred tokens with every call. The finance lead waits 17 minutes for a number that should take seconds.

Wrong answers that look right. Large context loads end in compaction, where the harness summarizes old turns to make room, and summaries drop things. Arithmetic over dozens of values held in context is a job language models do unreliably. Either failure produces a clean, plausible number with no error attached. That is worse than a crash, because a crash gets investigated.

Quiet shortcuts. A model that notices it is burning its budget may decide, on its own, to sample 30 customers and extrapolate, or to use list prices instead of fetching invoices. If it does that without saying so, the Guide calls it silent corner-cuttingLexicon · 50Silent Corner-CuttingQuietly lowering standards or declaring premature success instead of failing.: lowering the standard of the work while still reporting success. Chatty interfaces invite it, because they make doing the job properly expensive.

Supervision and trust. After one wrong number reaches the board, someone has to re-check every figure the agent produces. The analyst who now verifies each answer by hand is the real cost of the missing filter parameter. For leaders, the lesson is that the agent did not fail at reasoning. It was handed a spoon and asked to empty a pool.

The fix

In plain words: let the agent describe the result it wants, and let the computer do the looping. Any tool that returns collections should let the caller do four things on the server's side of the boundary.

  1. Filter: narrow the set by the fields the agent will reason about, including dates and ranges.
  2. Project: choose which fields come back, so a question about churn dates doesn't return billing addresses.
  3. Batch: act on many IDs in one call, when a list of IDs is all the agent has.
  4. Compute: count, sum, group and join where the data lives, and return the totals as facts.

Here is the hook's task before and after. The token meters count everything the agent had to read for the whole task, not just the lines shown.

Before: 200 callscustomer data → 96,000 tok
list_customers(status="churned", page=1)  → 50 ids 1
list_customers(status="churned", page=2)  → 50 ids
list_customers(status="churned", page=3)  → 40 ids
get_customer(id="cus_1042")  → { …, "churned_at": "2026-07-03", … } 2
get_customer(id="cus_1043")  → { …, "churned_at": "2025-11-19", … }
… 138 more get_customer calls
get_invoices(customer_id="cus_1042")  → [ 12 invoices ] 3
… 56 more get_invoices calls
total = 41200.00 + 3480.00 + … (57 values) 4
  1. 1The list tool accepts a status but no date range, so the agent must fetch all 140 churned customers ever to find the 58 from last quarter.
  2. 2Each full record costs about 300 tokens to deliver one date. The agent compares the dates itself, 140 times, in its own reasoning.
  3. 3The join between customers and invoices happens one ID at a time, across 57 more round trips, with all earlier results still sitting in context.
  4. 4A language model adds 57 dollar amounts from memory after a compaction has already dropped one customer. Nothing in the output reveals either error.
Tokens96,000
Round trips200 calls
Customers missing from the answer1 customers
After: 1 callcustomer data → 1,550 tok
query_customers(
  where={ "status": "churned",
          "churned_at": "2026-07-01..2026-09-30" }, 1
  fields=["id", "name", "churned_at"], 2
  sum={ "invoices": "amount_paid" } 3
)
→ {
  "status": "ok",
  "matches": 58,
  "totals": { "amount_paid": 702910.00, "currency": "USD" },
  "rows": [
    { "id": "cus_1042", "name": "Halden Logistics",
      "churned_at": "2026-07-03", "paid": 41200.00 },
    … 57 more rows
  ],
  "returned": 58, "truncated": false 4
}
  1. 1The date range goes to the server. The agent states its policy, "churned in Q3," and the database applies it to every row.
  2. 2A projection returns only the three fields the question needs, so 58 rows cost about as much as five full records did.
  3. 3The join and the sum run where the data lives. The total is computed exactly once, by a database, and arrives as a field the agent can quote.
  4. 4The response says how many rows it returned and whether it truncated. Expressive queries can return a lot, so the tool needs a row cap and has to say when it applied one.
Tokens1,550
Round trips1 calls
Customers missing from the answer0 customers
Illustrative example

Read the pins in order. Pin 1 is the cheapest fix of all: one optional churned_at range parameter would have removed 82 pointless get_customer calls on its own. Filters are where most chatty loops start, because an agent that can't narrow a set has to download it.

Pin 2 matters even when the call count is already low. A tool that always returns full records charges the agent for fields nobody asked about, and those fields stay in context for the rest of the session. Letting the caller name its fields keeps the context load proportional to the question.

Pin 3 is where the impedance disappears. The agent's thought was "join and sum," and now there is an action the same size as that thought. The database is also simply better at arithmetic than a model reading numbers back out of its own context. A computed total is a fact. A total the model added up in its head is a guess with good formatting.

Pin 4 is the price of the power. A tool that can answer big questions can also return big answers, so it reports returned and truncated every time. If the row count were 50,000, the right response would be the totals plus a cursor, never a firehose.

The same pattern on other tools

Every domain has its own version of the 200-call loop. Here are the common shapes and their accelerators:

Chatty loopWhat the agent was trying to doAccelerator
get_ticket(id) × 80 to find the urgent onesFiltersearch_tickets(priority="urgent", updated_since=…)
get_user(id) × 40 for 40 IDs from a logBatchget_users(ids=[…]) with per-ID not_found
read_file × 30 to find a function nameFilter, then projectgrep with a pattern, returning file and line only
list_orders page by page to count refundsComputecount_orders(status="refunded", group_by="month")
get_metric(day) × 90 to chart a quarterComputequery_metric(from, to, bucket="week", agg="sum")

Two shortcuts deserve a word. A read-only SQL or code-execution tool is the most general accelerator there is: the agent writes the whole pipeline in one call. It works well where models already know the language, and it needs the guardrails discussed under tensions below. And batching writes is a different decision from batching reads. Fetching 40 users in one call is harmless. Updating 40 in one call deserves a dry run first.

In MCP terms

If query_customers lives in an MCP server, each tools/call runs it once, with one set of arguments. The protocol has no batch, query or compute primitive underneath, so the filter, the projection and the sum all have to be arguments you design.

  • Input schema (inputSchema). Give each accelerator a typed slot: where.churned_at as a date range, fields as an array of field names from an enum, sum limited to an enum of aggregations. Any JSON Schema 2020-12 keyword is allowed. For "IDs or a filter, not both," the spec advises declaring every property at the root and keeping oneOf branches to required checks.
  • Structured results (structuredContent, outputSchema). Return matches, totals, returned and truncated as typed fields. The total arrives as a value the agent can quote and the client can validate, never one the agent adds up.
  • Text summary (content). Pair the rows with one line, such as "58 customers churned in Q3, $702,910 paid." The spec's own example pairs a prose summary with structured data.
  • Tool annotations (readOnlyHint). Set it to true on query_customers. The defaults assume the worst: not read-only, destructive and open-world. A batch write tool keeps destructiveHint: true. Annotations are hints, untrusted unless the server is trusted.
  • Not in the protocol. Tool results have no built-in pagination or row cap. The cursor and the truncated flag from pin 4 belong in your payload.

Spot it in your traces

Here is the hook's session as a trace. The calls inside each loop look identical except for one ID, which is the signature to look for.

TraceAn analytics agent answering a churn question
  1. T1
    list_customers(status="churned", page=1)→ { "ids": ["cus_1042", "cus_1043", …], "next_page": 2 }No date filter. I'll collect all churned IDs, then check each date.The agent spots the missing filter in its first turn and plans around it. The plan is correct and very expensive.
  2. T2
    get_customer(id="cus_1043")→ { "name": "Orrin Supply", "churned_at": "2025-11-19", "billing_contact": {…}, … }Churned in 2025, not Q3. Skip.About 300 tokens to learn one date that rules the customer out. 82 of the 140 calls in this loop end this way.
  3. T3
    (harness) compact turns 1–118→ summary: "cus_1042 … cus_1390 checked, 41 in Q3 so far"The summary of the early records undercounts the Q3 customers by one. Every later turn builds on the summary instead of the records.
  4. T4
    get_invoices(customer_id="cus_1042")→ [ { "amount_paid": 3600.00, … }, … 12 invoices ]Halden Logistics paid 41,200 in total. 56 to go.A join performed one ID at a time. The running total now lives only in the agent's reasoning.
  5. T5
    report(answer)→ "57 customers churned in Q3, $684,250 paid"All customers checked. Reporting.A clean answer after 200 calls. Wrong by one customer and $18,660, with nothing in the output to show it.

Every one of those calls succeeded. To find the same pattern in your own logs, look for these signals:

  • Fan-out runs. The same tool called many times in a row where only one ID argument changes. Group calls by tool name and count consecutive repeats. A run of ten or more is almost always a missing batch or filter parameter.
  • IDs copied from one response into a loop. A list call followed by N detail calls whose IDs all came from that list. This is a join the server should have done.
  • Filtering in the reasoning. Thoughts like "not in range, skip" or "doesn't match, next" after a fetch. Each one is a filter the tool didn't accept.
  • Arithmetic in the reasoning. Running totals, "so far" counts, or long sums written out in the agent's text. Any number in a final answer that no tool returned is worth checking.
  • Compaction during data collection. A context compaction event in the middle of a fan-out run means the result depends on a summary. Treat those answers as unverified.

Review checklist

Run these against every tool that returns collections or is used inside a loop. Each check takes a call or two, and the list pastes straight into a pull request template for new tools.

Review checklist · 6 items
  1. Accept filters on every field the agent is expected to reason about, including date and number ranges.How to check Pick a realistic question for the tool, such as "items changed in the last week." Answer it with one call. If you need a second call only to discard results, a filter is missing.
  2. Let the caller choose which fields come back.How to check Call the tool asking for two fields. The response should contain those fields plus the identifiers, and its size should drop accordingly.
  3. Offer a batch form for every single-record read: one call, many IDs.How to check Fetch ten records in one call, including one ID that does not exist. You should get nine records and an explicit not_found entry for the tenth.
  4. Compute counts, sums and groupings on the server and return them as fields.How to check Ask for a total and compare it with the same total from your database or warehouse. They should match exactly, with no arithmetic left to the agent.
  5. Cap result size and say so whenever the cap applies.How to check Run a query that matches more rows than the cap. The response should report the total, the number returned, truncated: true, and how to fetch the rest.
  6. Keep composed tools read-only, or give batch writes a dry run.How to check Call a batch write with dry_run=true. It should report how many records would change and show a sample, without changing anything.

When laws collide

Giving the agent more power per call makes each call harder to check, so this heuristic pulls against the safety laws and reinforces the efficiency ones.

  • Pulls against · H-10Poka-Yoke Boundaries
    Where they clash
    Poka-Yoke Boundaries wants every argument validated before the tool runs. A free-form SQL string or script is the most powerful accelerator and the hardest thing to validate: a typo in a join condition still runs and still returns a confident number.
    How to have both
    Prefer a structured query grammar (named fields, typed ranges, an enum of aggregations) that the tool can validate synchronously and reject with a precise error. Offer raw SQL only on read-only replicas, with a timeout and a row cap, and echo the parsed query back so the agent can check what actually ran.
  • Where they clash
    Batching is pure gain for reads. For writes it multiplies the blast radius: update_customers(where={status: "churned"}, …) with a wrong filter changes 140 records in one turn instead of one.
    How to have both
    Batch reads freely. Give every batch write a dry run that returns the match count and a sample, declare it as destructive in the tool annotations, and require an explicit confirmation when the count crosses a threshold. Speed for reads, deliberate friction for writes.
  • How they combine
    Token Hygiene asks each response to carry only what helps the next decision. Server-side filtering, projection and aggregation are the most direct way to do that: the irrelevant rows and fields never leave the database.
    What you get
    Fewer calls and smaller responses compound. The agent reads less on each turn and also has fewer turns in which to re-read everything, so the context stays small enough that compaction never has to guess.

Model size shifts where the line sits. A capable model can write a correct SQL query and benefits most from a general accelerator. A smaller, faster model does better with a few well-named filter parameters and a fixed set of aggregations. Both do worse with 200 calls, which is the point of fixing the interface instead of the prompt.

Terms from this page

39Round-Trip Tax
Turn latency and overhead from chaining overly atomic tool calls.
34Semantic Impedance
Mismatch between the granularity of agent reasoning and available actions.
37Policy vs. Mechanism
Separating high-level semantic planning (agent) from low-level execution (interface).
13Context Load
Total tokens competing for attention inside the context window.
50Silent Corner-Cutting
Quietly lowering standards or declaring premature success instead of failing.
esc

Try “tokens”, “errors”, “stale”, “handoff” or “blast radius”.