You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The max_consecutive_auto_reply parameter on an agent is not terminating the chat when it's on the agent that is the recipient in initiate_chat.
In this example it should terminate when my_agent goes to reply for a second time, but doesn't:
from autogen import ConversableAgent
llm_config = {"model": "gpt-4o-mini"}
# Doesn't terminate on auto reply
my_agent = ConversableAgent(
name="helpful_agent",
llm_config=llm_config,
system_message="You are a poetic AI assistant, respond in rhyme.",
human_input_mode="NEVER",
max_consecutive_auto_reply=1
)
other_agent = ConversableAgent(
name="other_agent",
llm_config=llm_config,
system_message="You are a scientific AI, respond with science facts.",
human_input_mode="NEVER",
)
other_agent.initiate_chat(my_agent, message="What's the big deal about AI?", max_turns=10)
Whereas, if we change the agents around in initiate_chat, it does:
from autogen import ConversableAgent
llm_config = {"model": "gpt-4o-mini"}
# Does terminate on auto reply
my_agent = ConversableAgent(
name="helpful_agent",
llm_config=llm_config,
system_message="You are a poetic AI assistant, respond in rhyme.",
human_input_mode="NEVER",
max_consecutive_auto_reply=1
)
other_agent = ConversableAgent(
name="other_agent",
llm_config=llm_config,
system_message="You are a scientific AI, respond with science facts.",
human_input_mode="NEVER",
)
my_agent.initiate_chat(other_agent, message="What's the big deal about AI?", max_turns=10)
Steps to reproduce
See code above.
Model Used
Not model specific, used gpt-4o-mini
Expected Behavior
Terminated before replying a second time.
Screenshots and logs
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered:
This is likely a broader issue, I encountered the same bug if I register a reply function with an agent that should terminate upon reply, but it doesn't if the agent with the reply function is the recipient in initiate_chat.
This should terminate when it's agent_b's turn to reply, but it doesn't.
from typing import Any, Dict, List, Optional, Tuple, Union
from autogen import ConversableAgent, Agent
llm_config = {"model": "gpt-4o-mini"}
a_agent = ConversableAgent(
name="agent_a",
llm_config=llm_config,
system_message="You are a poetic AI assistant, respond in rhyme.",
human_input_mode="TERMINATE",
)
b_agent = ConversableAgent(
name="agent_b",
llm_config=llm_config,
system_message="You are a scientific AI, respond with science facts.",
human_input_mode="NEVER",
)
def my_reply_func(
recipient: ConversableAgent,
messages: Optional[List[Dict]] = None,
sender: Optional[Agent] = None,
config: Optional[Any] = None,
) -> Tuple[bool, Union[str, Dict, None]]:
return True, None
b_agent.register_reply(
trigger="agent_a",
reply_func=my_reply_func,
position=0
)
# b_agent being recipient doesn't work here, switch a_agent and b_agent around here and it works.
a_agent.initiate_chat(recipient=b_agent, message="What's the big deal about AI?", max_turns=10)
Describe the bug
The
max_consecutive_auto_reply
parameter on an agent is not terminating the chat when it's on the agent that is the recipient ininitiate_chat
.In this example it should terminate when
my_agent
goes to reply for a second time, but doesn't:Whereas, if we change the agents around in
initiate_chat
, it does:Steps to reproduce
See code above.
Model Used
Not model specific, used gpt-4o-mini
Expected Behavior
Terminated before replying a second time.
Screenshots and logs
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: