IamBishal

Four Shapes, One Ticket: Agent Architecture Patterns, Measured

My architecture article rated four agent designs by judgement. So I built all four on the same tickets and measured them.

One support task built four ways: single loop, graph workflow, planner-executor and multi-agent. 768 runs on Claude Haiku and Sonnet. The shape decided cost and what got left undone, not correctness.

correct for loop, planner and multi-agent
100%
cheaper per correct ticket: graph vs loop
3.4×
two-intent tickets the graph got right
0 / 48
of planner refunds left without a reply
80%
  • Experiment
  • 6 min read
  • AI Agents
  • Evals & AgentOps
  • Python
  • MCP
  • Claude
  • Agent architecture
Figure 1. Tickets resolved correctly, by ticket type

Overview

In "AI Agent Architecture Patterns" I compared four ways to build the same support assistant: a single tool-calling loop, a graph workflow, a planner-executor and a multi-agent supervisor. The comparison table ended with a caveat: the ratings were my judgement, not measurements. This experiment measures them.

All four designs run on the same MCP tool server, the same written policy, the same models and the same sixteen tickets over real orders in the Kestrel mock dataset from my Agentic AI book series. Only one thing changes: who owns the next step. In the loop the model decides everything. In the graph, code decides every transition and the model only classifies the ticket and drafts the reply. The planner writes a plan that code validates and runs step by step. In the multi-agent design a read-only triage agent hands structured, code-checked fields to a billing agent (the only one that can move money) and a technical agent.

The tickets include eight ordinary refund requests, four that also report a website bug, two delivery questions and two returns without an order id. Half the runs inject a fault: the first return-eligibility check fails with a retryable error. Every call, reads included, goes into an ordered ledger. Grading is code only: whether the right outcome happened, whether money moved before the policy check, whether a second intent was dropped, and whether the same actions came out on every repeat. Claude Haiku 5.5 and Claude Sonnet 5.5 ran 768 episodes for USD 4.88.

The loop, the planner and the multi-agent design resolved every one of their 576 tickets, faults included, and no design ever refunded before checking the window. The graph was the cheapest by far, about 3.4 times cheaper per correct ticket than the loop at half the latency, and it took identical actions on every repeat. It also dropped the bug report on every two-intent ticket. Its one-intent classifier sent all 48 down the refund path, and the fallback to a human never fired.

Two of my predictions were wrong. The planner never proposed an invalid plan in 276 attempts, so its validator never fired. And the most expensive design wasn't multi-agent but the planner, at 2.3 times the loop on Sonnet. The planner also followed the policy so literally that in 80 percent of refunds the customer never heard back, because the policy never said to reply.

Did it hold up?

Full results

The hypothesis, written down before the first run, and what the results said.

  1. Partly

    The graph workflow is the most predictable: the most consistent actions across repeats and the fewest policy-order violations.

    Identical actions on 100% of repeats, against 95 to 99% for the others; but no design ever moved money before the check, so violations couldn't separate them.

  2. Confirmed

    The graph workflow is the weakest on unexpected input: it misses a ticket's second intent more often than the single loop.

    0% on two-intent tickets against 100% for the loop. All 48 went down the refund path silently; the human fallback never fired.

  3. Wrong

    The planner proposes invalid plans at a measurable rate, and validation plus replanning recovers most of them.

    Not one of 276 plans failed validation. Replanning did recover all 48 faulted runs, but from tool errors, not bad plans.

  4. Wrong

    Multi-agent costs the most and brings handoff failures: lost context, duplicate replies.

    The planner cost the most (2.3x the loop on Sonnet); multi-agent was +17%, with clean handoffs and one duplicate reply in 192 tickets.

  5. Confirmed

    On ordinary refund tickets all four designs reach the policy outcome within 5 points of each other.

    All four resolved 100% of the refund-policy tickets on both models.

What it does

  • Four agent designs on one MCP tool server: single loop, graph workflow, planner-executor, multi-agent supervisor
  • Sixteen tickets with computed ground truth: refund policy, two intents, delivery questions, missing order ids
  • A faults condition: the first eligibility check fails with a retryable error
  • An ordered ledger of every call, so grading checks the order of steps, not only the outcome
  • Code-only grading: outcome, money before the check, dropped intents, duplicate replies, predictability
  • Plan validation and structured, code-checked handoffs, as the article recommends
  • An offline dry run with oracle and sloppy fakes that proves the grader before any money is spent

