How hning86/adk_swarm works
This is a Google ADK customer-support swarm. A customer message enters through the dispatcher, which selects a starting specialist; specialists then hand off directly to peers, share findings and proposals through session state, and return a response after consensus or escalate when the handoff limit is reached. The app also exposes ADK web/API and A2A surfaces, plus feedback logging. The source excerpts show the serving setup and core swarm/tool mechanics; specialist routing and several workflow details are additionally documented in the README.
Main entry points: agent.py Technical specialist · swarm.py Swarm blackboard · fast_api_app.py FastAPI app · tools.py Billing tools
Components 19
Serving surfaces
- FastAPI app
app/fast_api_app.py - A2A routes
app/app_utils/a2a.py - Feedback logging
app/fast_api_app.py - Feedback schema
app/app_utils/typing.py
Swarm collaboration
- Triage dispatcher
app/agent.py - Swarm blackboard
app/swarm.py - Proposal consensus
app/swarm.py - Handoff escalation
app/swarm.py
Support domains
- Technical specialist
app/agent.py - Billing specialist
app/agent.py - Account specialist
app/agent.py - Technical diagnostics
app/tools.py - Billing tools
app/tools.py - Account policy tools
app/tools.py
Shared state
- Shared ADK services
app/app_utils/services.py - Session state
Other components
- Customer
- Web/API client
- A2A client
Connections 38
- Customer → Triage dispatcher: sends inquiry
README.md - Triage dispatcher → Technical specialist: routes to start
README.md - Triage dispatcher → Billing specialist: routes to start
README.md - Triage dispatcher → Account specialist: routes to start
README.md - Technical specialist → Billing specialist: hands off
README.md - Technical specialist → Account specialist: hands off
README.md - Billing specialist → Technical specialist: hands off
README.md - Billing specialist → Account specialist: hands off
README.md - Account specialist → Technical specialist: hands off
README.md - Account specialist → Billing specialist: hands off
README.md - Technical specialist → Technical diagnostics: invokes tools
app/agent.py - Billing specialist → Billing tools: invokes tools
app/agent.py - Account specialist → Account policy tools: invokes tools
app/agent.py - Technical specialist → Swarm blackboard: shares findings
README.md - Billing specialist → Swarm blackboard: shares findings
README.md - Account specialist → Swarm blackboard: shares findings
README.md - Technical diagnostics → Swarm blackboard: records findings
app/tools.py - Billing tools → Swarm blackboard: records findings
app/tools.py - Account policy tools → Swarm blackboard: records findings
app/tools.py - Technical specialist → Proposal consensus: proposes or reviews
app/agent.py - Billing specialist → Proposal consensus: proposes or reviews
app/agent.py - Account specialist → Proposal consensus: proposes or reviews
app/agent.py - Proposal consensus → Swarm blackboard: updates proposal
app/swarm.py - Billing tools → Proposal consensus: requires consensus
app/tools.py - Account policy tools → Proposal consensus: requires consensus
app/tools.py - Technical specialist → Handoff escalation: exceeds handoff cap
README.md - Billing specialist → Handoff escalation: exceeds handoff cap
README.md - Account specialist → Handoff escalation: exceeds handoff cap
README.md - Handoff escalation → Swarm blackboard: summarizes state
app/swarm.py - Web/API client → FastAPI app: calls API
app/fast_api_app.py - A2A client → A2A routes: sends JSON-RPC
app/app_utils/a2a.py - FastAPI app → A2A routes: registers routes
app/fast_api_app.py - FastAPI app → Triage dispatcher: loads agent
app/fast_api_app.py - FastAPI app → Shared ADK services: configures services
app/fast_api_app.py - A2A routes → Triage dispatcher: executes agent
app/app_utils/a2a.py - Shared ADK services → Session state: provides sessions
app/app_utils/services.py - Feedback schema → Feedback logging: validates payload
app/fast_api_app.py - Web/API client → Feedback logging: submits feedback
app/fast_api_app.py