Agentic Engineering: The Discipline of Cheaper Agents

Agentic engineering is the discipline of designing what an AI coding agent reads, runs, and remembers per turn. Get it right and your agents get cheaper and more accurate at once.

Profile photo of Paul Irolla

By Paul Irolla

Founder · AI & developer tools · Tokenade

Ph.D. in AI · builds token-optimization tooling for AI coding agents

View author page
8 min read
Cite this page

What is agentic engineering?

Agentic engineering is the discipline of deliberately designing the loop an autonomous AI coding agent runs in — what it reads, what tools it can call, what it keeps in its context window, and what it does with the results — so the agent stays accurate while spending far fewer tokens. It sits one level above prompting and one level below "just hope the model figures it out." I've spent the last couple of years building tooling that sits in this loop, and the single most reliable way to make an agent both cheaper and better is to engineer the loop itself rather than nag the model with a longer system prompt. The reason this is now a named discipline, rather than a footnote in a prompting guide, is that agents stopped being one-shot. A modern coding agent reads files, runs your test suite, greps the repo, calls a database, loops over the output, and tries again. Every one of those steps re-sends a growing payload of code, history, tool schemas, and command logs back through the model. Prompt engineering optimises one message. Agentic engineering optimises the entire feedback loop that message lives inside. If you want the hands-on lever list rather than the philosophy, start with how to reduce AI coding agent token usage; this piece is about the discipline that ties those levers together.

How is agentic engineering different from prompt engineering and vibe coding?

Agentic engineering operates on the loop; prompt engineering operates on a single instruction; vibe coding operates on vibes. They are not competitors so much as three different altitudes. Prompt engineering asks: "what wording gets the best single response?" That mattered enormously in the chat era and still matters at the margins. But in an agentic session the wording of your instruction is a rounding error next to the hundreds of thousands of tokens the agent assembles on its own across a dozen turns. Vibe coding asks nothing — you describe what you want, let the agent run, and accept whatever falls out. It is genuinely useful for throwaway prototypes, and I do it more than I'd admit in a job interview. The problem is that the agent's defaults are tuned for "never miss context," not "spend wisely," so a vibe-coding session quietly reads whole files, loads every MCP tool, and dumps raw command output back into the window. Fun until the invoice arrives. Agentic engineering is the grown-up version of vibe coding. You keep the speed but you design the loop so the agent's defaults stop working against you. Concretely, it overlaps heavily with context engineering — context engineering is the part of agentic engineering that governs what enters the window. Agentic engineering is broader: it also covers which tools exist, how the agent decides to act, when it stops, and how its output is shaped before it loops back. Think of context engineering as load management and agentic engineering as designing the whole machine.

Why does the agent loop cost so much more than a single prompt?

The agent loop costs more because input gets re-sent on every turn, and input is most of the bill. This is the fact that reframes everything. When you send one message to a model, you pay for that message once. When an agent runs a 15-turn session, the system prompt, the conversation history, every file it has read, and every tool schema it has loaded are re-submitted as input on each subsequent turn. Output — the tokens the model actually generates — is a small and slow-growing fraction. The input is the fat part, and it compounds. The pricing makes this concrete. On Claude Sonnet 4.6, input is roughly $3 per million tokens and output $15; on Opus 4.8 it's $5 input and $25 output; on GPT-5.5, $5 input and $30 output (Anthropic pricing; OpenAI pricing, 2026). Because input dominates an agent session, the input price is the one that decides your bill. There is one large escape hatch: prompt caching. A cache read costs roughly 10% of the normal input price, so a context with a stable prefix the model has already processed this session is cheap to re-send. That is exactly why agentic engineering and caching reinforce each other — a loop designed to keep the stable parts at the top of the window is also the loop that caches best. There's a second, less obvious cost: attention. Liu et al. ("Lost in the Middle", 2023 — arxiv.org/abs/2307.03172) showed that models retrieve facts placed in the middle of a long context far less reliably than facts at the edges. A bloated loop doesn't just cost money; it buries the very information the agent needs. So engineering the loop pays twice: a smaller bill and a sharper agent.

What does a well-engineered agent loop actually look like?

