Skip to main content
Each .ts file in app/agents/ is auto-discovered and registered as a sub-agent on its own A2A endpoint.
app/agents/research.ts
Given the file app/agents/research.ts, the sub-agent is exposed at /research/agent with its agent card at /research/.well-known/agent-card.json.

Exports

ExportTypeRequiredDescription
defaultToolLoopAgentYesThe agent instance
acceptsAcceptsNoPayment config — gates the sub-agent A2A endpoint with x402
When accepts is exported, the sub-agent endpoint requires x402 payment. Without it, the sub-agent is not registered.

Conventions

  • Auto-discovered — All .ts files in app/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 mix app/agent.ts (main agent) with app/agents/ (sub-agents) in the same project:
This exposes three independent A2A endpoints from a single deployment.