Multi-Agent Demo
Five agents, one task, streaming in real time — the full orchestration pipeline made visible
5 agent pipeline
Structured JSON planning
Parallel specialist agents
Real-time streaming all stages
01The Problem
The gap between AI demos (one model, one chat box) and production AI (multiple specialised agents coordinating on a shared goal) is large. I wanted to build a demo that makes the full pipeline visible — not as a diagram, but as a running system you can interact with.
02The Approach
Five sequential agent calls orchestrated in a single API route. The Planner returns JSON specifying three subtasks. Each specialist streams output back. The Synthesizer receives all three specialist outputs and produces the final result. Each step uses SSE to stream tokens to the frontend.
03Architecture Decisions
Structured Planner output via JSON enforcement
The Planner is prompted to return only valid JSON specifying three subtasks with roles and task descriptions. This structured output drives the rest of the pipeline — specialist system prompts are constructed from the Planner's JSON.
Role injection for specialisation
Each specialist receives a system prompt defining its role precisely. The Critic is instructed to 'challenge assumptions, find weaknesses, push back — no hedging.' Narrow role definition consistently outperforms a single-agent with a complex prompt.
Streaming SSE protocol with agent-tagged events
Each event is tagged with the sending agent: { agent: 'planner', type: 'token', text: '...' }. The frontend maintains per-agent state and routes incoming tokens to the correct panel.
04Key Insight
The architecture is the prompt. How you structure the pipeline — what each agent knows, what it produces, what context it receives — determines output quality more than any individual system prompt. The Planner is the highest-leverage point.
05Why It Matters
The most architecturally sophisticated demo in the portfolio. Directly demonstrates the orchestration patterns that enterprise AI teams build at scale — without requiring exotic infrastructure.