Stop the joke agent (Ctrl+C in its terminal). We’ll start both it and four more using a helper script:Documentation Index
Fetch the complete documentation index at: https://docs.getbindu.com/llms.txt
Use this file to discover all available pages before exploring further.
| Agent | Port | Does |
|---|---|---|
joke_agent | 3773 | Tells jokes |
math_agent | 3775 | Solves math problems step-by-step |
poet_agent | 3776 | Writes short poems |
research_agent | 3777 | Web search + summarize a factual question |
faq_agent | 3778 | Answers from a canned FAQ |
joke_agent.py - and you’ll see a small configuration that wires a language model (openai/gpt-4o-mini, dispatched through OpenRouter) to a few lines of instructions (“tell jokes, refuse other requests”). Narrow scope on purpose so mistakes are visible.
Gateway is already running from the previous chapter; don’t restart it.
A three-agent question
Paste this into your curl terminal. It asks something that genuinely needs three agents to answer:task.started events, in order - research first, then math, then poet. Abbreviated output from a real run:
How it chose
The planner saw three tools available (one per agent-skill combination):| Tool name | Description |
|---|---|
call_research_web_research | Web search and summarize a factual question |
call_math_solve | Solve math problems step-by-step |
call_poet_write_poem | Write a short poem |
Where do those tool names come from? The gateway builds them automatically from the
name and skills[].id fields in your request: call_<agent-name>_<skill-id>.call_research_web_research. It waited for the reply, re-read the question with the new context, decided the next step was math, picked call_math_solve, and so on.
All of this happens inside one HTTP request. The SSE stream is the gateway narrating what the planner decided.
What if you added a fourth agent it doesn’t need?
Try it. Add the joke agent to the catalog above and re-run:task.started events for research, math, poet. The joke tool sat there unused.
The planner only calls what it needs. This matters in production: you can hand the gateway a catalog of 50 agents, and only the 2 or 3 relevant to a given question will actually be invoked.
What is the planner, actually?
Inside the gateway, there’s a single agent configuration file calledgateway/agents/planner.md. It’s a markdown file with YAML frontmatter — this is the real shape from the repo:
/plan request, the gateway does this:
Read the planner's system prompt from the cached agent registry.
The registry is built once at boot by scanning
gateway/agents/*.md. There’s no per-request reload — see gateway/src/agent/index.ts.Add the user's question as a new user message.
Plus any prior turns the client sent in
history (the gateway is stateless, so history travels on the request).Build the tool list from your agents[] catalog.
One tool per
agent.skill pair, named call_<agent>_<skill>.Hand all of that to OpenRouter with streamText().
Claude (or whatever model you picked) drives the loop.