Skip to main content

Agent Cards

Agent Cards are machine-readable JSON documents that describe an agent’s identity, capabilities, and communication endpoints. Published at a well-known URL, they enable other agents and services to discover and interact with your agents.

Agent Card Format

An Agent Card follows the Agent Card specification and is served at:
https://<domain>/.well-known/agent.json

Example Agent Card

{
  "name": "Acme Purchasing Agent",
  "description": "Handles procurement and vendor payments for Acme Corp.",
  "url": "https://purchasing.acme.com",
  "did": "did:anima:ag_8f3k2m9x1n4p7q6r",
  "version": "1.0.0",
  "capabilities": [
    {
      "name": "purchase-order",
      "description": "Create and manage purchase orders",
      "inputSchema": {
        "type": "object",
        "properties": {
          "vendor": { "type": "string" },
          "items": { "type": "array" },
          "budget": { "type": "number" }
        }
      }
    },
    {
      "name": "invoice-processing",
      "description": "Process and approve vendor invoices"
    }
  ],
  "endpoints": {
    "a2a": "https://api.useanima.sh/a2a/ag_8f3k2m9x1n4p7q6r",
    "email": "purchasing@acme.com"
  },
  "authentication": {
    "schemes": ["did-auth", "bearer"]
  },
  "provider": {
    "organization": "Acme Corp",
    "url": "https://acme.com"
  }
}

Publishing Agent Cards

import { Anima } from "@anima-labs/sdk";

const anima = new Anima({ apiKey: "ak_..." });

// Generate and publish an Agent Card
const card = await anima.identity.agentCards.publish({
  agentId: "ag_8f3k2m9x1n4p7q6r",
  domain: "purchasing.acme.com",
  capabilities: [
    {
      name: "purchase-order",
      description: "Create and manage purchase orders",
      inputSchema: {
        type: "object",
        properties: {
          vendor: { type: "string" },
          items: { type: "array" },
          budget: { type: "number" },
        },
      },
    },
  ],
});

console.log(`Published at: ${card.url}`);
// => https://purchasing.acme.com/.well-known/agent.json

Resolving Agent Cards

Fetch another agent’s card to discover its capabilities before initiating communication:
const card = await anima.identity.agentCards.resolve("purchasing.acme.com");

console.log(card.name);          // "Acme Purchasing Agent"
console.log(card.capabilities);  // [{ name: "purchase-order", ... }]
console.log(card.endpoints.a2a); // A2A endpoint URL

API Reference

EndpointMethodDescription
https://api.useanima.sh/api/identity/agent-cardsPOSTPublish an Agent Card
https://api.useanima.sh/api/identity/agent-cards/:agentIdGETGet an agent’s card
https://api.useanima.sh/api/identity/agent-cards/:agentIdPUTUpdate an Agent Card
https://api.useanima.sh/api/identity/agent-cards/:agentIdDELETEUnpublish an Agent Card
https://api.useanima.sh/api/identity/agent-cards/resolveGETResolve a card by domain

Configuration

VariableDefaultDescription
ANIMA_AGENT_CARD_AUTO_PUBLISHtrueAuto-publish cards on agent creation
ANIMA_AGENT_CARD_CACHE_TTL600Cache TTL for resolved cards in seconds

Next Steps