Multi-agent Routing
Instead of always running the default agent, the router examines each message and picks the best specialist based on tag + keyword scoring.
Scoring
- +10 if message contains the agent's mode name (e.g. "ask defi-strategist...")
- +5 per exact tag match (from
IDENTITY.md) - +1 per keyword match (name, description, tags as keywords)
Threshold: score โฅ 2 to override current agent.
Querying the router
curl -X POST http://127.0.0.1:18789/agent/route \
-d '{"message": "is this Solana token a rug?"}'
# โ {"mode":"bags-hunter","score":12,"reason":"matched: solana, token, rug"}Improving routing
Add tags to IDENTITY.md:
# bags-hunter/IDENTITY.md
## Tags
solana, memecoin, bags.fm, rug, contract, holdersAuto-loading
On gateway start, the router scans bundled + user agent dirs. To reload after adding new agents:
curl -X POST http://127.0.0.1:18789/heartbeat/reloadSource
Implementation: apps/gateway/src/router.ts