A developer's guide to coding agentsRevised October 2026

Agentic
Engineering.

From token prediction to bounded, verified work

context → effort → verify ↺
2
The invoice task

A useful task has a finish line

Vague request

“Fix the invoice bug.” The agent has to infer both the rule and what counts as done.

Checkable request

“Apply the VAT rate from the order. Preserve the tests, run the invoice suite, and show the diff.”

Illustrative comparison, not two measured runs. A clearer request makes the result easier to assess; it does not guarantee success.

3
Our route

Build a loop you can trust enough to use

Understand the machinery

Model → harness → tool result.

Define and check done

Acceptance cases, limits and evidence.

Control the workload

Useful context, measured cost and reusable checks.

One task throughout: correct the invoice total, then verify its CSV export.

4
The predictor · what an LLM does

The model generates one token at a time

  • Each step produces a distribution over possible next tokens; decoding chooses one.
  • The prediction depends on learned patterns and the context available to that step.
  • Tool calls are generated output too. A separate program handles their execution.

The animation is a simplified decoding example. It does not describe everything learned during training.

5
The predictor · attention

Attention connects information in context

The invoice test expects VAT so ___ ? illustration: earlier tokens can influence the next prediction
  • Attention layers combine information from token positions with different weights.
  • Supply the VAT rule and relevant code. Availability in context still does not guarantee correct use.

Conceptual diagram: multiple heads and layers contribute. Context is an input you curate, not a literal program.

6
Model behavior

Reasoning: the model writes steps into its context before answering

Illustrative contrast, same model, same question — not a captured transcript # question: why does the invoice test expect 121, not 100? answer first › Probably a rounding bug. ✕ guess # with reasoning: intermediate steps become context the answer can use step › order says net 100.00, VAT rate 21% step › 100.00 × 1.21 = 121.00, so the test expects VAT applied answer › Apply the VAT rate from the order; check rounding. ✓ checkable

Reasoning effort is a dial: more steps can help, and they cost time and tokens. Compare the supported settings on the same acceptance cases.

7
The machinery

Three parts, three different jobs

Model

Proposes text or a structured tool call.

Harness

Builds context, applies permissions and coordinates tool execution.

Client

The terminal, editor or web interface where you inspect and steer the work.

For the invoice task: the model requests a test run; the harness arranges it; the client displays the result.

8
The machinery

A tool result becomes evidence for the next step

Illustrative tool exchange — syntax varies by harness model → request: run invoice tests harness → execute permitted command in test environment tool → exit 1; expected 121.00, got 100.00 model → inspect the VAT calculation; propose a patch

A tool request is a proposal to execute. Permissions and the tool environment determine what actually happens.

9
Hands · client & server

The harness supplies context for each call

YOU HARNESSclient MODEL APIAPI endpoint type: "fix the bug" context ~5k send context tokens + tool call run tool locally context ~9k send context — bigger tokens + tool call run tool locally context ~14k send context — bigger still final answer

Illustrative API-backed loop. History may be sent again, referenced through a stateful API, or compacted; it is not permanent model memory.

10
The loop · the inner loop

Keep going, with a limit and a stop condition

  • The harness returns tool results so the model can choose the next step.
  • A verifier checks the candidate result. Failed checks can trigger another attempt.
  • Stop on success, exhausted budget, repeated failure or a required human decision.

For the invoice fix: at most three repair attempts, then report evidence and unresolved failures.

11
Define done

A green check proves only what it checks

Behavior

VAT comes from the order; zero VAT and rounding cases pass.

Integrity

Existing tests remain meaningful. Inspect changed assertions and test discovery.

Acceptance

Review the diff and exported values against the task, including gaps in coverage.

Exit code 0 is useful evidence. It is not proof that the full task is correct.

12
Define done

Match each failure to a control

FailureConcrete control
Repeats the same failed repairLimit attempts; require a new hypothesis before retrying.
Weakens tests to make them passReview the test diff; run independent acceptance checks.
Changes unrelated behaviorScope allowed paths; inspect the complete diff.

Prompts help communicate these rules. Enforce the important boundaries in tools, permissions and review.

13
The invoice task

Make the acceptance contract explicit

GOAL: export invoice net, VAT and gross values to CSV. SCOPE: invoice export code; preserve existing tests. VERIFY: pytest tests/test_export.py -q CASES: 21% VAT, zero VAT, rounding, quoted CSV fields. LIMIT: three repair attempts; then stop and report. EVIDENCE: diff, command, exit status, failures and gaps.

Pair this request with an enforced runtime budget and a review of the resulting artifact.

14
The bill · context growth

A short message can carry a long history

ILLUSTRATIVE — three requests, including history
turn 1 "why no VAT?" ~8,500 in system · tools · CLAUDE.md turn 2 "fix it" ~13,000 in turn 1's exchange turn 3 "run the tests" ~15,500 in turn 2 system + tools + CLAUDE.md (every turn) turn 1: reply + 2 files read turn 2: the diff you

Illustrative input volumes, not a bill. Repeated history counts as input; cache hits may have a different rate.

15
Count the work

Count each billing category separately

CategoryWhat to record
Uncached inputNew input processed at its applicable input rate.
Cache writes and readsSeparate token counts and the configured cache rates.
Generated outputOutput usage, including billable reasoning where applicable.