How it's built

  1. Inputs

    • 16 support ticketsGround truth from the data
    • Faults conditionA retryable 503 on the first check
  2. Four designs, one harness

    • Single loopthe model decides
    • Graphcode decides, LLM in nodes
    • Planner-executorvalidated plan
    • Multi-agentchecked handoffs
    • Haiku 5.5 and Sonnet 5.5, 3 repeats
  3. Outputs

    • Ordered ledgerEvery call, reads included
    • Code-only graderOutcome, order, intents
    • Scorecard and chartsCost, latency, predictability
architectures/loop.py vs architectures/graph.py
# Single loop: the model owns the next step. The policy is text it reads.
SYSTEM = f"""You are a customer-support agent for Kestrel Outfitters.

{POLICY}

Work the ticket with the tools, then finish with a one-line summary of what you did."""

async def run(ctx: Context) -> None:
    await ctx.tool_loop("loop", SYSTEM, ctx.s.prompt)


# Graph workflow: code owns the next step. The policy is an if-statement.
async def refund_node(ctx: Context, order_id: str, ticket: str) -> None:
    for _ in range(3):  # code retries a temporary failure
        check, err = await ctx.call("check_return_eligibility", {"order_id": order_id, "as_of": ctx.s.today})
        if not (err and "temporarily unavailable" in check):
            break
    total = float(re.search(r"total (\d+(?:\.\d+)?) ", check).group(1))
    if "Return window: OPEN" in check and total <= REFUND_LIMIT_USD:
        done, _ = await ctx.call("issue_refund", {"order_id": order_id, "amount_usd": total, "reason": "Return inside the window"})
    elif "Return window: OPEN" in check:
        done, _ = await ctx.call("escalate_to_finance", {"order_id": order_id, "reason": "Above USD 500"})
    else:
        done = "The return was declined."
    await _reply(ctx, ticket, f"{check}\n{done}")  # the only other LLM call: drafting the reply

Figures

Figure 1. Tickets resolved correctly, by ticket type1 of 4

What I learned

  • On a task with a clear written policy, all four shapes can be correct. The choice is about cost, latency, predictability and what each one leaves undone.
  • A graph is cheap and repeatable because code does the deciding: two LLM calls a ticket, about 3.4 times cheaper per correct answer than a loop.
  • A graph fails quietly outside its paths. Every two-intent ticket went down the refund path; the human fallback never fired, and nothing flagged the dropped bug.
  • A planner follows its spec to the letter. When the policy didn't ask for a reply, most plans left the customer in silence.
  • Validation you never need still earns its place: 276 plans, none invalid, and the validator is still the only thing that would stop a bad one.
  • Multi-agent was cheaper than I expected and its structured handoffs were clean. The cost I predicted for it showed up in the planner instead.
  • Write what "done" means into the policy, not just the rules. Every gap in this run was something the spec never asked for.

Next steps

  • Give the graph a multi-label classifier and an engineering branch, then re-run the two-intent tickets
  • Add "always tell the customer" to the policy and see whether the planner's and agents' silence disappears
  • Harder faults: repeated failures, and a tool that times out after it has acted
  • A larger tool set, where the single loop should start paying for every extra move

Run it yourself

Everything on this page comes from code and data in the repository. The dry run is free and needs no API key. A full live rerun costs about USD 5.

Terminal
git clone https://github.com/bishal-saha/ai-lab-code.git
cd ai-lab-code/agent-architecture-patterns-benchmark
uv sync
uv run four-shapes --dry-run         # 256 scripted episodes on every design, $0
mv results results-published         # the live runner resumes from committed results
cp .env.example .env                 # then add your ANTHROPIC_API_KEY
uv run --env-file .env four-shapes --repeats 3 --max-usd 15
uv run python -m four_shapes.report

Bishal SahaLet's build together

Have a system to design, or an AI feature to get right?

Tell me about the problem. You'll get a clear, honest view of the best way forward.

  • Reply within 24 hoursOn business days, with my honest view and a next step.
  • Accepting select engagementsArchitecture, AI features and full builds.
  • Remote, worldwideWorking with startups, SMEs and enterprises.