@agnt-id/a2a
v0.1.2
Published
Generate Google A2A Agent Cards from .agnt names
Maintainers
Readme
@agnt-id/a2a
Generate Google A2A Agent Cards from .agnt names.
Takes a resolved .agnt record and produces a spec-compliant A2A Agent Card — the standard discovery format for the Agent-to-Agent protocol.
Install
npm i @agnt-id/a2aOr install everything at once:
npm i @agnt-id/sdkQuick Start
From a resolved name
import { AgntClient } from "@agnt-id/resolve";
import { toAgentCard, agentCardToJSON } from "@agnt-id/a2a";
const agnt = new AgntClient();
const resolved = await agnt.resolve("alice.agnt");
const card = toAgentCard(resolved, {
version: "1.0.0",
provider: { organization: "Alice Labs", url: "https://alice.example.com" },
});
console.log(agentCardToJSON(card));One-step resolve + convert
import { fromAgnt } from "@agnt-id/a2a";
// Requires @agnt-id/resolve as a peer dependency
const card = await fromAgnt("alice.agnt", {
version: "1.0.0",
});API
toAgentCard(agnt, options?): AgentCard
Convert a resolved .agnt name to an A2A Agent Card.
The function maps .agnt records to A2A fields:
| .agnt field | A2A field |
|-------------|-----------|
| name | name |
| records.texts.description | description |
| records.texts.avatar | iconUrl |
| records.a2a | supportedInterfaces[].url |
| records.skills | skills[] |
Options:
| Option | Type | Description |
|--------|------|-------------|
| version | string | Agent version (default: "0.1.0") |
| provider | AgentProvider | Provider info (organization, url) |
| capabilities | AgentCapabilities | streaming, pushNotifications, stateTransitionHistory |
| securitySchemes | Record<string, SecurityScheme> | Auth schemes |
| documentationUrl | string | Link to agent docs |
agentCardToJSON(card): string
Serialize an Agent Card to formatted JSON.
fromAgnt(name, options?): Promise<AgentCard>
Resolve a .agnt name and convert to an Agent Card in one call. Requires @agnt-id/resolve as a peer dependency (uses dynamic import).
Types
All A2A protocol types are exported:
import type {
AgentCard,
AgentProvider,
AgentInterface,
AgentCapabilities,
AgentSkill,
SecurityScheme,
ToAgentCardOptions,
} from "@agnt-id/a2a";Links
License
MIT
