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

MultiAgentWorkflow #17237

Merged
merged 57 commits into from
Jan 17, 2025
Merged

MultiAgentWorkflow #17237

merged 57 commits into from
Jan 17, 2025

Conversation

logan-markewich
Copy link
Collaborator

@logan-markewich logan-markewich commented Dec 10, 2024

A multi agent system implemented as a prebuilt workflow.

Currently, supports

  • state injection into latest user messages
  • accessing workflow context/state through the FunctionToolWithContext
  • human in the loop using the new ctx.wait_for_event()
  • both react and function calling llms
  • maintaining context between runs
  • direct (and controllable) handoffs between agents

Usage Example:
https://gist.github.com/logan-markewich/f91929a4d0c7e41515bed1d2851c566c

Current Diagram:
Screenshot 2024-12-29 at 12 42 12 PM

Todo:

  • dogfooding
  • more tests
  • improve docs?

@logan-markewich logan-markewich changed the title [wip] adding workflow tool MultiAgentWorkflow Jan 2, 2025
@logan-markewich logan-markewich marked this pull request as ready for review January 2, 2025 16:28
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Jan 2, 2025
Comment on lines +62 to +64
async for event in handler.stream_events():
if hasattr(event, "delta"):
print(event.delta, end="", flush=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these agents streaming dedicated events that can be shown in the UI (we're using this in create-llama).

There we're having the AgentRunEvent see
https://github.com/run-llama/create-llama/blob/main/templates/components/multiagent/python/app/workflows/events.py
(ignore to_response - this is for conversion to vercel data streams, this concern can be done outside of this PR)

here is an example using it to send the progress of tool calls:
https://github.com/run-llama/create-llama/blob/eec237c5feea1af9cdd5b276d34ebe3b8d0fd185/templates/components/multiagent/python/app/workflows/tools.py#L141

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! That is the main intention for these events, to show progress in some UI.

I didn't capture the concept of "in progress" or "completed" with this, its mostly all just events at points in time (here's the agent input, here's the agent stream, here's the agent output, heres a tool im about to call, here's the tool output) -- I could refactor, but not sure if its needed or not

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@logan-markewich logan-markewich merged commit d77f15a into main Jan 17, 2025
8 of 11 checks passed
@logan-markewich logan-markewich deleted the logan/multi_agent branch January 17, 2025 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants