[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6RVF6VMM81YBJJ5WF16HP32":3,"skill-same:01M6RVF6VMM81YBJJ5WF16HP32":118},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":49,"commitSha":50,"skillDirectory":51,"forksCount":52,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":55,"ownerDescription":56,"updatedAt":57,"install":58,"resources":71},"01M6RVF6VMM81YBJJ5WF16HP32","a2x-integration",null,"Integrates the @a2x\u002Fsdk (A2A Agent-to-Agent protocol) into TypeScript projects, including paid merchant agents using x402. Supports Next.js App Router, Next.js Pages Router, Express, NestJS, and zero-framework quick start. Use when the user wants to add A2A agent capabilities, an a2x endpoint, or MerchantGate-based payments using @a2x\u002Fsdk.","planetarium\u002Fa2x","planetarium","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F4195773?v=4","01M6RVBZQPB0XARHVGE5M46XKA","Planetarium","01M6RVBZVN4RM8F815F054MGF1",2,"MIT","https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fskills\u002Fa2x-agent-integration\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"a2x integration","integration","agent-to-agent","when","merchant","quick","add","quick start","app","express","next","typescript","x402","router","projects","endpoint","start","payments","framework","capabilities","2026-11-10 10:12:30",false,"---\nname: a2x-integration\ndescription: Integrates the @a2x\u002Fsdk (A2A Agent-to-Agent protocol) into TypeScript projects, including paid merchant agents using x402. Supports Next.js App Router, Next.js Pages Router, Express, NestJS, and zero-framework quick start. Use when the user wants to add A2A agent capabilities, an a2x endpoint, or MerchantGate-based payments using @a2x\u002Fsdk.\n---\n\n# a2x-integration\n\nAdd A2A (Agent-to-Agent) protocol support to any TypeScript project using `@a2x\u002Fsdk`.\n\n**`@a2x\u002Fsdk`** is a self-contained A2A SDK with zero runtime dependencies (only Node.js built-ins). It includes an agent runtime, LLM providers, authentication, task management, and HTTP transport — all in one package.\n\n---\n\n## Before You Start\n\n**IMPORTANT**: The `@a2x\u002Fsdk` package evolves quickly. Before writing any code:\n\n1. Install the package first (see Step 1).\n2. Read actual type definitions from `node_modules\u002F@a2x\u002Fsdk` to confirm current API signatures.\n3. If a class, function, or import path referenced in this skill does not exist in the installed version, search `node_modules\u002F@a2x\u002Fsdk` for the closest equivalent.\n4. **Never hardcode package versions.** Always install the latest.\n\n---\n\n## Wiki Reference\n\nThis skill uses a wiki-style structure. Detailed reference material is in the `wiki\u002F` directory:\n\n| Topic | File | Description |\n|-------|------|-------------|\n| **Core Concepts** | [wiki\u002Fconcepts.md](.\u002Fwiki\u002Fconcepts.md) | Architecture layers, key classes, protocol versions |\n| **LLM Providers** | [wiki\u002Fproviders.md](.\u002Fwiki\u002Fproviders.md) | Google, Anthropic, OpenAI provider setup |\n| **Tools & Agents** | [wiki\u002Ftools-and-agents.md](.\u002Fwiki\u002Ftools-and-agents.md) | FunctionTool, AgentTool, multi-agent patterns |\n| **Security** | [wiki\u002Fsecurity.md](.\u002Fwiki\u002Fsecurity.md) | API Key, Bearer, OAuth2, security requirements |\n| **SSE Streaming** | [wiki\u002Fstreaming.md](.\u002Fwiki\u002Fstreaming.md) | createSSEStream, AsyncGenerator, SSE headers |\n| **Merchant x402 Payments** | [wiki\u002Fx402-payments.md](.\u002Fwiki\u002Fx402-payments.md) | MerchantGate policy decisions, delivery timing, settlement, and durable stores |\n| **Quick Start** | [wiki\u002Fquick-start.md](.\u002Fwiki\u002Fquick-start.md) | `toA2x()` helper for zero-framework prototyping |\n\n### Framework Guides\n\n| Framework | File |\n|-----------|------|\n| **Next.js App Router** | [wiki\u002Fnextjs-app-router.md](.\u002Fwiki\u002Fnextjs-app-router.md) |\n| **Next.js Pages Router** | [wiki\u002Fnextjs-pages-router.md](.\u002Fwiki\u002Fnextjs-pages-router.md) |\n| **Express** | [wiki\u002Fexpress.md](.\u002Fwiki\u002Fexpress.md) |\n| **NestJS** | [wiki\u002Fnestjs.md](.\u002Fwiki\u002Fnestjs.md) |\n\n---\n\n## Workflow\n\n### Step 0 — Analyze the Existing Project\n\nBefore any implementation:\n\n1. Read `package.json` to identify the HTTP framework, package manager, and existing dependencies.\n2. Inspect `src\u002F` (or project root) to understand the directory layout and conventions.\n3. Determine the framework type:\n   - **Next.js App Router** — `src\u002Fapp\u002F` or `app\u002F` directory with `route.ts` files\n   - **Next.js Pages Router** — `src\u002Fpages\u002F` or `pages\u002F` directory with `api\u002F` folder\n   - **Express** — `express` in dependencies, typically `app.ts` or `server.ts`\n   - **NestJS** — `@nestjs\u002Fcore` in dependencies, module\u002Fcontroller\u002Fservice pattern\n   - **None \u002F Quick prototype** — No HTTP framework, or user wants minimal setup\n4. Check for an existing `.env.example` or `.env` file to understand environment variable conventions.\n5. Identify which LLM provider the user wants (Google Gemini, Anthropic Claude, OpenAI GPT). If unclear, ask the user.\n6. If the agent charges through x402 or streams paid output, read [wiki\u002Fx402-payments.md](.\u002Fwiki\u002Fx402-payments.md) before implementing its execution lifecycle.\n\n---\n\n### Step 1 — Install Packages\n\n```bash\n# Use the project's package manager (npm, pnpm, yarn, bun)\nnpm install @a2x\u002Fsdk\n```\n\nInstall the LLM provider SDK as a peer dependency based on user choice:\n\n```bash\n# For Google Gemini\nnpm install @google\u002Fgenai\n\n# For Anthropic Claude\nnpm install @anthropic-ai\u002Fsdk\n\n# For OpenAI GPT\nnpm install openai\n```\n\nAfter installation, verify key exports exist:\n\n```bash\ngrep -r \"export\" node_modules\u002F@a2x\u002Fsdk\u002Fdist\u002Findex.d.ts 2>\u002Fdev\u002Fnull | head -30\n```\n\nLook for these key exports:\n\n| Export | Purpose |\n|--------|---------|\n| `LlmAgent` | Agent with LLM provider and tools |\n| `InMemoryRunner` | Agent execution runtime |\n| `AgentExecutor` | Bridges runner with A2A task lifecycle |\n| `InMemoryTaskStore` | In-memory task storage |\n| `A2XServer` | A2A protocol integration (AgentCard, skills, security) |\n| `DefaultRequestHandler` | Framework-agnostic JSON-RPC handler |\n| `createSSEStream` | SSE streaming helper |\n| `FunctionTool` | Wrap async functions as tools |\n\n---\n\n### Step 2 — Set Up Environment Variables\n\nCreate or update `.env.example`:\n\n```env\n# LLM Provider API Key (choose one based on your provider)\nGOOGLE_API_KEY=\n# ANTHROPIC_API_KEY=\n# OPENAI_API_KEY=\n\n# Public base URL of this server (used in AgentCard)\nBASE_URL=http:\u002F\u002Flocalhost:3000\n\n# Optional: Security\n# API_KEYS=key1,key2,key3\n```\n\nEnsure `.env.local` (or `.env`) is in `.gitignore`.\n\n---\n\n### Step 3 — Create the A2X Setup Module\n\nThis is the core integration. Create an a2x setup file (e.g., `lib\u002Fa2x-setup.ts`, `src\u002Flib\u002Fa2x-setup.ts`, or wherever the project keeps shared modules).\n\nRead [wiki\u002Fconcepts.md](.\u002Fwiki\u002Fconcepts.md) for the full architecture, then create the setup:\n\n```typescript\nimport {\n  LlmAgent,\n  InMemoryRunner,\n  AgentExecutor,\n  StreamingMode,\n  InMemoryTaskStore,\n  A2XServer,\n  DefaultRequestHandler,\n} from '@a2x\u002Fsdk';\n\u002F\u002F Choose your provider — see wiki\u002Fproviders.md\nimport { GoogleProvider } from '@a2x\u002Fsdk\u002Fgoogle';\n\u002F\u002F import { AnthropicProvider } from '@a2x\u002Fsdk\u002Fanthropic';\n\u002F\u002F import { OpenAIProvider } from '@a2x\u002Fsdk\u002Fopenai';\n\n\u002F\u002F 1. Define the LLM agent\nconst agent = new LlmAgent({\n  name: 'my-agent',\n  description: 'A helpful AI agent.',\n  provider: new GoogleProvider({\n    model: 'gemini-2.5-flash',\n    apiKey: process.env.GOOGLE_API_KEY!,\n  }),\n  instruction: 'You are a helpful assistant. Answer clearly and concisely.',\n  \u002F\u002F tools: [],  \u002F\u002F Add FunctionTools here — see wiki\u002Ftools-and-agents.md\n});\n\n\u002F\u002F 2. Create the runtime\nconst runner = new InMemoryRunner({ agent, appName: agent.name });\nconst executor = new AgentExecutor({\n  runner,\n  runConfig: { streamingMode: StreamingMode.SSE },\n});\nconst taskStore = new InMemoryTaskStore();\n\n\u002F\u002F 3. Create the A2XServer (A2A protocol bridge)\nexport const a2xServer = new A2XServer({ taskStore, executor, protocolVersion: '1.0' })\n  .setDefaultUrl(`${process.env.BASE_URL ?? 'http:\u002F\u002Flocalhost:3000'}\u002Fa2a`)\n  .addSkill({\n    id: 'chat',\n    name: 'General Chat',\n    description: 'General-purpose conversation and Q&A',\n    tags: ['chat', 'general'],\n  });\n\u002F\u002F Add security — see wiki\u002Fsecurity.md\n\u002F\u002F .addSecurityScheme('apiKey', new ApiKeyAuthorization({ ... }))\n\u002F\u002F .addSecurityRequirement({ apiKey: [] })\n\n\u002F\u002F 4. Create the request handler\nexport const handler = new DefaultRequestHandler(a2xServer);\n```\n\n**Customization points for the user:**\n- `name` \u002F `description` — agent identity\n- `provider` — which LLM to use (see [wiki\u002Fproviders.md](.\u002Fwiki\u002Fproviders.md))\n- `instruction` — system prompt that defines agent behavior\n- `tools` — array of tools (see [wiki\u002Ftools-and-agents.md](.\u002Fwiki\u002Ftools-and-agents.md))\n- `skills` — A2A skills advertised in the AgentCard\n- Security — authentication schemes (see [wiki\u002Fsecurity.md](.\u002Fwiki\u002Fsecurity.md))\n- Payments — merchant pricing and delivery policy (see [wiki\u002Fx402-payments.md](.\u002Fwiki\u002Fx402-payments.md))\n\n---\n\n### Step 4 — Implement Route Handlers\n\nChoose the framework guide matching the project:\n\n- **Next.js App Router** → [wiki\u002Fnextjs-app-router.md](.\u002Fwiki\u002Fnextjs-app-router.md)\n- **Next.js Pages Router** → [wiki\u002Fnextjs-pages-router.md](.\u002Fwiki\u002Fnextjs-pages-router.md)\n- **Express** → [wiki\u002Fexpress.md](.\u002Fwiki\u002Fexpress.md)\n- **NestJS** → [wiki\u002Fnestjs.md](.\u002Fwiki\u002Fnestjs.md)\n- **Quick prototype (no framework)** → [wiki\u002Fquick-start.md](.\u002Fwiki\u002Fquick-start.md)\n\nEach guide provides:\n1. Agent Card endpoint (`GET \u002F.well-known\u002Fagent.json`)\n2. JSON-RPC endpoint (`POST \u002Fa2a`)\n3. SSE streaming setup\n4. Framework-specific notes\n\nThe core logic is framework-agnostic (see [wiki\u002Fstreaming.md](.\u002Fwiki\u002Fstreaming.md)):\n\n```typescript\nconst result = await handler.handle(body, context);\n\nif (result && typeof result === 'object' && Symbol.asyncIterator in result) {\n  \u002F\u002F Streaming: AsyncGenerator → convert to SSE response\n} else {\n  \u002F\u002F Synchronous: plain object → return as JSON\n}\n```\n\n---\n\n### Step 5 — Verify\n\n1. **Build check**: Run the project's build command to ensure no type errors.\n2. **Agent Card**: `curl http:\u002F\u002Flocalhost:\u003Cport>\u002F.well-known\u002Fagent.json` — should return valid JSON with `name`, `url`, `skills`, `capabilities`.\n3. **Send message**:\n   ```bash\n   curl -X POST http:\u002F\u002Flocalhost:\u003Cport>\u002Fa2a \\\n     -H \"Content-Type: application\u002Fjson\" \\\n     -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"message\u002Fsend\",\"params\":{\"message\":{\"role\":\"user\",\"parts\":[{\"kind\":\"text\",\"text\":\"Hello\"}]}}}'\n   ```\n4. Remind the user to set their LLM provider API key if not already done.\n5. Optionally test with `a2x` CLI:\n   ```bash\n   a2x a2a agent-card http:\u002F\u002Flocalhost:\u003Cport>\n   a2x a2a send http:\u002F\u002Flocalhost:\u003Cport> \"Hello, agent!\"\n   ```\n\n---\n\n## Exposed Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `\u002F.well-known\u002Fagent.json` | GET | AgentCard discovery (A2A standard) |\n| `\u002Fa2a` | POST | JSON-RPC 2.0 endpoint for A2A messages |\n\nThe paths can be customized — update `setDefaultUrl()` on the A2XServer to match.\n\n---\n\n## Key Differences from `ts-a2a-integration` Skill\n\nThis skill uses `@a2x\u002Fsdk` instead of `@a2a-js\u002Fsdk` + `@google\u002Fadk`. Key differences:\n\n| Feature | `@a2x\u002Fsdk` | `@a2a-js\u002Fsdk` + `@google\u002Fadk` |\n|---------|-----------|-------------------------------|\n| Dependencies | Single package | Two packages |\n| LLM Providers | Google, Anthropic, OpenAI built-in | Google only (via ADK) |\n| Protocol Versions | v0.3 + v1.0 from single definition | v1.0 only |\n| AgentCard | Auto-generated via `A2XServer` builder | Manual JSON object |\n| Authentication | Built-in security scheme classes | Manual implementation |\n| Handler | `DefaultRequestHandler` (framework-agnostic) | `JsonRpcTransportHandler` |\n| Quick Start | `toA2x()` helper with built-in HTTP server | Not available |\n\n---\n\n## After Applying\n\nRemind the user to:\n1. Set their LLM provider API key in the environment\n2. Customize the agent: name, description, instruction (system prompt), and skills\n3. Add tools if needed (see [wiki\u002Ftools-and-agents.md](.\u002Fwiki\u002Ftools-and-agents.md))\n4. Configure security if needed (see [wiki\u002Fsecurity.md](.\u002Fwiki\u002Fsecurity.md))\n5. Test with `curl` or the `a2x` CLI\n","# a2x-integration\n\nAdd A2A (Agent-to-Agent) protocol support to any TypeScript project using `@a2x\u002Fsdk`.\n\n**`@a2x\u002Fsdk`** is a self-contained A2A SDK with zero runtime dependencies (only Node.js built-ins). It includes an agent runtime, LLM providers, authentication, task management, and HTTP transport — all in one package.\n\n---\n\n## Before You Start\n\n**IMPORTANT**: The `@a2x\u002Fsdk` package evolves quickly. Before writing any code:\n\n1. Install the package first (see Step 1).\n2. Read actual type definitions from `node_modules\u002F@a2x\u002Fsdk` to confirm current API signatures.\n3. If a class, function, or import path referenced in this skill does not exist in the installed version, search `node_modules\u002F@a2x\u002Fsdk` for the closest equivalent.\n4. **Never hardcode package versions.** Always install the latest.\n\n---\n\n## Wiki Reference\n\nThis skill uses a wiki-style structure. Detailed reference material is in the `wiki\u002F` directory:\n\n| Topic | File | Description |\n|-------|------|-------------|\n| **Core Concepts** | [wiki\u002Fconcepts.md](.\u002Fwiki\u002Fconcepts.md) | Architecture layers, key classes, protocol versions |\n| **LLM Providers** | [wiki\u002Fproviders.md](.\u002Fwiki\u002Fproviders.md) | Google, Anthropic, OpenAI provider setup |\n| **Tools & Agents** | [wiki\u002Ftools-and-agents.md](.\u002Fwiki\u002Ftools-and-agents.md) | FunctionTool, AgentTool, multi-agent patterns |\n| **Security** | [wiki\u002Fsecurity.md](.\u002Fwiki\u002Fsecurity.md) | API Key, Bearer, OAuth2, security requirements |\n| **SSE Streaming** | [wiki\u002Fstreaming.md](.\u002Fwiki\u002Fstreaming.md) | createSSEStream, AsyncGenerator, SSE headers |\n| **Merchant x402 Payments** | [wiki\u002Fx402-payments.md](.\u002Fwiki\u002Fx402-payments.md) | MerchantGate policy decisions, delivery timing, settlement, and durable stores |\n| **Quick Start** | [wiki\u002Fquick-start.md](.\u002Fwiki\u002Fquick-start.md) | `toA2x()` helper for zero-framework prototyping |\n\n### Framework Guides\n\n| Framework | File |\n|-----------|------|\n| **Next.js App Router** | [wiki\u002Fnextjs-app-router.md](.\u002Fwiki\u002Fnextjs-app-router.md) |\n| **Next.js Pages Router** | [wiki\u002Fnextjs-pages-router.md](.\u002Fwiki\u002Fnextjs-pages-router.md) |\n| **Express** | [wiki\u002Fexpress.md](.\u002Fwiki\u002Fexpress.md) |\n| **NestJS** | [wiki\u002Fnestjs.md](.\u002Fwiki\u002Fnestjs.md) |\n\n---\n\n## Workflow\n\n### Step 0 — Analyze the Existing Project\n\nBefore any implementation:\n\n1. Read `package.json` to identify the HTTP framework, package manager, and existing dependencies.\n2. Inspect `src\u002F` (or project root) to understand the directory layout and conventions.\n3. Determine the framework type:\n   - **Next.js App Router** — `src\u002Fapp\u002F` or `app\u002F` directory with `route.ts` files\n   - **Next.js Pages Router** — `src\u002Fpages\u002F` or `pages\u002F` directory with `api\u002F` folder\n   - **Express** — `express` in dependencies, typically `app.ts` or `server.ts`\n   - **NestJS** — `@nestjs\u002Fcore` in dependencies, module\u002Fcontroller\u002Fservice pattern\n   - **None \u002F Quick prototype** — No HTTP framework, or user wants minimal setup\n4. Check for an existing `.env.example` or `.env` file to understand environment variable conventions.\n5. Identify which LLM provider the user wants (Google Gemini, Anthropic Claude, OpenAI GPT). If unclear, ask the user.\n6. If the agent charges through x402 or streams paid output, read [wiki\u002Fx402-payments.md](.\u002Fwiki\u002Fx402-payments.md) before implementing its execution lifecycle.\n\n---\n\n### Step 1 — Install Packages\n\n```bash\n# Use the project's package manager (npm, pnpm, yarn, bun)\nnpm install @a2x\u002Fsdk\n```\n\nInstall the LLM provider SDK as a peer dependency based on user choice:\n\n```bash\n# For Google Gemini\nnpm install @google\u002Fgenai\n\n# For Anthropic Claude\nnpm install @anthropic-ai\u002Fsdk\n\n# For OpenAI GPT\nnpm install openai\n```\n\nAfter installation, verify key exports exist:\n\n```bash\ngrep -r \"export\" node_modules\u002F@a2x\u002Fsdk\u002Fdist\u002Findex.d.ts 2>\u002Fdev\u002Fnull | head -30\n```\n\nLook for these key exports:\n\n| Export | Purpose |\n|--------|---------|\n| `LlmAgent` | Agent with LLM provider and tools |\n| `InMemoryRunner` | Agent execution runtime |\n| `AgentExecutor` | Bridges runner with A2A task lifecycle |\n| `InMemoryTaskStore` | In-memory task storage |\n| `A2XServer` | A2A protocol integration (AgentCard, skills, security) |\n| `DefaultRequestHandler` | Framework-agnostic JSON-RPC handler |\n| `createSSEStream` | SSE streaming helper |\n| `FunctionTool` | Wrap async functions as tools |\n\n---\n\n### Step 2 — Set Up Environment Variables\n\nCreate or update `.env.example`:\n\n```env\n# LLM Provider API Key (choose one based on your provider)\nGOOGLE_API_KEY=\n# ANTHROPIC_API_KEY=\n# OPENAI_API_KEY=\n\n# Public base URL of this server (used in AgentCard)\nBASE_URL=http:\u002F\u002Flocalhost:3000\n\n# Optional: Security\n# API_KEYS=key1,key2,key3\n```\n\nEnsure `.env.local` (or `.env`) is in `.gitignore`.\n\n---\n\n### Step 3 — Create the A2X Setup Module\n\nThis is the core integration. Create an a2x setup file (e.g., `lib\u002Fa2x-setup.ts`, `src\u002Flib\u002Fa2x-setup.ts`, or wherever the project keeps shared modules).\n\nRead [wiki\u002Fconcepts.md](.\u002Fwiki\u002Fconcepts.md) for the full architecture, then create the setup:\n\n```typescript\nimport {\n  LlmAgent,\n  InMemoryRunner,\n  AgentExecutor,\n  StreamingMode,\n  InMemoryTaskStore,\n  A2XServer,\n  DefaultRequestHandler,\n} from '@a2x\u002Fsdk';\n\u002F\u002F Choose your provider — see wiki\u002Fproviders.md\nimport { GoogleProvider } from '@a2x\u002Fsdk\u002Fgoogle';\n\u002F\u002F import { AnthropicProvider } from '@a2x\u002Fsdk\u002Fanthropic';\n\u002F\u002F import { OpenAIProvider } from '@a2x\u002Fsdk\u002Fopenai';\n\n\u002F\u002F 1. Define the LLM agent\nconst agent = new LlmAgent({\n  name: 'my-agent',\n  description: 'A helpful AI agent.',\n  provider: new GoogleProvider({\n    model: 'gemini-2.5-flash',\n    apiKey: process.env.GOOGLE_API_KEY!,\n  }),\n  instruction: 'You are a helpful assistant. Answer clearly and concisely.',\n  \u002F\u002F tools: [],  \u002F\u002F Add FunctionTools here — see wiki\u002Ftools-and-agents.md\n});\n\n\u002F\u002F 2. Create the runtime\nconst runner = new InMemoryRunner({ agent, appName: agent.name });\nconst executor = new AgentExecutor({\n  runner,\n  runConfig: { streamingMode: StreamingMode.SSE },\n});\nconst taskStore = new InMemoryTaskStore();\n\n\u002F\u002F 3. Create the A2XServer (A2A protocol bridge)\nexport const a2xServer = new A2XServer({ taskStore, executor, protocolVersion: '1.0' })\n  .setDefaultUrl(`${process.env.BASE_URL ?? 'http:\u002F\u002Flocalhost:3000'}\u002Fa2a`)\n  .addSkill({\n    id: 'chat',\n    name: 'General Chat',\n    description: 'General-purpose conversation and Q&A',\n    tags: ['chat', 'general'],\n  });\n\u002F\u002F Add security — see wiki\u002Fsecurity.md\n\u002F\u002F .addSecurityScheme('apiKey', new ApiKeyAuthorization({ ... }))\n\u002F\u002F .addSecurityRequirement({ apiKey: [] })\n\n\u002F\u002F 4. Create the request handler\nexport const handler = new DefaultRequestHandler(a2xServer);\n```\n\n**Customization points for the user:**\n- `name` \u002F `description` — agent identity\n- `provider` — which LLM to use (see [wiki\u002Fproviders.md](.\u002Fwiki\u002Fproviders.md))\n- `instruction` — system prompt that defines agent behavior\n- `tools` — array of tools (see [wiki\u002Ftools-and-agents.md](.\u002Fwiki\u002Ftools-and-agents.md))\n- `skills` — A2A skills advertised in the AgentCard\n- Security — authentication schemes (see [wiki\u002Fsecurity.md](.\u002Fwiki\u002Fsecurity.md))\n- Payments — merchant pricing and delivery policy (see [wiki\u002Fx402-payments.md](.\u002Fwiki\u002Fx402-payments.md))\n\n---\n\n### Step 4 — Implement Route Handlers\n\nChoose the framework guide matching the project:\n\n- **Next.js App Router** → [wiki\u002Fnextjs-app-router.md](.\u002Fwiki\u002Fnextjs-app-router.md)\n- **Next.js Pages Router** → [wiki\u002Fnextjs-pages-router.md](.\u002Fwiki\u002Fnextjs-pages-router.md)\n- **Express** → [wiki\u002Fexpress.md](.\u002Fwiki\u002Fexpress.md)\n- **NestJS** → [wiki\u002Fnestjs.md](.\u002Fwiki\u002Fnestjs.md)\n- **Quick prototype (no framework)** → [wiki\u002Fquick-start.md](.\u002Fwiki\u002Fquick-start.md)\n\nEach guide provides:\n1. Agent Card endpoint (`GET \u002F.well-known\u002Fagent.json`)\n2. JSON-RPC endpoint (`POST \u002Fa2a`)\n3. SSE streaming setup\n4. Framework-specific notes\n\nThe core logic is framework-agnostic (see [wiki\u002Fstreaming.md](.\u002Fwiki\u002Fstreaming.md)):\n\n```typescript\nconst result = await handler.handle(body, context);\n\nif (result && typeof result === 'object' && Symbol.asyncIterator in result) {\n  \u002F\u002F Streaming: AsyncGenerator → convert to SSE response\n} else {\n  \u002F\u002F Synchronous: plain object → return as JSON\n}\n```\n\n---\n\n### Step 5 — Verify\n\n1. **Build check**: Run the project's build command to ensure no type errors.\n2. **Agent Card**: `curl http:\u002F\u002Flocalhost:\u003Cport>\u002F.well-known\u002Fagent.json` — should return valid JSON with `name`, `url`, `skills`, `capabilities`.\n3. **Send message**:\n   ```bash\n   curl -X POST http:\u002F\u002Flocalhost:\u003Cport>\u002Fa2a \\\n     -H \"Content-Type: application\u002Fjson\" \\\n     -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"message\u002Fsend\",\"params\":{\"message\":{\"role\":\"user\",\"parts\":[{\"kind\":\"text\",\"text\":\"Hello\"}]}}}'\n   ```\n4. Remind the user to set their LLM provider API key if not already done.\n5. Optionally test with `a2x` CLI:\n   ```bash\n   a2x a2a agent-card http:\u002F\u002Flocalhost:\u003Cport>\n   a2x a2a send http:\u002F\u002Flocalhost:\u003Cport> \"Hello, agent!\"\n   ```\n\n---\n\n## Exposed Endpoints\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `\u002F.well-known\u002Fagent.json` | GET | AgentCard discovery (A2A standard) |\n| `\u002Fa2a` | POST | JSON-RPC 2.0 endpoint for A2A messages |\n\nThe paths can be customized — update `setDefaultUrl()` on the A2XServer to match.\n\n---\n\n## Key Differences from `ts-a2a-integration` Skill\n\nThis skill uses `@a2x\u002Fsdk` instead of `@a2a-js\u002Fsdk` + `@google\u002Fadk`. Key differences:\n\n| Feature | `@a2x\u002Fsdk` | `@a2a-js\u002Fsdk` + `@google\u002Fadk` |\n|---------|-----------|-------------------------------|\n| Dependencies | Single package | Two packages |\n| LLM Providers | Google, Anthropic, OpenAI built-in | Google only (via ADK) |\n| Protocol Versions | v0.3 + v1.0 from single definition | v1.0 only |\n| AgentCard | Auto-generated via `A2XServer` builder | Manual JSON object |\n| Authentication | Built-in security scheme classes | Manual implementation |\n| Handler | `DefaultRequestHandler` (framework-agnostic) | `JsonRpcTransportHandler` |\n| Quick Start | `toA2x()` helper with built-in HTTP server | Not available |\n\n---\n\n## After Applying\n\nRemind the user to:\n1. Set their LLM provider API key in the environment\n2. Customize the agent: name, description, instruction (system prompt), and skills\n3. Add tools if needed (see [wiki\u002Ftools-and-agents.md](.\u002Fwiki\u002Ftools-and-agents.md))\n4. Configure security if needed (see [wiki\u002Fsecurity.md](.\u002Fwiki\u002Fsecurity.md))\n5. Test with `curl` or the `a2x` CLI\n",{"name":5,"description":7},"main","979177bdf83f9694f14e4767069aa284ca283cc2","skills\u002Fa2x-agent-integration",3,"https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x","https:\u002F\u002Fgithub.com\u002Fplanetarium","https:\u002F\u002Fplanetariumhq.com\u002F","We bring freedom and moddability to massively multiplayer games with decentralization and open source technology.","2026-11-06 21:12:05",{"source":8,"skillName":5,"commands":59,"prompt":69,"zipAvailable":70},[60,63,66],{"tool":61,"command":62},"npx","npx skills add planetarium\u002Fa2x --skill a2x-integration",{"tool":64,"command":65},"bunx","bunx skills add planetarium\u002Fa2x --skill a2x-integration",{"tool":67,"command":68},"pnpm","pnpm dlx skills add planetarium\u002Fa2x --skill a2x-integration","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fskills\u002Fa2x-agent-integration\u002FSKILL.md",true,[72,78,82,86,90,94,98,102,106,110,114],{"path":73,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":77},"wiki\u002Fconcepts.md","REFERENCE","参考文档",6108,"https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fskills\u002Fa2x-agent-integration\u002Fwiki\u002Fconcepts.md",{"path":79,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":80,"sourceHtmlUrl":81},"wiki\u002Fexpress.md",4992,"https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fskills\u002Fa2x-agent-integration\u002Fwiki\u002Fexpress.md",{"path":83,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":84,"sourceHtmlUrl":85},"wiki\u002Fnestjs.md",6492,"https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fskills\u002Fa2x-agent-integration\u002Fwiki\u002Fnestjs.md",{"path":87,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":88,"sourceHtmlUrl":89},"wiki\u002Fnextjs-app-router.md",5318,"https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fskills\u002Fa2x-agent-integration\u002Fwiki\u002Fnextjs-app-router.md",{"path":91,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":92,"sourceHtmlUrl":93},"wiki\u002Fnextjs-pages-router.md",4467,"https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fskills\u002Fa2x-agent-integration\u002Fwiki\u002Fnextjs-pages-router.md",{"path":95,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":96,"sourceHtmlUrl":97},"wiki\u002Fproviders.md",1947,"https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fskills\u002Fa2x-agent-integration\u002Fwiki\u002Fproviders.md",{"path":99,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":100,"sourceHtmlUrl":101},"wiki\u002Fquick-start.md",3585,"https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fskills\u002Fa2x-agent-integration\u002Fwiki\u002Fquick-start.md",{"path":103,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":104,"sourceHtmlUrl":105},"wiki\u002Fsecurity.md",4564,"https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fskills\u002Fa2x-agent-integration\u002Fwiki\u002Fsecurity.md",{"path":107,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":108,"sourceHtmlUrl":109},"wiki\u002Fstreaming.md",4299,"https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fskills\u002Fa2x-agent-integration\u002Fwiki\u002Fstreaming.md",{"path":111,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":112,"sourceHtmlUrl":113},"wiki\u002Ftools-and-agents.md",3207,"https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fskills\u002Fa2x-agent-integration\u002Fwiki\u002Ftools-and-agents.md",{"path":115,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":116,"sourceHtmlUrl":117},"wiki\u002Fx402-payments.md",7092,"https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fskills\u002Fa2x-agent-integration\u002Fwiki\u002Fx402-payments.md",[119,144,167,180,198,217],{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":129,"publishedAt":44},"01M6RVFRNG694YHVXKQ4Y9FQRV","a2x-client-integration","Integrates `@a2x\u002Fsdk` **client-side** into a TypeScript application — call remote A2A agents from a Node.js CLI, Express\u002FFastify backend, Next.js server action, or background worker. Covers `A2XClient`, the `AuthProvider` fallback chain, `AuthScheme` handling, token persistence, SSE streaming consumption, and error mapping. Use when the user says things like \"call an A2A agent\", \"use A2XClient\", \"consume an a2x agent\", \"add a2x client\", \"authenticate against an a2x agent\", \"stream from an a2x agent\", or wants to embed remote agent access into their own app.","https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fskills\u002Fa2x-client-integration\u002FSKILL.md",[125,128],{"categoryNo":126,"categoryName":127,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[130,131,25,27,132,35,133,134,135,136,137,138,139,34,140,141,33,142,32,143],"a2x client integration","client","cli","streaming","error","server","access","node","remote","sse streaming","token","worker","fastify","chain",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":155,"publishedAt":44},"01M6RVEHQ768BSWM2N3HHZYBYB","weather-report","Produce a compact weather report for a specified city. Use when the user asks about the weather, forecast, or temperature for a named city.","https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fsamples\u002Fnextjs-skill\u002Fskills\u002Fweather-report\u002FSKILL.md",[150],{"categoryNo":151,"categoryName":152,"taxonomyType":153,"taxonomyTypeDesc":154},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[156,157,158,159,160,161,162,163,164,165,27,166],"weather report","report","weather","forecast","user","use","compact","about","temperature","for","produce",{"skillNo":168,"name":169,"nameZh":6,"description":170,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":171,"categories":172,"keywords":173,"publishedAt":44},"01M6RVECTSTYJ3ZSF2BY2ZS96H","recipe-suggest","Suggest recipes based on a small list of ingredients the user already has. Use when the user lists ingredients and asks what they can cook, or mentions pantry, fridge, or leftover ingredients.","https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fsamples\u002Fnextjs-skill\u002Fskills\u002Frecipe-suggest\u002FSKILL.md",[],[174,175,176,177,160,161,178,179,27],"recipe suggest","recipe","cook","list","recipes","can",{"skillNo":181,"name":182,"nameZh":6,"description":183,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":184,"categories":185,"keywords":186,"publishedAt":44},"01M6RVE9MDP4KGW7R1QDYAAZNB","valid-simple","A minimal skill used by unit tests. Used when parser\u002Floader coverage requires the smallest possible valid SKILL.md.","https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fpackages\u002Fa2x\u002Fsrc\u002F__tests__\u002Ffixtures\u002Fskills\u002Fvalid-simple\u002FSKILL.md",[],[187,188,189,190,191,192,193,194,195,196,197,27],"valid simple","simple","valid","unit","valid skill","unit tests","minimal skill","parser","coverage","minimal","tests",{"skillNo":199,"name":200,"nameZh":6,"description":201,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":202,"categories":203,"keywords":204,"publishedAt":44},"01M6RVE4X94SZDP7XBT0ZWQ1P4","valid-full","A skill exercising every frontmatter feature the SDK supports.","https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fpackages\u002Fa2x\u002Fsrc\u002F__tests__\u002Ffixtures\u002Fskills\u002Fvalid-full\u002FSKILL.md",[],[189,205,206,207,208,209,210,211,212,165,213,214,194,215,216,197],"full","valid full","sdk","feature","false","advanced","sonnet","true","frontmatter","read","Bash","verify",{"skillNo":218,"name":219,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":220,"categories":221,"keywords":222,"publishedAt":44},"01M6RVDMQSZ2FWRD5X71XBKEA2","invalid-no-frontmatter","https:\u002F\u002Fgithub.com\u002Fplanetarium\u002Fa2x\u002Fblob\u002Fmain\u002Fpackages\u002Fa2x\u002Fsrc\u002F__tests__\u002Ffixtures\u002Fskills\u002Finvalid-no-frontmatter\u002FSKILL.md",[],[223,224,225,213],"invalid","no frontmatter","invalid no frontmatter"]