I get an error saying “Multiple handoffs requested”, when I ask two questions at the same time to triage_agent, such as:
“Search the weather in Tokyo, and give me the first 8 Fibonacci numbers,”
Of course, I can manually ask the two questions separately, but I want to automate this process. How can I achieve that?
Also, how can I determine that the task is complete once both questions have been answered?
My code
def fibonacci(n: int) -> List[int]:
fib_sequence = [0, 1]
while len(fib_sequence) < n:
fib_sequence.append(fib_sequence[-1] + fib_sequence[-2])
return fib_sequence
cal_agent = Agent(
name="calculate assistant",
instructions="You are a support agent who can compute fibonacci sequence",
tools=[fibonacci],
)
web_agent = Agent(
name="Web Assistant",
instructions="You are an assistant who can access the web and operate on it",
tools=[WebSearchTool()],
)
triage_agent = Agent(
name="Triage Agent",
instructions="Route the user to the correct agents.",
handoffs=[cal_agent, web_agent],
)