← Table of Contents · Page 441 of 868

WHY USE MORE THAN ONE AGENT

Part 2 of 9

SINGLE-AGENT VERSUS MULTI-AGENT SYSTEMS, DEFINED AND COMPARED A single-agent system is a design in which exactly one agent, running one main loop, handles a task from start to finish. You learned about this loop in Chapter 9: the model reads its context, decides what to do, uses a tool if needed, sees the result, and repeats until it is done. In a single-agent system, there is one context window (the limited amount of text the model can look at at one time, which you studied in Part Five), one set of instructions, and one set of tools. A multi-agent system is a design in which two or more agents, each with its own loop, its own instructions, and often its own tools and its own context, work together toward a shared goal. The word "together" is important. If you simply run two unrelated agents side by side that never exchange anything, that is not really a multi-agent system. The agents in a multi-agent system must coordinate, meaning they must hand work, information, or decisions to one another. Let us compare the two designs on several practical dimensions, one at a time. First, simplicity. A single agent has one loop to understand, one transcript to read, and one place to look when something goes wrong. A multi-agent system has many loops, many transcripts, and many handoffs between them, so there are more places for bugs to hide. Second, cost. Every agent call costs money, because model providers typically charge based on the amount of text going in and coming out, measured in small units called tokens. Recall from Chapter 2 that a token is a chunk of text, roughly a short word or a piece of a longer word. When several agents each read their own instructions and context, the total number of tokens usually goes up compared with one agent doing the same job. Third, speed. Multiple agents can sometimes work at the same time, which can finish a big job faster. But they can also spend time waiting on each other, which can slow things down. Fourth, quality on complex jobs. A single agent asked to do a very wide range of things may become confused or sloppy. A team of specialized agents can each do a narrow job well. Fifth, control and safety. With separate agents, you can give each one only the tools and permissions it needs, which follows the principle of least privilege that you learned in Chapter 37. For example, the agent that reads the web does not need permission to send email. The honest summary is this. A single-agent system is simpler, cheaper, and easier to debug. A multi-agent system can handle greater complexity and specialization, but it costs more and adds coordination problems. You choose multi-agent design deliberately, because a task genuinely benefits from it, and not because it sounds more advanced. SPECIALIZATION: SEPARATE RESEARCHER, WRITER, AND REVIEWER AGENTS Specialization means giving each agent a narrow, well-defined job and tuning everything about that agent for that job. "Everything" includes its system prompt (the standing instructions given to the model at the start of every run), its tools, its permissions, and sometimes even which model powers it. A very common and easy-to-understand specialization example is the research report team. The first member is a researcher agent. Its only job is to go find information, gather sources, and report what it found. The second member is a writer agent. Its only job is to take organized findings and turn them into clear, engaging prose. The third member is a reviewer agent, sometimes called a fact-checker or critic. Its only job is to compare the written draft against the original sources and flag anything unsupported or wrong. Why not just ask one agent to do all three jobs? The reason is that these jobs pull in opposite directions. Good research is cautious, skeptical, and thorough. It says things like "I found three conflicting sources, and I am not sure which is right." Good writing is confident, smooth, and decisive. It wants to tell a clean story. When you stuff both personalities into one system prompt, the model tends to blend them poorly. You may get research that is rushed because the model is already thinking about the final essay, or writing that is clumsy and hedged because the model keeps remembering caveats. Splitting the roles lets each system prompt be fully devoted to one mindset. The reviewer is especially valuable because of a subtle human and machine habit: it is hard to catch your own mistakes. A separate reviewer looks at the draft with fresh eyes and a different goal, namely finding problems, which makes it much better at catching errors than the writer who produced them. Specialization can also go beyond prompts. You might use a larger, more expensive model for the difficult reasoning of the researcher, and a smaller, cheaper model for simple formatting work. Splitting into specialists gives you this kind of fine-grained control.
Advertisement
Read Aloud:
0:00 / 0:00