Documentation

Agent Name Service support

The Agent Name Service (ANS) is a separate system that says who an agent is. An agent registered in ANS has a name of the form ans://v1.0.0.agent.example.com and an Identity Certificate that holds a P-256 public key.

Countersign says what an agent was allowed to do. It can use an agent's ANS name and certificate in three ways. This page calls them the three joins.

ANS support is optional. It is off for every workspace until its owner turns it on. You do not need it to use anything else in these docs.

Turn it on

Each workspace has its own switch.

In the console: open Settings, find Agent Name Service, and choose On.

From the command line:

countersign ans on
countersign ans off
countersign ans status
Agent Name Service support is on for this workspace.
  certificates: no ANS authority is configured on this engine, so chains are not checked
  counterparty lookups: transparency.example.org

The two lines under the status tell you what the engine you are using can check. Read them before you rely on either check. They are explained under "What the engine must be told to trust" below.

While the switch is off:

  • the ANS field does not appear on the console's new-agent form
  • the ANS fields do not appear in the rule builder
  • binding a passport to an ANS identity is refused
  • no counterparty is looked up, so policy sees every counterparty as unchecked

Turning it off later leaves passports that are already bound working, and they can still be amended.

The switch is a workspace preference. It is not a ledger entry and it is not signed.

Join 1: a passport bound to the ANS name

A passport can carry the agent's ANS name and its Identity Certificate. Both are inside what the owner signs. Every receipt under that passport then points at an identity that others can look up.

countersign agent add --name billing --ans-cert identity.pem
ANS name   ans://v1.0.0.billing.example.com
ANS cert   SHA256:6f1c...
signs with its own Countersign key (the link to the ANS name is your signature on this passport)

In the console, the New agent form has a field named Agent Name Service identity. Paste the certificate in PEM form. The console reads it and shows the name it carries, its fingerprint and whether it chains to an authority the engine trusts.

Rules the engine applies:

  • The certificate must carry exactly one ANS name, and the name on the passport must be that name.
  • A passport cannot outlive its certificate. The CLI and the console shorten the passport's expiry to the certificate's when needed.
  • A passport that a machine issues for itself in a fleet rollout cannot claim an ANS identity.

With this join alone, the agent still signs with its own Countersign key. The link between that key and the ANS name is the owner's word, given by signing the passport.

Join 2: the ANS key as the agent's key

Add --ans-key and the agent signs its asks with the key ANS certified. No second key is made.

countersign agent add --name billing --ans-cert identity.pem --ans-key identity-key.pem

The engine accepts a P-256 agent key only when it is the key inside the passport's certificate. Signatures are ECDSA P-256 over SHA-256, with the signature written as R followed by S.

The agent's credential then holds the path of the key file in place of a key:

{
  "name": "billing",
  "server": "https://app.trycountersign.ai",
  "tenant": "tn_...",
  "mandate_id": "md_...",
  "ans_key_file": "/etc/agent/identity-key.pem"
}

In the console, the tick box "The agent signs with its ANS identity key" does the same. The console never sees the private key. It gives you a credential with a placeholder path. Set ans_key_file to where the key lives on the agent's machine.

The CLI, the hook, the MCP gateway and both SDKs sign this way when the credential has ans_key_file. The SDKs also accept the key itself as ans_key.

A rule can require it:

{
  "id": "named-only",
  "effect": "deny",
  "when": "action.tool == 'payments.send' && !mandate.ans_key",
  "reason": "only agents signing with their ANS key may pay"
}

mandate.ans_key is true when the agent signs with its ANS identity key. mandate.ans_name, mandate.ans_host and mandate.ans_version hold the name and its parts.

Join 3: the counterparty's standing as a policy input

When an action names another agent, the engine can look that agent up in ANS and record what it finds beside the decision. Rules read the result as peer.

How the engine finds the counterparty

It takes the first of these that the ask carries:

  1. the fact peer, as a host name, a URL or an ANS name
  2. the fact url, which web actions from the hook carry
  3. the target, when it is a URL or an ANS name

From an SDK, name the counterparty in attrs:

agent.guard('agent.call', body, fn, { attrs: { peer: 'ans://v1.0.0.supplier.example.com' } })

