TypeScript/JS
This page is generated from the A2A Pack language SDK metadata.
Scaffold
a2a init math-agent --language typescriptImplementation Contract
Extend A2AAgent, declare static skill schemas, and implement matching handler methods. This TypeScript/JS SDK page covers typed projects and plain JS.
import { A2AAgent, publicAuth, skill, type WorkerRequest, type WorkerResponse } from "@a2a/pack-ts";
export class MathAgent extends A2AAgent {
static agent = { name: "math-agent", description: "Math helper", version: "0.1.0" };
static auth = publicAuth();
static skills = [skill({ name: "sum", input_schema: { type: "object", properties: {}, required: [] }, output_schema: { type: "object" } })];
async sum(request: WorkerRequest): Promise<WorkerResponse> {
return { result: { value: Number(request.arguments.left) + Number(request.arguments.right) } };
}
}Local Commands
npm run compile
npm run workerSDK Package
@a2a/pack-ts vendored at vendor/a2a-pack-ts.
The compiled .a2a/agent.dsl.json is the sidecar contract. The sidecar
owns public A2A, MCP, frontend, and invoke endpoints; the language SDK
owns native handler execution through the worker protocol.