Most of an agent is ordinary software

We counted every line of code in our reference agent and sorted it by job. The code that calls the model is 817 of 24,631 lines, about 3%, and the rest is tests, checks, durable workflows, state, tracing and plumbing. So most of building an agent is ordinary engineering, and the skills you already have apply.

We once drew a picture that said the model is 10% of an agent and the harness is the rest. We said at the time that the number was a picture, not a measurement. People kept asking what the real number was.

So we counted. We took our open reference agent, a customer-support agent for a clothing web shop, and sorted every line of its Python by the job that line does.

The answer is not 10%. It is about 3%. The slogan was generous to the model.

The iceberg, with real numbers

In a demo you see the model. It reads a message, picks a tool, writes a reply. That part is the tip. Everything that keeps it honest, safe and running sits under the water.

what you see in a demo is the tip; the code you maintain is under the waterthe model call817 lines, 3%23,814 lines, 97%the loopchecks and sign-indurable workflowsstatetoolstraces and costconfigevalsthe edge, pages, reportsplus 18,415 linesof tests
The reference agent, measured. Leaving tests out, the model call is 3% of the code.

The reference agent has 24,631 lines of code, not counting tests. The code that calls a model is 817 of them. The other 23,814 lines are the loop, the checks, the waiting-for-a-person workflows, the database, the traces, the evals and the plumbing that joins them. Then there are 18,415 more lines of tests on top.

How we counted

The method is deliberately boring, so anyone can repeat it.

  1. Which files. Every .py file committed at one point in the repository's history, commit d0a8b84. That covers the agent itself, its harness package (packages/agent-harness), its evals, scripts and tests. Because we read from the commit, .venv, node_modules, scratch copies and uncommitted work can't sneak in. The repository holds no vendored code, meaning no copied-in third-party libraries.
  2. Which lines. A line counts if it holds code. Blank lines, comment lines and docstrings (the explanation strings at the top of a Python function or file) are dropped. We used Python's own tokenize and ast modules to find them, rather than guessing with a pattern.
  3. Which job. Each file goes to exactly one job, by a list of folder and file rules. The first rule that fits wins. For example, the llm folder and the model adapter go to "the code that calls a model". The approval and escalation workflows go to "durable workflows". Tests are counted on their own.

The counting script takes the repository and the commit as its two inputs, and prints the table below.

The numbers

JobFilesCode linesShare of agent codeShare of everything
The code that calls a model88173.3%1.9%
The loop201,5726.4%3.7%
Context building21440.6%0.3%
Checks, policies and sign-in312,50910.2%5.8%
Tools and tool adapters88153.3%1.9%
State and persistence241,4716.0%3.4%
Durable workflows and retries352,66710.8%6.2%
Tracing, telemetry and cost241,6776.8%3.9%
Evals535,37921.8%12.5%
Config and wiring109443.8%2.2%
Everything else526,63626.9%15.4%
Tests11018,415not counted42.8%

"Share of agent code" leaves tests out, so it adds up to 24,631 lines. "Share of everything" puts them back, for a total of 43,046.

Here are the same numbers as bars.

code lines by job, reference agent at commit d0a8b84The code that calls a model817The loop1,572Context building144Checks, policies, sign-in2,509Tools and tool adapters815State and persistence1,471Durable workflows, retries2,667Tracing, telemetry, cost1,677Evals5,379Config and wiring944Everything else6,636Tests18,415
The model call is the first bar, and one of the shortest. Tests, below the line, are bigger than any job above it.

Four things stand out.

What those lines ask of you

Look at the biggest rows again and ask what you need to know to write them. Mostly it isn't prompting.

what the other 97% asks of you: skills you may already haveTestsfakes, fixtures,recorded repliesRetries, idempotencythe same refundnever runs twiceAuththe token is checkedat the tool, every callSchemastyped inputs andoutputs at every seamSQL and Postgresstate, ledgers,queues that surviveTracingevery step writtendown, with its costTalking to the model3% of the lines
Most of an agent asks for skills a good backend or data engineer already has.

A good backend or data engineer has most of these skills already. Take a data engineer who has built a pipeline that retries without loading a file twice. That person already knows the core idea behind an agent's durable workflows. The new part, talking to the model well, is real, but it's the small part.

What goes wrong when you measure

A line count is easy to get wrong, and easy to over-read.

How to check your own agent's split

an hour with a spreadsheet, or twenty lines of PythonList the filesyour own code only,no .venv or vendored1Tag each fileone job per file,first rule that fits2Count code linesskip blanks, comments,docstrings3Divideeach job by the total,tests on their own4the model call: is it near 10%, or smaller?
How to measure your own agent's split. The rules you tag with matter more than the tool you count with.

You don't need our script. A rough first pass is one line in the repository's folder. It keeps docstrings in, which barely moved our answer:

git ls-files '*.py' | xargs grep -cvE '^\s*(#|$)'

That prints a count per file. Paste it into a spreadsheet, add a column for the job, and write down the rule you used for each folder. Tag a file by what it mostly does. If a file does three jobs, that is a finding too.

Five questions to check your own split

  1. Can you point to the one place where every model call goes through, and say how many lines it is?
  2. Is your test code bigger or smaller than your agent code? If much smaller, what isn't tested?
  3. Which job is your biggest row, and did you plan for it to be?
  4. How many lines make sure the same action never runs twice?
  5. If you swapped models tomorrow, how many files would change?

Measure your own agent before you believe anyone's slogan, ours included.