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

[Feature Request]: ReliableFunctionSwarmAgent #876

Open
alecsolder opened this issue Feb 7, 2025 · 0 comments
Open

[Feature Request]: ReliableFunctionSwarmAgent #876

alecsolder opened this issue Feb 7, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@alecsolder
Copy link
Collaborator

alecsolder commented Feb 7, 2025

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

The name here is quite confusing, but I couldn't think of anything better.

Demo implementation here: https://github.com/ag2ai/ag2/blob/04e296fd90f5eddfbda3ecb913e2e5bcbb491b1d/autogen/agentchat/contrib/deep_research/reliable_function_swarm.py

The goal is to have a SwarmAgent which is responsible for being a self contained unit which invokes a function to provide information to answer a question. This is done by this agent creating its own swarm to have an LLM invoke a function, if the LLM does not invoke the function it is told to invoke the function and the bad message is removed from history. The results of this invocation are validated against provided criteria until it is satisfied.

Notes:

  • The way the code is written now every function invocation gets directly passed to the validator. Only a single function invocation is passed to the validator. This is specifically so that you can see the exact parameters needed to invoke the function in a way that gives you the result you want. If you let the result validator see the entire message history, it will use many invocations, success or failure, to generate an opinion. This could be a future feature.
  • Be invoked with a .run("question") method of some sort, and have the result of that .run method be the direct output from the function call. In my opinion this should require that a function return Tuple[Any, str], the Any is returned directly, and the str is what gets passed to the validator for validation.
  • The function gets additional parameters added to it in the wrapper, which can help with explaining what the agent is doing, or other information. But the pattern of adding parameters to the function that gets registered is pretty cool
  • I think this code is removed from the PR above, but if the function returns a SwarmAgent, the destination should be captured in the sub_swarm (not mess it up) and change where the main swarm goes afterwards. (I can find how I did this before if it would help)
  • There may be some stuff in there about "memories" that should be removed for this specific feature, not fully cleaned up yet
  • The .run method should also be able to be wired up to generate_reply, so if the agent is used in a bigger swarm if it gets sent a question it will respond with the result of the function invocation.
  • context_variables should be passed through to the inner swarm (not working right now)
  • results should be saved to context_variables maybe?
  • async needs to be fixed

Describe the solution you'd like

No response

Additional context

No response

@alecsolder alecsolder added the enhancement New feature or request label Feb 7, 2025
@davorrunje davorrunje added this to ag2 Feb 10, 2025
@davorrunje davorrunje moved this to In Progress in ag2 Feb 10, 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
Projects
Status: In Progress
Development

No branches or pull requests

1 participant