Bill = sum of each category’s tokens × its rate, plus any separate tool or service fees.

16
Worked arithmetic

One cache-hit request: about five cents

Illustrative usage and ratesCost
19,000 cached input × $0.20 / million$0.0038
3,700 new input × $4 / million$0.0148
1,600 output × $20 / million$0.0320
22,700 input + 1,600 output in total$0.0506

Assumed rates, not a measured bill. Without the cache hit: $0.0908 input + $0.0320 output = $0.1228.

17
The bill · KV cache · how

Caching reuses work on a matching prefix

  • A prompt cache can reuse computed state for eligible, matching earlier content.
  • Keep reusable instructions stable. Changes can invalidate the affected prefix and later content.
  • Inspect cache usage records: expiry, minimum length and provider rules affect whether you get a hit.

Animation shows prefix reuse. Its price label is illustrative; rates vary. Cached content still occupies context.

18
Context quality

Keep the facts that the next decision needs

Keep

The invoice rule, failing case, relevant code, decisions and latest test result.

Summarize or remove

Duplicate file dumps, stale logs and abandoned approaches, once their useful findings are captured.

Watch for missed requirements and repeated work. There is no universal “dumb zone” or safe fill percentage.

19
Split the work · subagents

Delegate a question; ask for evidence back

  • Fresh helpers need a self-contained task and relevant inputs. Forks can inherit existing history.
  • Keep intermediate investigation in the helper’s context; return findings with file references.
  • Review the result. Delegation adds coordination cost and does not itself isolate filesystem access.

Example return: VAT calculation locations, the failing path, supporting lines and unresolved questions.

20
Model choice

Measure the task, including the failed attempts

Same acceptance bar

Use representative invoice cases and the same permissions and tools.

Whole run

Record quality, elapsed time, all token categories, retries and review effort.

Repeat and compare

Repeat representative cases before changing the default configuration.

A higher-priced model can finish in fewer attempts. Whether it costs less is a measurement, not a rule.

21
Model choice

Escalate when the evidence points to a need

  • Start: use a configuration that has met the acceptance bar on similar work.
  • Diagnose: missing facts, a broken tool and hard reasoning call for different fixes.
  • Compare: try supported effort or model changes against the same checks and budget.

There is no universal “effort first” ladder. Re-evaluate defaults when the task or model changes.

22
Split the work

Assign a role and a return contract

Worker

Implement the bounded invoice change. Return the diff, test output and known gaps.

Reviewer

Check the tax rule, changed tests and edge cases. Return findings with evidence and severity.

Choose configurations from measured performance in each role. A second model’s opinion is not a verifier.

23
Split the work · dynamic workflows

One workflow for the invoice change

  • Explore: independently inspect the rule, calculation and export path; return evidence.
  • Plan and build: reconcile findings, then give one owner the implementation.
  • Verify: run acceptance checks and inspect the diff. Retry only within the remaining budget.
inspect rule inspect calc inspect export ∥ parallel plan build verify · tests fail → if budget pass → review

Pass evidence between stages. Parallelize independent investigation; coordinate edits and integration.

24
Split the work

Use the simplest shape that fits

Task shapeStarting point
Explain the VAT ruleOne question with the relevant source.
Fix the invoice calculationOne agent with tools and acceptance checks.
Repeat a repair cycleA bounded loop with a meaningful stop condition.
Investigate independent areasHelpers with explicit inputs, returns and an integration owner.

Add orchestration when it resolves a real bottleneck. Measure its coordination cost too.

25
Make it repeatable

Store the rules needed on most tasks

# Project instructions — illustrative invoice repository - Test with: pytest tests/test_invoice.py -q - VAT rates come from the order record. - Preserve existing assertions; explain test changes. - Ask before changing the stored invoice schema.

Use the instruction-file convention your harness actually loads. Keep standing rules short and specific.

26
Make it repeatable

Save the repeated invoice check as a skill

invoice-check/ SKILL.md when to use it + verification procedure scripts/ optional deterministic checks references/ VAT and rounding rules

Procedure: inspect the diff → run the cases → report evidence and gaps.

27
Make it repeatable

Connect a few procedures with explicit outputs

Plan the change

Input: invoice defect.
Output: rule, scope and acceptance cases.

Implement and check

Input: accepted plan.
Output: patch, tests and unresolved issues.

Review and record

Input: patch and evidence.
Output: reviewed result and a reusable lesson.

Teach the workflow through its outputs. Add a new skill only when a repeated need justifies it.

28
Make it repeatable

Package useful checks for the team

Skill

The repeatable invoice-check procedure and supporting files.

Plugin or shared package

A versioned way to distribute the procedure and supported integrations.

Test discovery and behavior in a clean session before sharing. Installation does not replace review or permission boundaries.

29
Take it back to work

Give the next task a checkable finish

  • Define done: name the behavior, scope, acceptance cases and stop limit.
  • Keep evidence: inspect the diff and actual check results; report what remains unverified.
  • Measure and reuse: record total task cost, then save the check you repeat.

Optional reference: arithmetic, workflow sketch and skill publication

30
Sources

Questions? Check the evidence.

Primary sources checked 3 October 2026. Worked examples are illustrative. All decks.