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

Merged
merged 19 commits into from
Jan 20, 2025

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 <[email protected]>
Signed-off-by: Mark Sze <[email protected]>
@marklysze marklysze enabled auto-merge January 20, 2025 20:25
@marklysze marklysze added this pull request to the merge queue Jan 20, 2025
Merged via the queue into main with commit 212d04d Jan 20, 2025
225 of 231 checks passed
@marklysze marklysze deleted the swarmresultafterworkoption branch January 20, 2025 20:37
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
4 participants