This repository demonstrates two coordination patterns for LLM-based agents using LangGraph Supervisor and LangGraph Swarm architectures. Under src/, you’ll find three example workflows:
agent/A voice-enabled customer support bot implemented in the Swarm style by default (but easily switchable to Supervisor).doc-agent/An appointment scheduler built on the Supervisor architecture.bookings-template/A booking workflow sketch in the Swarm architecture.
A single supervisor node manages routing to specialized child agents. The workflow always returns control to the supervisor, which decides the next agent or termination step.
Each agent can hand off directly to any other agent in the group, without a central supervisor. The last active agent drives the next step.
A central supervisor orchestrates all hand-offs and returns control after each step.
| Use Case | Description |
|---|---|
| Hierarchical Q&A | A Supervisor routes between a General Q&A agent, a Resume-Parser agent, and a Web-Search agent (DEV Community). |
| Doctor Appointment Scheduler | Orchestrates information_agent (availability lookup) and booking_agent (set/cancel/reschedule) (Medium). |
| Automated Bug-Fixing Pipeline | Supervisor drives an Agent-Debugger, an LLM Code-Generator, and a Test-Runner agent in sequence (arXiv). |
| Real-Time Data Analysis & Sentiment | Spark-Streaming → Sentiment-Agent → Escalation-Agent with human-in-the-loop via Supervisor (arXiv). |
| Modular Machine Translation | Supervisor orchestrates English, French, Japanese translation agents for a unified MT service (arXiv). |
Swarm agents hand off directly, peer-to-peer, in a shared workspace.
| Use Case | Description |
|---|---|
| Multi-domain QA & Translation | General QA ↔ Science ↔ Translation agents collaborate dynamically without a central router (DEV Community). |
| Travel Booking (Flight ↔ Hotel) | Flight agent books a ticket then seamlessly hands off “book hotel” to a Hotel agent (Medium). |
| Emergency Travel Coordinator | Triage by EmergencyCoordinator → MedicalEvacuation / Security / Disaster-Response agents (Medium). |
| Ensemble Code Review | Coder agent writes code → Checker agent reviews and suggests fixes → Coder re-runs fixes (Artificial Intelligence in Plain English). |
| Customer Support (Flight & Hotel) | Flight & Hotel assistants share context in real-time for integrated travel support (Toolify). |
-
Install & configure
python3.11 -m venv venv source venv/bin/activate pip install -e .[inmem] langgraph-cliYou can use either the pyproject.toml or the requirements.txt for installing dependencies.
-
Configure your secrets Create a .env file at the project root and add your API keys:
OPENAI_API_KEY=sk-... AZURE_OPENAI_API_KEY=... LANGCHAIN_API_KEY=...
-
Main config Each workflow reads its routing, agents, and tool definitions from langgraph.json at the root—open it to tweak agent names, prompts, or turn on/off streaming.
Also be carefull to create the appropriate init.py file inside the respective agent directory like done in src/agent.
-
Launch LangGraph Dev Studio
uvx --refresh \ --from "langgraph-cli[inmem]" \ --with-editable . \ langgraph dev- In Dev Studio you can select any of the three workflows under
src/and test them interactively. - For voice-enabled testing, upload pre-recorded WAVs to the
transcribe_audiotool, inspect the JSON TTS output, and download/play it locally.
- In Dev Studio you can select any of the three workflows under
-
Directory:
src/agent/ -
Pattern: By default, demonstrates the Swarm handoff between:
disambiguation_agent(figures out intent)service_agent(executes or transfers)
-
Switching: Change
create_swarm(...)vscreate_supervisor(...)ingraph.pyto toggle architectures.
-
Directory:
src/doc-agent/ -
Pattern: A Supervisor routes between:
information_agent(checks availability)booking_agent(sets, cancels, reschedules appointments)
- Directory:
src/bookings-template/ - Pattern: A minimal Swarm example showing tool-calling between flight, hotel, and car-rental agents.
The Customer Agent in src/agent/graph.py can run locally as a full voice chatbot:
-
Dependencies (optional)
pip install -e ".[voice]" # or pip install sounddevice scipy simpleaudio pydub ffmpeg-python imageio-ffmpeg brew install ffmpeg
These are only required if you want to run the local voice loop.
langgraph devworks without them. -
Run
python src/agent/graph.py
- The script records from your microphone,
- uses Whisper for STT,
- invokes the multi-agent workflow,
- synthesizes the reply with TTS,
- plays it back—all in a loop until you say “bye.”
-
Dev Studio Voice Testing
- Pre-record a series of WAV files (e.g.
turn1.wav,turn2.wav, …). - In Dev Studio, use the File uploader on the
transcribe_audiotool. - Examine the JSON with
"tts_base64"and decode/play locally.
- Pre-record a series of WAV files (e.g.
MIT © Paresh Raut


