A team wants weekly release notes. They build an agent: three tools, list_merged_prs, get_pr and post_to_slack, and the goal "Write and post this week's release notes." The demo works. In production, one run opens every pull request's full diff and costs many times more than the others. Another skips two PRs. A third posts a half-finished draft to the company channel. Each failure took a different path, so none is easy to reproduce. Yet the job never changed: list the PRs, summarize each one, group them, get approval, post.
The common misconception
"An autonomous agent loop is the most advanced design, so it's the best choice for any LLM feature." It's easy to see why:
Agents are where the attention is: launches, demos and conference talks.
Many frameworks start from an agent: give the model tools and a goal, and it figures out the rest.
An agent seems future-proof, since it can handle cases nobody planned for.
Models really have become better at using tools, so handing them control feels safe.
The half-truth: agents are the right design for some problems. But "most advanced" isn't "best fit". Every step the model chooses is a step you can't predict, test or price in advance.
What actually happens
Who decides the next step
Anthropic's guide to building agents draws the line clearly. A orchestrates models and tools through predefined code paths. An lets the model dynamically direct its own process and tool use. In practice, the guide says, agents are typically just models using tools based on feedback from the environment in a loop. As the tool-calling article showed, your code runs that loop either way. The difference is who picks the next step: your code, or the model.
Start at the bottom of the ladder
The guide's core advice is to find the simplest solution possible and add complexity only when needed, which might mean no agentic system at all. For many applications, a single model call with retrieval and in-context examples is enough. Agentic systems often trade latency and cost for better task performance. When more is warranted, workflows offer predictability and consistency for well-defined tasks. The guide's workflow patterns:
Prompt chaining: a fixed sequence of calls, each processing the previous output, with checks in code between steps.
Routing: classify the input, then send it to a specialized prompt, tool set or model.
Parallelization: run independent subtasks at once, or the same task several times and vote.
Orchestrator-workers: one model splits a task it can't predict into subtasks for worker calls.
Evaluator-optimizer: one call drafts, another critiques against clear criteria, in a loop.
What autonomy costs
The same guide names the price: higher costs and the potential for compounding errors, and it recommends extensive testing in sandboxed environments with guardrails. Research puts numbers on the consistency problem. τ-bench, from Yao and colleagues in 2024, tests customer-service agents that use tools and follow a policy while talking to a simulated user. A gpt-4o function-calling agent succeeded on about 61% of retail tasks and 35% of airline tasks. When the same retail task was run eight times, all eight succeeded only about 25% of the time, a metric they call pass^k. The task and the database stayed the same; only the sampled conversation changed.
ReAct, a 2022 paper that interleaves a model's reasoning with actions and observations, documented failure modes too. In its error analysis with PaLM-540B on HotpotQA questions, a frequent pattern was the model repeating its earlier thoughts and actions without getting out of the loop, and searches that returned nothing useful caused 23% of the errors by derailing the reasoning.
When an agent earns its keep
Agents fit open-ended problems where you can't predict the number of steps or hardcode a path, and where you can trust the model's decisions. ReAct shows the upside: on ALFWorld and WebShop, interactive environments where each action depends on the last observation, it beat imitation and reinforcement learning methods by 34 and 10 points of absolute success rate, prompted with only one or two examples. Anthropic points to coding agents, whose work can be checked by automated tests, and customer support, where success is clearly measured. The common thread: the path varies, the environment gives feedback at every step, and success is checkable.
Same feature, two designs
The first version hands the model a goal and three tools. The second is a prompt chain: code lists the PRs, the model summarizes each and writes the notes, code checks the result, and a person approves before anything is posted.
Python · release_notes.py
import anthropicclient = anthropic.Anthropic()tools = [LIST_MERGED_PRS, GET_PR, POST_TO_SLACK]messages = [{"role": "user", "content": "Write and post this week's notes."}]while True: # the model picks every step, their order and how many reply = client.messages.create( model="claude-opus-5-5", max_tokens=16000, tools=tools, messages=messages, ) messages.append({"role": "assistant", "content": reply.content}) if reply.stop_reason != "tool_use": break messages.append({"role": "user", "content": run_tools(reply.content)})
Python · release_notes.py
import anthropicclient = anthropic.Anthropic()def ask(instructions, text): reply = client.messages.create( model="claude-opus-5-5", max_tokens=16000, system=instructions, messages=[{"role": "user", "content": text}], ) return next(b.text for b in reply.content if b.type == "text")prs = list_merged_prs(since="last-release") # plain code, no modelsummaries = [ask(SUMMARIZE_PR, f"#{p.number}\n{p.body}") for p in prs]notes = ask(WRITE_NOTES, "\n".join(summaries))missing = [p.number for p in prs if f"#{p.number}" not in notes]if missing: # a gate in code, not the model's judgment raise ValueError(f"Release notes skip PRs {missing}")request_approval(notes) # a person approves before anything is posted
The workflow still uses the model for what it's good at, reading and writing. But the order, the number of calls and the side effect belong to code: one call per PR plus one, so cost is known before the run. Each step can be tested on its own, and a failed check stops the run before anyone sees a draft. Anthropic's tool docs make the same point at a smaller scale: every tool call is at least one extra round trip.
Workflow
Agent
Who picks the next step
Your code
The model
Steps per run
Known in advance
Vary with the input
Cost and latency
Predictable
Variable, often higher
Testing
Each step on its own
Whole runs, several trials each
Best for
Tasks you can write down as steps
Open-ended tasks whose path depends on what they find
How to apply it in your project
Write the task as stepsList what has to happen, in order. Mark the steps that need the model and the ones plain code can do.
Start with one callTry a single model call with good context, retrieval and examples. Measure it on your eval before adding anything.
Move to a workflow pattern when one call falls shortChain, route or parallelize, and put the checks between steps in code.
Make only the unpredictable part agenticGive the agent the narrowest set of tools, a cap on iterations and spend, and read-only access where possible.
Measure consistency, not one successRun each agent task several times and compare success rate, cost and latency with the workflow version before you ship.
Key takeaways
In a workflow, your code decides the next step; in an agent, the model does.
Start with one call, move to a workflow when needed, and use an agent only when the path can't be predicted.
Autonomy costs tokens, latency and consistency: in τ-bench, a gpt-4o agent passed all eight trials of a retail task only about 25% of the time.
Agents earn their keep on open-ended tasks with feedback and checkable results, such as coding with tests.
Whatever the design, keep checks and irreversible actions in code.
التعليقات (0)