Skip to main content

Overview

This template shows how to deploy multiple specialist agents from a single service using the app/agents/ directory. Each file in app/agents/ becomes an independent A2A endpoint alongside the main app/agent.ts coordinator. The example has three agents and two tools:
  • Coordinator (app/agent.ts) — routes users to the right specialist
  • Math specialist (app/agents/math.ts) — performs arithmetic using the calculate tool
  • Text specialist (app/agents/text.ts) — analyzes text using the word-count tool

Project Structure

Endpoints

A single deployment exposes three independent A2A endpoints:

Sub-Agent Definition

Each file in app/agents/ follows the same pattern as app/agent.ts:
app/agents/math.ts
The filename (math.ts) determines the URL prefix (/math/agent).

Key Features

  • Auto-discovery — All .ts files in app/agents/ are automatically registered
  • Independent endpoints — Each sub-agent gets its own A2A endpoint and agent card
  • Shared tools via MCP — Tools in app/tools/ are exposed on a single /mcp endpoint
  • Mixed deploymentapp/agent.ts and app/agents/ can coexist in the same project

Running

Agents available at http://localhost:3000: