Learn & Build Agents

    ↑ ↓ to choose · Enter to open · Esc to close

    03 Agentic architecturesLesson 1 of 314 minIntermediateHelps to have seen:Workflow or agent

    Patterns and multiple agents

    Who decides the pathnobody: it is all together
    LLM calls1
    Who sees the whole conversationthe single call
    • + message
    • + a single prompt
    Messagefrom the customerAgenta single promptdoes everythinganythinganswer
    LLMcodedataperson

    Step 1 of 10: A single prompt for everything

    You will learn
    • Chaining and routing: the fixed path in code
    • Orchestrator and workers: one call splits the task
    • Guard and reviewer: whoever watches is not whoever answers
    • Multiple agents: the lead delegates and pays for it
    • The three meanings of "orchestrator"
    In the lab

    Right routes on the store's 50 conversations, and a single agent against a lead with subagents on the 20 mixed ones

    Coming soon: I will measure this on the example agent and publish the number with the report.

    The whole lesson as textEvery step, to read at once, search or print.
    1. A single prompt for everything

      The store's first agent has a giant prompt: it answers questions, does refunds, opens exchanges and tries to resist attacks, all in the same call.

      When it gets something wrong, you cannot tell which part failed. And every simple question pays the price of the whole prompt. The question of this lesson: who should decide the path of each message?

      Before thinking about multiple agents, organize the calls.

    2. Chaining: the code calls in order

      The simplest pattern is : breaking the task into fixed steps, each call reading the output of the previous one. Your code decides the order, always the same.

      At the store: the first call only extracts the order number and the reason. The second, with that data, handles the refund. Between the two, the code checks that the order exists.

      Smaller steps are easier to get right and to test.

    3. Routing: a call picks the path

      In , an LLM call only classifies the message: question, refund or support rep. The code sends it to the chosen path, which is what answers.

      Each path has its own prompt and tools. The question can go to a smaller, cheaper model, and it does not even see criar_reembolso. The paths are fixed: the model only picks among them.

      The model picks among paths you designed.

    4. The message with two requests

      "I want to exchange the T-shirt from 4802 for an M and find out where 4805 is." The router picks just one route: question.

      The exchange vanishes without any error on screen. The customer only finds out days later. In the store's test set, 20 of the 50 conversations have two requests in one message.

      A wrong router is a silent error.

    5. Orchestrator and workers: one call splits

      In the pattern, an LLM call reads the message and decides how many parts it splits into. The code fires one worker for each part.

      A worker is an LLM call, sometimes with tools, that sees only its part and returns the result. At the end, a call combines everything into one answer. The difference from the router: the parts are not fixed.

      The orchestrator decides the parts. The workers do each one.

    6. Guard and reviewer: whoever watches is not whoever answers

      In , independent calls run at the same time. At the store, while the router classifies, a guard reads the same message looking only for fake instructions. If it blocks, the answer does not go out.

      In the evaluator pattern, one call writes and another checks against clear criteria. It only pays off when the criterion is clear and the correction actually improves things.

      Whoever answers does not need to be whoever watches.

    7. Multiple agents: the lead delegates

      One step further: the center stops being a call and becomes a lead agent, in a loop. It creates , and each subagent is a full agent, with its own loop, tools and context.

      The difference from workers: the subagent decides on its own how many steps to take, and the lead can look at what came back and create more. At the store: one subagent for 4838, another for 4850, in parallel.

      A worker does a part. A subagent solves a part its own way.

    8. Two decisions that do not talk to each other

      Subagent A cancels 4838: 7 days late, past the tolerance. B sees 4850 at 5 days, is unsure and answers "a support rep will handle it". The lead combines them: the customer does not know whether 4850 was canceled.

      And it was expensive: in Anthropic's research system, multiple agents spent about 15 times the tokens of a chat. For support, short and full of dependencies, a single agent is usually better.

      Each subagent decides without seeing the other's decision.

    9. Three things called "orchestrator"

      The word shows up in three places, and they are not the same thing. The question that separates the three is the same as at the start of the lesson: who decides the path, and how many times.

      In code, nobody decides: the order is fixed. In the LLM call, the model decides once. In the lead agent, the model decides on every turn.

      The more the model decides, the more flexible, more expensive and harder to test.

    10. Which pattern, when

      Start with the simplest thing that works: chain if the steps are always the same, route if there are clearly distinct kinds of requests. Orchestrator and workers only when the parts change with each message. Multiple agents only when the parts are truly independent and the task pays the cost.

      For the store's support, the choice starts with the router and a single agent, measured on the 50 conversations.

      A pattern is a tool, not a goal.

    Questions in this lesson

    What is a worker in the orchestrator and workers pattern?
    An LLM call that gets only one part of the task. The worker does its part and returns it. The orchestrator is what decides the parts.
    What is the difference between the orchestrator and the lead agent?
    The orchestrator splits once; the lead decides on every turn and can create more subagents. One decides the parts once. The other is an agent in a loop that delegates.
    For the store's support, which start makes the most sense?
    A router and a single agent, measured before splitting. The tasks are short and depend on each other. Split only if the test shows a gain.