What the lookup does

  1. It reads the host's _ans-badge DNS record.
  2. It refuses any badge address that is not on a Transparency Log the engine trusts.
  3. It fetches the badge from that log and reads the registration's status.
  4. It records the status with the decision, under the engine's signature. The offline verifier re-runs the policy on the same recorded value.

A lookup happens only when all of these hold: the workspace has ANS on, the engine has a trusted log configured, the active policy reads peer, and the ask names a host.

What rules can read

NameMeaning
peer.statusOne of the values below.
peer.liveTrue when the status is active, warning or deprecated.
peer.registeredTrue when the host is in ANS at all: live, expired or revoked.
peer.hostThe host that was looked up.
peer.ans_nameThe ANS name on the badge.
peer.logThe Transparency Log the badge came from.
peer.statusMeaning
activeRegistered and in good standing.
warningRegistered. The certificate is close to expiry.
deprecatedRegistered. Marked for retirement.
expiredThe registration has expired.
revokedThe registration was revoked.
noneThe host publishes no ANS record.
untrustedThe host points at a log this engine does not trust.
unknownThe lookup could not be completed.
uncheckedThe action names no host, or no lookup was made.

Example rules, from the product's tests:

{
  "id": "revoked-peer",
  "effect": "deny",
  "when": "peer.status == 'revoked' || peer.status == 'expired'",
  "reason": "counterparty registration is not valid"
}
{
  "id": "unregistered-peer",
  "effect": "escalate",
  "when": "action.tool == 'agent.call' && !peer.live",
  "reason": "counterparty is not a live ANS agent"
}

A failed lookup does not fail the ask. It gives unknown, and your rules decide what to do with that. !peer.live is true for unknown, unchecked, none and untrusted, so a rule written that way holds or blocks when the engine could not confirm the counterparty.

In the console, the rule builder offers "the counterparty's ANS status" as a field, and the tester has a status picker so you can try a rule without a real lookup.

What the engine must be told to trust

These are set on the engine by whoever runs it. They are not workspace settings.

COUNTERSIGN_ANS_ROOTS=ca-bundle.pem       # ANS authorities: certificates must chain to one
COUNTERSIGN_ANS_LOGS=log.example.org      # Transparency Log hosts whose badges are believed
COUNTERSIGN_ANS_DNS=10.0.0.2:53           # optional: ask this DNS server instead of the system's

COUNTERSIGN_ANS_LOGS takes a comma-separated list of hosts.

  • Without COUNTERSIGN_ANS_ROOTS, a passport's ANS claim rests on the owner's signature alone. The console and the CLI show the passport as "chain unchecked". With it set, a passport whose certificate does not chain to one of the authorities is refused.
  • Without COUNTERSIGN_ANS_LOGS, nothing is looked up and peer.status is unchecked.

countersign ans status and the console's Settings page show which of the two the engine has. GET /v1/info shows the same.

Checking ANS bindings offline

countersign verify pack.cbor --ans-roots ca-bundle.pem

verify lists every passport bound to an ANS identity. With --ans-roots it also checks each certificate against the authority bundle, as of the time the binding was recorded. A failed chain makes verify exit with status 1. Without --ans-roots each binding is printed as chain NOT CHECKED.

Limits

  • The lookup is the badge tier. The log's answer is trusted over TLS. The log's Merkle proof and signature are not verified by the engine. The stronger tier is not built.
  • An answer is reused for one minute. A revocation can go unnoticed for that long.
  • The engine does not see the connection the agent makes afterwards. Pinning the counterparty's server certificate to its badge stays with the caller.
  • A passport is not re-checked after it is issued. If the agent's own ANS registration is revoked, revoke the passport yourself.
  • It needs configuration to mean anything. See the section above. An engine with no authority bundle accepts any well-formed certificate on the owner's word.
  • Status alone does not judge an agent's conduct. A registered, active agent can still be one you should not deal with. ANS status says the registration is in good standing and nothing more.
  • Testing. The joins were tested against the open-source ANS reference stack: its Registration Authority, its Transparency Log and its development DNS server. The counterparty lookup has also been run against a production Transparency Log. A passport holding a production-issued identity certificate has not been tested. The reference stack issues a slightly different certificate shape from the written specification, and both shapes are accepted. Production certificates may differ again.
  • The browser verifier does not check certificate chains. Use countersign verify --ans-roots.

For trying this locally, go run ./cmd/ans-testcert in the repository makes a throwaway authority and identity.