LabHub

Blog

Building Effective AI Agents: A Reference on the Five Workflow Patterns and Agents

한국어English日本語中文

Introduction — Workflows, Agents, and the Augmented LLM

While the word "agent" inflates, Anthropic's engineering guide Building Effective Agents starts from a rare, calm set of definitions. This post reorganizes that guide into a reference you can pull up while building. One distinction sits at the center.

A single piece of advice runs through the whole document: build not the most sophisticated system but the right system for your needs. Start with simple prompts, optimize them with comprehensive evaluation, and add multi-step agentic systems only when simpler solutions fall short.

Beneath every pattern sits the augmented LLM — not a model that just emits text, but one equipped with three capabilities.

For tool integration the guide points to standards like the Model Context Protocol (MCP). This block is the atomic unit of everything below.

The Five Workflow Patterns

First thing to internalize: all five below are workflows. Even when several LLM calls appear, their order and wiring are fixed in code. Autonomous agents are a separate section.

PatternWhen to useConcrete example
Prompt chainingWhen the task decomposes cleanly into fixed subtasksGenerate marketing copy, then translate it; write an outline, gate-check it, then write the full doc
RoutingWhen input splits into distinct categories better handled separatelyDirecting query types to different flows; routing easy questions to a smaller, cheaper model
ParallelizationWhen subtasks parallelize for speed, or multiple perspectives/attempts are neededSectioning: split answering from content screening / Voting: review code for vulnerabilities multiple times
Orchestrator-workersWhen you cannot predict the subtasks in advanceComplex changes across many files; gathering and analyzing multiple sources
Evaluator-optimizerWhen evaluation criteria are clear and iterative refinement adds measurable valueNuanced feedback on literary translation; multi-round search

The table is for quick reference; here is one line each on how the patterns actually run.

Finally, the five are not mutually exclusive. Real systems usually compose them — routing followed by a prompt chain, or an orchestrator whose workers run in parallel. The patterns are Lego bricks, not a religion.

Autonomous Agents — the Loop, and When to Reach for It

Autonomous agents look elaborate but are usually simple to implement. In Anthropic's framing, an agent is essentially an LLM using tools in a loop based on environmental feedback. At each step it gains "ground truth" — tool results, code execution output — and judges its own progress from that.

Agent loop (concept)
  1. A human gives a goal (or narrows scope through discussion)
  2. The LLM plans, then calls a tool
  3. The environment returns a result   = ground truth
  4. The LLM inspects it and decides: done? or loop back to step 2
  5. Stopping conditions: completion check, step budget, human checkpoint

The crux here is ground truth. What separates an agent from a plain chatbot is that it corrects its own judgment at each step from real signals in the environment — did the tool succeed, did the code pass. Without that feedback loop, it is just a prompt called several times.

When to use an agent instead of a workflow. For a well-defined task where predictability and consistency matter, a workflow wins. An agent earns its keep only when you cannot predict the number of steps and cannot hardcode a fixed path. There is a price: the guide states plainly that agentic systems "trade latency and cost for better task performance." Reach for one only when that trade makes sense. A quick decision checklist:

The ACI is half the job. An agent's success depends heavily on tool design. Anthropic calls this the agent-computer interface (ACI) and stresses documenting and testing tools as carefully as you would document an API for a human. Ambiguous schemas and thin tool descriptions are the most common root cause of agent failures.

The appendix names two domains where agents fit well. Customer support follows a conversation flow while needing external information and actions (lookups, refunds), and success is clearly measurable through resolutions — some companies are confident enough to charge usage-based pricing only for successful resolutions.

Coding fits especially well because solutions are verifiable through automated tests; the agent iterates using test results as feedback, and Anthropic cites solving real GitHub issues in SWE-bench Verified from the pull request description alone. Even so, human review remains crucial to ensure a solution fits broader system requirements.

Failure Modes — Over-Engineering, Runaway Loops, Cost and Latency

A reference is only useful if it records where things break, not just where they work.

Frameworks — a Fast Start, a Debugging Tax

The guide addresses agent frameworks head-on. SDKs like the Claude Agent SDK and GUI builders like Rivet and Vellum lower the barrier to starting, but there is a cost — they add abstraction layers that obscure the underlying prompts and responses, making it harder to see what actually goes into and comes out of the model, and complicating debugging.

So the recommendation is plain: use the LLM API directly to understand the fundamentals first, then adopt a framework once you know exactly what its abstraction does for you. This is not a claim that frameworks are bad; it is that convenience layered on top of a base you do not understand tends to trip you up precisely when something breaks.

Closing — Simplicity, Transparency, ACI

The guide's three core principles for implementing agents make a clean summary.

The working lesson is plain. Most production problems are solved well enough by a single LLM call or one or two workflow patterns. The moment you genuinely need an autonomous agent is rarer than it sounds, and recognizing that rarity is itself good engineering. Success is not about building the most sophisticated system but about choosing the right one for the need — that single sentence is the whole point of this reference.

References

Comments

No comments yet.

Sign in to leave a comment