Skip to Content
AgentShield
Fundamentals

Agent Identity

How an agent is identified by an Ed25519 key pair, what AgentShield stores, and how the gateway resolves an agent on every request.

An agent in AgentShield is a machine principal: an autonomous process that holds an Ed25519 private key and proves its identity by signing every request. The identity is not a name, an API key, or a claim in a request body. It is the key that verifies the signature.

What an agent is

An agent is registered in one organization by a human with the owner, admin, or operator role. Registration stores:

FieldDescription
idUUID assigned by the control plane. Sent in X-AgentShield-Agent-Id
organization_idThe tenant. It cannot change after registration; a trigger rejects the update
nameUnique within the organization, 1–128 characters
frameworkOne of langchain, langgraph, crewai, openai_agents, python, typescript, mcp, custom. Informational
statusactive, suspended, or revoked
CredentialThe 32-byte Ed25519 public key and its lowercase SHA-256 fingerprint

The framework field labels the agent in the console. It does not change how the gateway treats requests.

Keys stay with the agent

The agent operator generates the key pair. Only the public half is ever sent to AgentShield:

import secrets
from pathlib import Path

from agentshield_sdk import public_key

seed = secrets.token_bytes(32)          # the private key material
Path("agent.seed").write_bytes(seed)    # store it like any other secret
print(public_key(seed))                 # 43-char base64url, safe to register

There is no column for private key material anywhere in the schema. The SDK clients keep the seed in memory, use it only to sign, and never transmit it. The repository's repr() and toString() of a client omit the seed.

Treat the seed as a credential

Anyone with the 32-byte seed can sign as the agent until the key is rotated or the agent is revoked. Store it in a secret manager or a file readable only by the agent's service account.

How the gateway resolves an agent

On each request the gateway:

  1. Reads the agent id from X-AgentShield-Agent-Id and checks it is a UUID.
  2. Loads the agent's organization, status, and credentials. In production this goes through the agentshield_lookup_agent SECURITY DEFINER function so the app role does not need cross-organization read access.
  3. Selects the credential to verify with. Exactly one credential must be active and inside its not_before/not_after window. If none is active, the most recent one is used so the request can still be attributed and denied with a precise reason. More than one active credential is treated as an internal error, never as a choice.
  4. Verifies the signature against that public key. See Request signing.

An unknown agent id and a bad signature return the same 401 authentication failed, so the response does not reveal which agent ids exist.

Identity is not authority

After the signature verifies, the gateway knows who is calling. It still has to decide whether the call is allowed:

  • The agent_id inside the signed body must equal the authenticated agent, or the request is denied.
  • The organization_id inside the body is a claim. If it differs from the agent's stored organization, the request is denied.
  • The agent and its credential must be active. A suspended or revoked agent is denied with the reason agent is suspended or agent is revoked.

These denies are recorded and audited like policy denies, because they describe an authenticated principal attempting something it may not do.

One identity per trust domain

An agent's permissions come from the organization policy and its own agent policy. When two workloads need different permissions, register them as separate agents with separate keys. For example, give each CrewAI crew or each LangGraph deployment its own agent and policy rather than sharing a seed.

Was this page helpful?

On this page