.ts file in app/agents/ is auto-discovered and registered as a sub-agent on its own A2A endpoint.
app/agents/research.ts, the sub-agent is exposed at /research/agent with its agent card at /research/.well-known/agent-card.json.
Exports
| Export | Type | Required | Description |
|---|---|---|---|
default | ToolLoopAgent | Yes | The agent instance |
accepts | Accepts | No | Payment config — gates the sub-agent A2A endpoint with x402 |
accepts is exported, the sub-agent endpoint requires x402 payment. Without it, the sub-agent is not registered.
Conventions
- Auto-discovered — All
.tsfiles inapp/agents/are registered automatically - Ignored files — Files starting with
_(e.g.,_helpers.ts) are skipped - Routing — The filename (without
.ts) becomes the URL prefix (e.g.,research.ts→/research/agent)
Multiple Sub-Agents
You can mixapp/agent.ts (main agent) with app/agents/ (sub-agents) in the same project: