Every autonomous agent that calls tools, browses the web, or delegates to sub-agents needs a cryptographic identity. Without it, you cannot answer the incident-response question: “Which agent did this?” In a multi-agent system where five agents share a single API key, “an agent did it” is not accountability.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/microsoft/agent-governance-toolkit/llms.txt
Use this file to discover all available pages before exploring further.
AgentIdentity gives every agent a unique did:mesh: decentralised identifier backed by an Ed25519 key pair. Credentials are signed with the private key and can be verified by any peer with only the public key. Delegation chains enforce scope narrowing — a child agent’s capabilities can only be a strict subset of its parent’s, and the chain depth is bounded to prevent Sybil attacks.
Import
AgentDID
AgentDID represents a decentralised identifier in the did:mesh: method.
Always
"mesh" for AgentMesh DIDs.128-bit (32 hex character) cryptographically random unique identifier. The previous 8-byte construction was replaced with 128 bits to prevent brute-force guessing.
AgentIdentity Fields
AgentIdentity is a Pydantic BaseModel with the following public fields.
The agent’s decentralised identifier.
Human-readable agent name. Must not be empty.
Optional free-text description of the agent’s purpose.
Base64-encoded Ed25519 public key (32 bytes raw, ~44 characters base64).
Key identifier in the format
key-{sha256_prefix}. Referenced in the DID document’s verificationMethod array.Human sponsor email address. Every agent must be accountable to a human. Must contain
@.Whether the sponsor’s identity has been verified by the AgentMesh CA.
Optional organization name.
Optional organization identifier.
List of capability strings this agent is authorised to exercise (e.g.
"read:data", "write:crm", "*" for wildcard). Delegation can only narrow this list, never expand it.UTC timestamp when the identity was created.
UTC timestamp of the last status change (revocation, suspension, or reactivation).
Optional identity expiration time.
is_active() returns False after this time.Identity lifecycle status:
"active", "suspended", or "revoked".Reason for revocation or suspension, when applicable.
DID string of the parent agent, when this identity was created via
delegate(). Must match did:mesh: format.Depth in the delegation chain (0 = root agent). Must be ≥ 0. The class constant
MAX_DELEGATION_DEPTH = 10 is the hard ceiling.Lineage-bound trust cap: the child’s initial trust score cannot exceed this value (Invariant 6 — Sybil resistance). Set by the parent during
delegate().Methods
AgentIdentity.create() — Factory
did:mesh: DID, and returns a fully initialized identity. The private key is stored in memory on the returned object and never serialized.
Human-readable agent name. Must not be empty.
Sponsor email address (accountability contact). Must contain
@.Initial capability list.
None → empty list (no capabilities).Optional organization name.
Optional description.
sign() — Sign data with private key
data with the agent’s Ed25519 private key. Returns the signature as a base64-encoded string.
Raw bytes to sign.
ValueError if the private key is not available (e.g., for identities loaded from a serialized form without the private key).
verify_signature() — Verify a signature
signature against data using the agent’s Ed25519 public key. Returns True if valid, False otherwise. Verification failures are logged at DEBUG level only — using WARNING would enable log flooding by adversarial peers.
The original bytes that were signed.
Base64-encoded Ed25519 signature.
delegate() — Create a child agent
AgentIdentity with narrowed capabilities. Enforces two security invariants:
- V01 — Maximum delegation depth (
MAX_DELEGATION_DEPTH = 10). Prevents unbounded chain growth. - V02 — Wildcard capability
"*"cannot be delegated. Capabilities must be explicitly listed. - Child capabilities must be a subset of the parent’s capabilities.
Name for the child agent.
Capabilities to delegate. Each must appear in the parent’s
capabilities list. Cannot include "*".Optional description for the child agent.
Upper bound on the child’s initial trust score (Sybil resistance). Typically set to the parent’s current trust score.
ValueError if capabilities are not a subset of the parent’s, the chain depth exceeds MAX_DELEGATION_DEPTH, or a wildcard is present in capabilities.
revoke() / suspend() / reactivate()
revoke() sets status = "revoked" (permanent). suspend() sets status = "suspended" (temporary). reactivate() raises ValueError if called on a revoked identity, or if the identity was suspended for security reasons without override_reason=True.
is_active() — Liveness check
True only if status == "active" and the identity has not passed expires_at.
has_capability() — Capability check
True if capability appears in capabilities, or if a wildcard "*" is present, or if a prefix-wildcard matches (e.g. "read:*" matches "read:data").
verify_delegation_chain() — Chain validation
parent_did chain, checking at each level that:
- The parent exists in
registry(if supplied). - The child’s capabilities are a subset of the parent’s.
- Delegation depth is consistent.
- No circular references exist.
True when the chain is valid. When registry is None, only the leaf identity’s structural consistency is validated.
to_did_document() — W3C DID Document export
.well-known/did.json endpoint.
JWK / JWKS Export and Import
IdentityRegistry
IdentityRegistry is an in-memory store for AgentIdentity objects. In production it would be backed by a database and the AgentMesh CA; the in-memory version is suitable for testing and single-process deployments.
When
True, register() rejects identities that lack a verified attestation. Used in production environments where the CA must sign off on every registration.Trust Tiers
Trust scores run from 0 to 1000. Thetrust_level_for_score() helper converts a numeric score to a canonical label.
| Score Range | Label | Meaning |
|---|---|---|
| 900–1000 | verified_partner | Highest tier — fully attested, long operational history |
| 700–899 | trusted | Solid track record, no violations |
| 500–699 | standard | New or neutral agents (default starting score) |
| 300–499 | probationary | Recent violations or new agent under observation |
| 0–299 | untrusted | High risk — blocked from sensitive resources |
agentmesh.constants:
Complete Example: Identity Creation and Delegation Chain
See Also
- govern() — policy enforcement wrapper
- PolicyEvaluator — evaluate YAML policies
- AuditLogger — governance audit trail
- AgentMesh Identity & Trust Specification