A2A protocol skill for AI agents. Discover, message, and pay other agents.
A TypeScript SDK implementing the A2A (Agent-to-Agent) protocol. It lets AI agents:
- Discover other agents via Agent Cards
- Communicate using JSON-RPC messages
- Verify identity via
did:keyidentifiers - Pay for services via X402 (coming soon)
bun add @qusd/nanda-skill
# or
npm install @qusd/nanda-skillimport { createAgent } from '@qusd/nanda-skill';
const agent = await createAgent({
name: 'my-agent',
description: 'A helpful agent that answers questions',
capabilities: [
{ name: 'chat', description: 'General conversation' },
{ name: 'search', description: 'Search the web' }
],
port: 3000,
onMessage: async (message) => {
return `You said: ${message}`;
}
});
// Agent is now discoverable at:
// http://localhost:3000/.well-known/agent.jsonimport { discoverAgent, sendMessage } from '@qusd/nanda-skill';
// Find an agent
const card = await discoverAgent('http://localhost:3001');
console.log(`Found: ${card.name}`);
console.log(`DID: ${card.did}`);
console.log(`Capabilities: ${card.capabilities.map(c => c.name).join(', ')}`);
// Send a message
const response = await sendMessage('http://localhost:3001', 'Hello!');
console.log(`Response: ${response.result}`);import { A2AClient } from '@qusd/nanda-skill';
const client = new A2AClient('http://localhost:3001');
// Discover the agent
const card = await client.discover();
// Check capabilities
if (client.hasCapability('search')) {
const result = await client.sendMessage('Search for AI news');
console.log(result);
}Every agent exposes an Agent Card at /.well-known/agent.json:
{
"name": "my-agent",
"description": "A helpful agent",
"url": "http://localhost:3000",
"did": "did:key:z6Mk...",
"capabilities": [
{ "name": "chat", "description": "General conversation" }
],
"version": "1.0.0"
}Each agent gets a cryptographic identity using the did:key method:
import { generateIdentity } from '@qusd/nanda-skill';
const identity = await generateIdentity();
console.log(identity.did); // did:key:z6Mk...This DID can be:
- Verified cryptographically (no central authority)
- Registered on-chain for reputation tracking
- Used to sign messages and prove authorship
| Method | Description |
|---|---|
message/send |
Send a message to the agent |
tasks/get |
Get task status by ID |
tasks/list |
List all tasks |
import { createAgent, A2AClient } from '@qusd/nanda-skill';
// Create Vision agent
const vision = await createAgent({
name: 'vision-agent',
description: 'Processes images and detects objects',
capabilities: [{ name: 'detect-objects' }],
port: 3001,
onMessage: async (msg) => {
return JSON.stringify({ objects: ['person', 'car', 'tree'] });
}
});
// Create Navigation agent that uses Vision
const nav = await createAgent({
name: 'nav-agent',
description: 'Plans routes and avoids obstacles',
capabilities: [{ name: 'plan-route' }],
port: 3002,
onMessage: async (msg) => {
// Query vision agent
const visionClient = new A2AClient('http://localhost:3001');
await visionClient.discover();
const obstacles = await visionClient.sendMessage('detect obstacles');
return `Route planned avoiding: ${obstacles.result}`;
}
});- X402 payment integration
- On-chain agent registry
- Reputation scoring
- Streaming responses
- MCP bridge
MIT