Skip to main content

Publish an agent card

Describe an agent to other agents with an A2A agent card, and verify a card that you received.

RecipeReadyView source
Works with
Plain HTTP

What it shows​

An A2A agent card is a JSON document that describes an agent to other agents: its name, the address where it answers, its skills and how a caller authenticates. LumoAuth builds the card from the registration of the agent and signs it with a key of your organization.

  1. You give the agent an A2A endpoint in the portal and publish its card.
  2. The script reads the signed card of the agent. The request needs no credential.
  3. It reads the list of all cards that the organization publishes.
  4. It sends the card to the verification endpoint, with the token of an agent. LumoAuth answers that the signature is valid.
  5. It changes one value of the card and sends it again. The card no longer verifies.

Before you start​

  • An API key with the scopes admin:agents:read and admin:agents:write, for the setup script.
  • curl and jq.
VariableValue
LUMOAUTH_URLThe address of LumoAuth: https://app.lumoauth.dev, or https://eu.app.lumoauth.dev for the EU region.
LUMOAUTH_ORG_IDYour organization, for example acme-corp.
LUMOAUTH_API_KEYFor the setup script only: an API key with the scopes admin:agents:read and admin:agents:write.
AGENT_CLIENT_IDThe agent ID (agt_…) of the agent that publishes the card. The setup script prints it.
AGENT_CLIENT_SECRETThe client secret of that agent. The script uses it to get the token for the verification.

The setup script creates what the recipe needs, through the Admin API. You can run it again at any time.

node agents/agent-cards/setup.mjs
setup.mjs
// Registers the agent of this recipe. Its card is not public yet: you publish
// it in the portal, as the page describes. Run this script again at any time.
//
// node agents/agent-cards/setup.mjs
//
// The API key needs the scopes admin:agents:read and admin:agents:write.
import { call, ensure, org, printEnv, url } from '../../_lib/admin.mjs';

const agent = await ensure('/admin/agents', (a) => a.name === 'Travel booking agent', {
name: 'Travel booking agent',
description: 'Searches flights and hotels, and books a trip after approval.',
identityType: 'client_secret',
capabilities: ['trips:search', 'trips:book'],
});

// LumoAuth shows a secret once, in the answer that creates it. On a second
// run the script therefore asks for a new secret, and the old one stops.
const secret =
agent.clientSecret ??
(await call('POST', `/admin/agents/${agent.agentId}/rotate-credentials`)).data.clientSecret;

console.log(`Agent "${agent.name}" is ready. Publish its card on this page of the portal:`);
console.log(`${url}/orgs/${org}/portal/agents/${agent.id}/edit`);
printEnv({ AGENT_CLIENT_ID: agent.agentId, AGENT_CLIENT_SECRET: secret });

The setup script registers the agent "Travel booking agent" and prints the address of its edit page. The card settings exist in the portal only:

  1. Open AI Agents, then Agents, and select the agent "Travel booking agent".
  2. Select Edit agent.
  3. Open the section A2A agent card.
  4. In A2A endpoint URL, enter the address where other agents reach this agent, for example https://travel.example.com/a2a.
  5. In A2A skills, enter one skill on each line, in the form id | name | description. For example search-trips | Search trips | Finds flights and hotels for given dates.
  6. Turn on Publish at the well-known location, and select Save changes.

Code​

Run each command from the recipes folder of the examples repository. Set the folder up once for your language. Every version below was run against a LumoAuth organization.

agents/agent-cards/http/cards.sh
#!/bin/sh
# Read the signed A2A card of an agent, read the list of cards of the
# organization, and verify a card with the token of an agent.
#
# sh agents/agent-cards/http/cards.sh
#
# The script needs curl and jq.
set -eu

ORG="$LUMOAUTH_URL/orgs/$LUMOAUTH_ORG_ID"
CARD_FILE="${TMPDIR:-/tmp}/agent-card.json"

# 1. The card of one agent. The request needs no credential: a card is public.
curl --silent --show-error --fail "$ORG/api/v1/agents/$AGENT_CLIENT_ID/agent-card" > "$CARD_FILE"
jq -r '"card: \(.name), endpoint \(.url)", "skills: \([.skills[].id] | join(" "))"' "$CARD_FILE"

# 2. The list of the cards that the organization publishes, also public.
curl --silent --show-error --fail "$ORG/.well-known/agent.json" |
jq -r '"published cards: \([.agents[].name] | join(", "))"'

# 3. Verification needs a caller of the organization. Here the agent asks
# with its own token.
TOKEN=$(curl --silent --show-error --fail "$ORG/api/v1/oauth/token" \
--data grant_type=client_credentials \
--data "client_id=$AGENT_CLIENT_ID" \
--data-urlencode "client_secret=$AGENT_CLIENT_SECRET" | jq -r '.access_token')

verify() { # reads a card from standard input
curl --silent --show-error --fail "$ORG/api/v1/agents/agent-card/verify" \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/json" \
--data-binary @- | jq -r 'if .valid then "valid, key \(.signer.kid)" else "not valid (\(.error))" end'
}

# LumoAuth checks the signature of the card with the keys of the organization.
echo "card as received: $(verify < "$CARD_FILE")"

# 4. Change one value of the card. The signature no longer fits.
echo "card after a change: $(jq '.url = "https://other.example.com/a2a"' "$CARD_FILE" | verify)"
sh agents/agent-cards/http/cards.sh

Check the result​

Output
card: Travel booking agent, endpoint https://travel.example.com/a2a
skills: search-trips book-trip
published cards: Travel booking agent
card as received: valid, key acme-corp-rs256-20261128005246-2a88e48c
card after a change: not valid (Signature verification failed: Signature verification failed)
  • Open https://app.lumoauth.dev/orgs/<your organization>/.well-known/agent.json in a browser. The list holds the agent, with the address of its card.
  • The card names the capabilities of the agent as OAuth scopes, and the token endpoint of your organization as the place to get a token.
  • Turn off Publish at the well-known location and run the script again. The first request gets 404, because a card is public only while the switch is on.
  • In the portal, open Audit logs under Security. The refused card is an entry with the event a2a.card_verify_failed.

Limits​

  • A card describes how to authenticate. It is not a credential, and publishing it gives nobody access.
  • LumoAuth publishes a card only for an active agent that has an A2A endpoint.
  • The verification endpoint accepts the token of an agent or of a signed-in user of the organization. It checks the card with the keys of your organization. For a card from another issuer, send {"card": {...}, "jwks_uri": "https://..."} with the address of the key set of that issuer.
  • Both public addresses are cached for 5 minutes and have a rate limit for each client address.
  • LumoAuth does not run the A2A endpoint. Your agent answers at that address.