0% found this document useful (0 votes)
26 views2 pages

Building 8

Uploaded by

ja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views2 pages

Building 8

Uploaded by

ja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

For example, in the Agents SDK, agents are started using the Runner.

run() method, which loops

over the LLM until either:

01 A final-output tool is invoked, defined by a specific output type

02 The model returns a response without any tool calls (e.g., a direct user message)

Example usage:

Python

1 [Link](agent, [UserMessage("What's the capital of the USA?")])

This concept of a while loop is central to the functioning of an agent. In multi-agent systems, as

you’ll see next, you can have a sequence of tool calls and handoffs between agents but allow the

model to run multiple steps until an exit condition is met.

An effective strategy for managing complexity without switching to a multi-agent framework is to

use prompt templates. Rather than maintaining numerous individual prompts for distinct use

cases, use a single flexible base prompt that accepts policy variables. This template approach

adapts easily to various contexts, significantly simplifying maintenance and evaluation. As new use

cases arise, you can update variables rather than rewriting entire workflows.

Unset

1 """ You are a call center agent. You are interacting with
{{user_first_name}} who has been a member for {{user_tenure}}. The user's
most common complains are about {{user_complaint_categories}}. Greet the
user, thank them for being a loyal customer, and answer any questions the
user may have!

15 A practical guide to building agents


When to consider creating multiple agents

Our general recommendation is to maximize a single agent’s capabilities first. More agents can
provide intuitive separation of concepts, but can introduce additional complexity and overhead, 

so often a single agent with tools is sufficient.  

For many complex workflows, splitting up prompts and tools across multiple agents allows for
improved performance and scalability. When your agents fail to follow complicated instructions 

or consistently select incorrect tools, you may need to further divide your system and introduce
more distinct agents.

Practical guidelines for splitting agents include:

Complex logic When prompts contain many conditional statements 



(multiple if-then-else branches), and prompt templates get
difficult to scale, consider dividing each logical segment across
separate agents.

Tool overload The issue isn’t solely the number of tools, but their similarity 

or overlap. Some implementations successfully manage 

more than 15 well-defined, distinct tools while others struggle
with fewer than 10 overlapping tools. Use multiple agents 

if improving tool clarity by providing descriptive names, 

clear parameters, and detailed descriptions doesn’t 

improve performance.

16 A practical guide to building agents

You might also like