Add agent-supervisor example - #903
Open
shahryarkhalid-cmd wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fleshes out the
agent_supervisor.pytemplate inexamples/templates/into afull, runnable example (
examples/agent-supervisor/). Ports LangGraph's"agent supervisor" pattern to Burr: an LLM-driven supervisor that routes
between a
researcheragent (web search) and acoderagent (pythonexecution / charting), deciding the next step at each turn rather than using
fixed transitions.
Scope was discussed beforehand with @Stefan K on Discord, who suggested this
be built as a standalone example that implements the existing template,
rather than modifying
templates/directly.Changes
examples/agent-supervisor/folder, following the standard examplestructure:
application.py--supervisor_agent,researcher,coder,tool_node,and
terminalactions, wired up withApplicationBuilder. Uses the plainOpenAI SDK for LLM calls (matching
examples/email-assistant's style)rather than LangChain or Hamilton, to keep the example dependency-light.
README.md-- explains the example and how it relates to the templateand to
examples/multi-agent-collaboration.requirements.txt,notebook.ipynb,__init__.py,statemachine.png(generated via
app.visualize()).This differs from
examples/multi-agent-collaboration(which covers the sameresearcher/coder domain) in that routing between agents is decided by the
supervisor's own LLM call at each step, rather than fixed transitions --
demonstrating the supervisor pattern specifically, as the template intends.
How I tested this
transitions wired as expected.
app.visualize()produces the expected state diagram (included asstatemachine.png).endpoint (as a stand-in, since I didn't have an OpenAI key on hand) to
validate the supervisor's routing logic, the tool-calling loop, and
termination behavior all work correctly.
-- happy to do that and confirm, or if a reviewer can sanity-check with
their own key that'd also be appreciated.
Notes
prompt in
supervisor_agentif it should be tuned further.TAVILY_API_KEYis optional -- without it,web_searchreturns aplaceholder string so the example still runs.
Checklist