-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Agent name termination #4123
base: main
Are you sure you want to change the base?
Agent name termination #4123
Conversation
@microsoft-github-policy-service agree |
python/packages/autogen-ext/src/autogen_ext/task/_agent_name_termination.py
Outdated
Show resolved
Hide resolved
python/packages/autogen-ext/src/autogen_ext/task/_agent_name_termination.py
Outdated
Show resolved
Hide resolved
python/packages/autogen-ext/src/autogen_ext/task/_agent_name_termination.py
Outdated
Show resolved
Hide resolved
- Rename class to `SourceMatchTermination`
python/packages/autogen-ext/src/autogen_ext/task/_source_match_termination.py
Outdated
Show resolved
Hide resolved
738d02f
to
f3470bc
Compare
from autogen_agentchat.messages import StopMessage, AgentMessage | ||
|
||
|
||
class SourceMatchTermination(TerminationCondition): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry. I initially misunderstood the trigger. Since the trigger is the last source mentioned. I am wondering, if we don't need to limit to the last message's source. Any message that matches the source can trigger termination. The scenario I have in mind is that a summary agent finishes responding then the group chat terminates.
What's the scenario you have in mind for the trigger?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the same senario. The only difference is allowing the user to start another conversation with the same chat history.
So, in my case, I need to check the last message, but not any message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The termination condition is applied after the messages have been processed by the agent. So, the chat history is preserved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, but if we have chat history from last conversation and then check any message that matches the source, conversation will alway terminate after 1 agent talking even if it's not the summary agent that we wanted. because the summary agent message existed in history
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The termination condition is invoked on the delta since the last time it was invoked rather than the whole history. So it won't see the same message twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, so the messages: Sequence[AgentMessage]
param in __call__
function is only come from the last agent and not entire group chat history right? in that case, yes, you was right, we can check any message match the source but i think it would make no difference since all message come from same agent? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since all message come from same agent? 🤔
When the agents are not nesting another team inside, then yes. But an agent can contain a team, which will produce messages from multiple agents -- when that get sent to the parent team the termination condition will see multiple agents' messages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you're right. Sorry, i missed the senario Nested chat. In that scenario, if we check any message to match the source, then this will allow terminate conversation when specific agents are involved in nested chat. Is that what you mean? I think that makes sense.
I can update this logic on the next commit if you want. Please let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Let's change the logic to terminate whenever an agent source is matched.
this will allow terminate conversation when specific agents are involved in nested chat. Is that what you mean?
yes. just to keep it simple, the termination condition in the parent team will be applied on the flattened messages from all agents.
Why are these changes needed?
Introduces the
AgentNameTermination
class, which is a termination condition for conversations based on last agent nameRelated issue number
Checks