Skip to content

Add agent-supervisor example - #903

Open
shahryarkhalid-cmd wants to merge 1 commit into
apache:mainfrom
shahryarkhalid-cmd:agent-supervisor-example
Open

Add agent-supervisor example#903
shahryarkhalid-cmd wants to merge 1 commit into
apache:mainfrom
shahryarkhalid-cmd:agent-supervisor-example

Conversation

@shahryarkhalid-cmd

Copy link
Copy Markdown

Fleshes out the agent_supervisor.py template in examples/templates/ into a
full, runnable example (examples/agent-supervisor/). Ports LangGraph's
"agent supervisor" pattern to Burr: an LLM-driven supervisor that routes
between a researcher agent (web search) and a coder agent (python
execution / 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

  • New examples/agent-supervisor/ folder, following the standard example
    structure:
    • application.py -- supervisor_agent, researcher, coder, tool_node,
      and terminal actions, wired up with ApplicationBuilder. Uses the plain
      OpenAI 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 template
      and 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 same
researcher/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

  • Verified the Burr application graph builds correctly, with all actions and
    transitions wired as expected.
  • Verified app.visualize() produces the expected state diagram (included as
    statemachine.png).
  • Ran the full application end-to-end against Groq's OpenAI-compatible
    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.
  • Have not yet run it against the actual OpenAI API the shipped code targets
    -- happy to do that and confirm, or if a reviewer can sanity-check with
    their own key that'd also be appreciated.
Screenshot 2026-08-29 191150

Notes

  • Open to feedback on the researcher/coder domain choice, or on the routing
    prompt in supervisor_agent if it should be tuned further.
  • TAVILY_API_KEY is optional -- without it, web_search returns a
    placeholder string so the example still runs.

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (new example only, no unrelated changes)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

@github-actions github-actions Bot added the area/examples Relates to /examples label Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/examples Relates to /examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant