The AssistantAgent determines when it needs to use tools. After all necessary tools are used during the tool execution while loop the agent makes one model_client call to generate a response based on the tool results.
The issue is that this model client call doesn't include the system message.
Example
Consider this setup:
math_agent = AssistantAgent(...) # Responsible for computations
web_search_agent = AssistantAgent(
"WebSearchAgent",
tools=[search_tool],
system_message="You are a web search agent. Do not make any calculations on your findings.",
)
# Note the system message to not make any calculations
team.run_stream(task="Get me the percentage change of XYZ stock price from 2023 to 2024")
Here’s what happens step by step:
The WebSearchAgent is assigned the task of finding the stock prices for 2023 and 2024.
The WebSearchAgent recognizes that tools are needed and enters the tool execution while loop.
The WebSearchAgent finds the prices using the tool execution while loop.
Since the system message is not included, the WebSearchAgent attempts to compute the percentage change on its own, which it shouldn't.
What happened?
The AssistantAgent determines when it needs to use tools. After all necessary tools are used during the tool execution while loop the agent makes one model_client call to generate a response based on the tool results. The issue is that this model client call doesn't include the system message.
Example
Consider this setup:
Here’s what happens step by step:
WebSearchAgent
is assigned the task of finding the stock prices for 2023 and 2024.WebSearchAgent
recognizes that tools are needed and enters the tool execution while loop.WebSearchAgent
finds the prices using the tool execution while loop.WebSearchAgent
attempts to compute the percentage change on its own, which it shouldn't.Fix
Before: https://github.com/microsoft/autogen/blob/eb67e4ac93ea85621e6a604c95d38d47104a73b8/python/packages/autogen-agentchat/src/autogen_agentchat/agents/_assistant_agent.py#L282-L284
After:
What did you expect to happen?
It should include the system message
AutoGen version
0.4
Which package was this bug in
AgentChat
Model used
No response
Python version
No response
Operating system
No response
Any additional info you think would be helpful for fixing this bug
No response