Skip to content
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

Swarm: Support AfterWorkOption in SwarmResult agent parameter #358

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

marklysze
Copy link
Collaborator

@marklysze marklysze commented Jan 6, 2025

Why are these changes needed?

In line with Issue #357, adding further control of the next agent through the return of the SwarmResult in a tool call, would allow you to terminate, return to the user agent, use auto speaker selection next, or stay with the current agent after a tool call.

So you can now return an AfterWorkOption in the agent parameter of a SwarmResult, e.g.:

def publish_results(context_variables:dict) -> SwarmResult:
  ### take something from context_variables and turn it into a final string ###
  return SwarmResult(agent=AfterWorkOption.TERMINATE, context_variables=context_variables, values=final_string)

All AfterWorkOption's are supported.

Related issue number

Closes #357

Checks

@marklysze marklysze added enhancement New feature or request swarm labels Jan 6, 2025
@marklysze marklysze self-assigned this Jan 6, 2025
@marklysze marklysze changed the title Swarm: Support AfterWorkOption in tool call's returned SwarmResult Swarm: Support AfterWorkOption in SwarmResult agent parameter Jan 6, 2025
Signed-off-by: Mark Sze <mark@sze.family>
Signed-off-by: Mark Sze <mark@sze.family>
Signed-off-by: Mark Sze <mark@sze.family>
Signed-off-by: Mark Sze <mark@sze.family>
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
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Swarm - further control for SwarmResult
3 participants