{"_id":"@a2a-relay/client","name":"@a2a-relay/client","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@a2a-relay/client","version":"0.1.0","description":"Discover and communicate with A2A agents","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc","dev":"tsc --watch","test":"echo 'no tests yet'"},"repository":{"type":"git","url":"git+https://github.com/agent-relay/agent-relay.git","directory":"packages/client"},"homepage":"https://github.com/agent-relay/agent-relay","author":{"name":"Agent Relay Contributors"},"license":"MIT","dependencies":{"uuid":"^11.1.0"},"devDependencies":{"@types/uuid":"^10.0.0","typescript":"^5.7.0"},"engines":{"node":">=18.0.0"},"keywords":["a2a","agent","agent-relay","ai","agent-to-agent","client"],"_id":"@a2a-relay/client@0.1.0","gitHead":"244a47204f2c8011b65ae2c60af383292727f271","bugs":{"url":"https://github.com/agent-relay/agent-relay/issues"},"_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-/GrIQKSwLLxbmrn21gopEfWn9dISz40xZ6/P8gmxg9YOBbyikSdSXcOiVHxEtpbDIGUn+UoAQRQG821OG0Q9lg==","shasum":"b0a5fb9d29818ccc536495743fc89959db25d950","tarball":"https://registry.npmjs.org/@a2a-relay/client/-/client-0.1.0.tgz","fileCount":14,"unpackedSize":26878,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEWheBGcPv+pKl5WWg7L4D77uPOVqo9MEigl223e3XO4AiBDxeTYK5u2vaUvQCO0S2oQ7y9ticxR3IHSzSmoXgVaQA=="}]},"_npmUser":{"name":"bruce_wayne_new_era","email":"bw61180@gmail.com"},"directories":{},"maintainers":[{"name":"bruce_wayne_new_era","email":"bw61180@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/client_0.1.0_1770049329692_0.08326617840268757"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-02T16:22:09.615Z","0.1.0":"2026-02-02T16:22:09.838Z","modified":"2026-02-02T16:22:10.038Z"},"maintainers":[{"name":"bruce_wayne_new_era","email":"bw61180@gmail.com"}],"description":"Discover and communicate with A2A agents","homepage":"https://github.com/agent-relay/agent-relay","keywords":["a2a","agent","agent-relay","ai","agent-to-agent","client"],"repository":{"type":"git","url":"git+https://github.com/agent-relay/agent-relay.git","directory":"packages/client"},"author":{"name":"Agent Relay Contributors"},"bugs":{"url":"https://github.com/agent-relay/agent-relay/issues"},"license":"MIT","readme":"# @a2a-relay/client\n\nDiscover and communicate with A2A agents. Fetch Agent Cards, send messages, get responses.\n\nPart of [Agent Relay](https://github.com/agent-relay/agent-relay) — the open infrastructure for the agent economy.\n\n## Install\n\n```bash\nnpm install @a2a-relay/client\n```\n\n## Quick Start\n\n```typescript\nimport { RelayClient } from '@a2a-relay/client';\n\nconst client = new RelayClient();\n\n// Discover an agent by URL\nconst agent = await client.discover('https://some-agent.example.com');\n\n// See what it can do\nconsole.log(agent.card.name);        // \"Car Expert\"\nconsole.log(agent.card.skills);      // [{ id: 'diagnose', ... }]\n\n// Send a message\nconst response = await agent.send('My engine is making a clicking noise');\nconsole.log(response.text);          // \"Based on your description...\"\n```\n\n## Features\n\n- **🔍 Agent Discovery** — fetch Agent Cards from any A2A-compliant agent\n- **💬 Send Messages** — text and structured data\n- **🔐 Auth Support** — pass bearer tokens for protected agents\n- **🎯 Skill Inspection** — check agent capabilities before sending\n- **📋 A2A Compliant** — speaks standard [Agent-to-Agent protocol](https://a2a-protocol.org)\n\n## Discovery\n\n```typescript\nconst client = new RelayClient();\n\n// Discover via well-known URL\nconst agent = await client.discover('https://some-agent.com');\n\n// Discover with authentication\nconst agent = await client.discover('https://private-agent.com', 'my-token');\n\n// Or set a default token for all discoveries\nconst client = new RelayClient({ token: 'default-token' });\nconst agent = await client.discover('https://private-agent.com');\n```\n\n## Sending Messages\n\n```typescript\n// Simple text message\nconst response = await agent.send('What time is it?');\nconsole.log(response.text);\n\n// With conversation context (multi-turn)\nconst r1 = await agent.send('Hi, I need help with my car');\nconst r2 = await agent.send('The engine is overheating', {\n  contextId: r1.contextId,\n});\n\n// With auth token (per-request)\nconst response = await agent.send('Hello', { token: 'specific-token' });\n```\n\n## Structured Data\n\n```typescript\n// Send structured data\nconst response = await agent.sendData({\n  type: 'diagnostic_request',\n  symptoms: ['clicking noise', 'rough idle'],\n  vehicle: { make: 'Toyota', year: 2019 },\n});\n\n// Read structured response\nconsole.log(response.text);          // Human-readable text\nconsole.log(response.data);          // { diagnosis: ..., confidence: 0.85 }\nconsole.log(response.parts);         // Raw A2A message parts\n```\n\n## Skill Inspection\n\n```typescript\nconst agent = await client.discover('https://some-agent.com');\n\n// Check for a specific skill\nif (agent.hasSkill('diagnose')) {\n  const response = await agent.send('Engine clicking noise');\n}\n\n// Find skills by tag\nconst diagnosticSkills = agent.skillsByTag('diagnostics');\nconsole.log(diagnosticSkills);\n```\n\n## Connect Without Discovery\n\nIf you already have an Agent Card (e.g., from a registry), skip the HTTP fetch:\n\n```typescript\nconst card = {\n  name: 'Known Agent',\n  url: 'https://agent.example.com/a2a/jsonrpc',\n  skills: [{ id: 'greet', name: 'Greeting', description: 'Say hello' }],\n};\n\nconst agent = client.connect(card);\nconst response = await agent.send('Hello!');\n```\n\n## API\n\n### `new RelayClient(options?)`\n\n| Option | Type | Description |\n|--------|------|-------------|\n| `token` | `string` | Default bearer token for all requests |\n\n### `client.discover(url, token?)`\n\nFetch an Agent Card from the well-known URL and return a connected `RemoteAgent`.\n\n### `client.connect(card, token?)`\n\nCreate a `RemoteAgent` from a known Agent Card (no HTTP fetch).\n\n### `agent.send(text, options?)`\n\nSend a text message. Returns `AgentResponse`.\n\n### `agent.sendData(data, options?)`\n\nSend structured data. Returns `AgentResponse`.\n\n### `agent.hasSkill(id)`\n\nCheck if the agent has a specific skill.\n\n### `agent.skillsByTag(tag)`\n\nGet all skills matching a tag.\n\n### `AgentResponse`\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `text` | `string` | Combined text from all text parts |\n| `data` | `object \\| undefined` | Structured data (if any) |\n| `parts` | `MessagePart[]` | Raw A2A message parts |\n| `messageId` | `string` | Response message ID |\n| `contextId` | `string \\| undefined` | Context ID for multi-turn |\n\n## Related\n\n- [`@a2a-relay/server`](https://www.npmjs.com/package/@a2a-relay/server) — build A2A agents in minutes\n- [Agent Relay](https://github.com/agent-relay/agent-relay) — the full project\n- [A2A Protocol](https://a2a-protocol.org) — the underlying standard\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-63f9d8e7b73f0884b0b556c21a6d7288"}