A well-engineered loop controls four surfaces — retrieval, tools, output, and history — instead of letting the agent's defaults run wild on each. Here is what each surface costs you when ignored, and the lever that fixes it.
SurfaceDefault failure modeThe lever
RetrievalReads whole files "just in case"Semantic code search + skeleton-first reads
ToolsLoads every MCP schema up frontLazy MCP tool loading
OutputDumps raw logs into the windowOutput filtering
HistoryGrows unbounded every turnContext compression
Retrieve, don't ingest. When an agent needs three functions from a 600-line file, the default is to read all 600 lines because that's the safe move. Semantic search finds the relevant chunks by meaning rather than exact string match, and skeleton compression hands the model the file's structure — signatures, classes, imports — before it commits to reading any body. The agent sees the map, then asks for only the streets it needs. Load tools lazily. Every MCP tool definition sitting in the context is input you pay for on every turn, whether the agent calls it or not. A loop that exposes tool names up front and loads full schemas only on demand cuts a fixed tax you were paying silently. Filter output before it loops back. A passing test suite produces hundreds of lines of "ok ok ok"; the agent needs the three lines that failed. Output filtering keeps the signal — the actual error, the actual diff — and drops the boilerplate before it re-enters the window. This is the single highest-leverage move for agents that run shell commands, because command logs are pure noise per token. Compress history. The transcript is the one surface that only grows. Old turns can be summarised or pruned once their details no longer drive decisions, keeping the loop from drowning in its own past. None of this requires retraining a model or rewriting your agent. It is loop design, applied at the boundary between the agent and the tools it calls.

How do I apply agentic engineering today?

Start by measuring, then pull the four levers in order of payoff. Concretely:
  1. Measure before you optimise. You can't engineer a loop you can't see. Get a token breakdown per turn so you know whether retrieval, tools, output, or history is the fat part. Our LLM token cost calculator turns a token count into a euro figure, and the token counter tells you how big a given blob actually is.
  2. Kill output noise first. It's the cheapest win and usually the biggest. Filter command logs and test output down to the lines that change a decision.
  3. Switch reads from ingest to retrieve. Default to skeletons and semantic search; let the agent escalate to a full read only when it's justified.
  4. Prune your tools. Audit what MCP servers you have loaded — see best MCP servers for Claude Code — and load schemas lazily.
  5. Then, and only then, tune the prompt. Once the loop is lean, instruction wording starts to matter again, because it's no longer drowned out by noise.
If you'd rather not hand-roll all of this, that's the gap Tokenade fills. It sits between your agent and its tools — semantic code search, skeleton compression, output filtering, lazy MCP loading — and shows you the savings on a dashboard so you're optimising against a number instead of a vibe. It works with Claude Code, Cursor, Codex, Copilot, Windsurf and the rest, it's source-available under MIT so you can read exactly what it does to your context, and the Free plan covers around 10M tokens of savings a month (unlimited machines) before Pro at $19.90/mo excl. tax (US) or €19.90/mo incl. tax (FR). See AI coding agent token costs for the math on what those savings are worth in cash.

What goes wrong (anti-patterns)

The failure modes here are predictable, which is the good news — you can spot them before they cost you. Optimising the prompt while the loop bleeds. Spending an afternoon polishing your system prompt while the agent re-reads a 2,000-line file every turn is rearranging deck chairs. Fix the loop first. Cutting load-bearing context. The opposite mistake: stripping so aggressively that you remove the signal. The rule is to cut low-value content — boilerplate logs, irrelevant files, unused tool schemas — never the signatures and error messages the model reasons over. Structure-first reads work precisely because they keep every public signature. Treating caching as a substitute for loop design. Prompt caching makes a noisy context cheaper to re-send; it does not make it less noisy. A perfectly cached loop full of irrelevant files is still feeding the model garbage at 10% of the price. Cache and engineer. Assuming bigger context windows solve it. A larger window just raises the ceiling on how much you can waste, and the "lost in the middle" effect means you'll get worse retrieval for your trouble. Capacity is not a strategy. The throughline: agentic engineering is what you do instead of hoping the model and your wallet sort it out between themselves. Design the loop, measure the result, and the cheaper agent and the smarter agent turn out to be the same agent.
See also:

Ranked #1 on the Token-Harness Optimizer Leaderboard.

Tokenade ranks #1 in the Token-Harness Optimizer Leaderboard — an end-to-end benchmark of agent token optimizers measured on real coding sessions. Set it up once, it works on every prompt. Works with Claude Code, Cursor, Codex, Copilot & more.