Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

5 participants