What an agent's shape is, and what it isn't
An agent’s shape is how the work is arranged: who asks the model, how many times, in what order, and who decides what happens next.
The definition
Six shapes appear in this volume. They all do the same job: fill in a shop’s nine-box sales-tax return from its sales and purchase lines. They run on the same lines, against the same checks, with the same model and the same instructions.
Only the arrangement differs. That alone can triple the cost, and decide whether the answer is right.
- The lines in and the boxes out never change.
- The arrangement in the middle changes completely.
- The model, the prompt and the tools are the same in all six.
| shape | often called | the arrangement |
|---|---|---|
| one agent with tools | a single agent | one agent, asked about each line in turn, with tools to read files and look up rates |
| fixed stages | a pipeline | read, sort, work out the tax, check: always in that order, with one question per batch of lines |
| sort first, then handle | a router | decide which kind each line is, and send each kind down its own route |
| plan, then carry out | a planner | ask for a plan, then carry it out |
| do, then check | a second opinion | do the work, then take a second look at it before handing it in |
| split and rejoin | a fan-out | split the lines into batches, handle each one separately, then put the results back together |
Four things a shape isn’t
| why it isn’t the shape | |
|---|---|
| the model | keep the model the same and the six shapes still cost different amounts. Every figure here uses one scripted model, so the arrangement is the only thing that changes |
| the prompt | the wording is the same in every shape. What differs is how many times it’s sent, and what’s in it each time |
| the tools | all six read the same files and look rates up in the same table. Reading a file is free; asking the model about it isn’t |
| the framework | a framework is one way of building a shape, usually one particular shape. Choosing a framework first is choosing the answer before the question |
Most writing on this subject names a shape and recommends it. Six articles can name six different shapes and all be right, each about some workload. That’s a fact about workloads, not about shapes.
Why the arrangement is the expensive decision
python3 lab.py quiet
Part 3 runs all six shapes on the same quarter, with the same model, and prices each one.