shahryarkhalid-cmd opened a new pull request, #903:
URL: https://github.com/apache/burr/pull/903
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.
<img width="1919" height="993" alt="Screenshot 2026-08-29 191150"
src="https://github.com/user-attachments/assets/b070b4f1-ef19-43f1-825c-ff51e519431c"
/>
## 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
- [x] PR has an informative and human-readable title
- [x] 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.
- [x] Any _change_ in functionality is tested
- [x] New functions are documented (with a description, list of inputs, and
expected output)
- [x] Placeholder code is flagged / future TODOs are captured in comments
- [x] Project documentation has been updated if adding/changing
functionality.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]