Skip to content

[Feature Request]: Swarm OnCondition available support a not condition for context variable values #1220

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

Closed
marklysze opened this issue Mar 4, 2025 · 0 comments · Fixed by #1221
Assignees
Labels
enhancement New feature or request swarm

Comments

@marklysze
Copy link
Collaborator

marklysze commented Mar 4, 2025

Is your feature request related to a problem? Please describe.

At the moment the OnCondition's available parameter can take a string to represent a context variable key and it will evaluate that key's value as True to determine if the OnCondition is available for checking.

However, sometimes we want an OnCondition to be available if the context variable value equates to False. For example we may have a context variable key called "is_logged_in" but we want to transfer to an agent if they are not logged in.

I'm proposing a simple solution that allows us to put an exclamation at the start of the string value that represents NOT, e.g. OnCondition(target=authentication_agent, condition="Authenticate the user", available="!is_logged_in")

@marklysze marklysze added enhancement New feature or request swarm labels Mar 4, 2025
@marklysze marklysze added this to ag2 Mar 4, 2025
@marklysze marklysze self-assigned this Mar 4, 2025
@github-project-automation github-project-automation bot moved this to Done in ag2 Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request swarm
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant