Register a new agent
Agents
Register agent
Register a new agent with a name and hash proof. Optionally attach an alignment card and policy.
POST
Register a new agent
Use this when
You need to pre-register an agent before its first gateway call — most commonly to attach an alignment card or policy on creation. For interactive use, the auto-create on first gateway call path is simpler and produces an equivalent agent.hash_proof
Thehash_proof field is the SHA-256 hex digest proving you own the provider API key the agent will be addressed by. Compute it locally:
agents.agent_hash). The provider key (apiKey) is your Anthropic / OpenAI / Gemini key, not your mnm_* Mnemom key — the gateway’s per-request lookup uses the same formula on the provider key sent as x-api-key / Authorization: Bearer / x-goog-api-key.
The same apiKey you used here must be the one you send on every gateway call against this agent. Any mismatch makes the agent unaddressable from the gateway. See Agent Identity.
Optional fields
card_json— a unified alignment card to attach on creation. The composer validates and writes the canonical row in the same transaction.policy_yaml— deprecated. Policy (capabilities+enforcementsections) is now embedded in the alignment card. Pass it insidecard_jsoninstead.
Auth + idempotency
- Authenticated: send a Bearer JWT (
mnemom logintoken, or staging-issued Supabase access token) or anmnm_*API key. The handler claims and links the new agent to your principal in the same call — no separate claim or link step. - Idempotent on
agent_hash: re-POSTing the samehash_proofreturns409 Conflictwith the existing agent reachable viaGET /v1/agents.
Legacy claim + link
The pre-CRUD flow registered an unauthenticated agent and required two follow-up calls to bind it to your account:POST /v1/agents/{id}/claim (with hash_proof proving key ownership) and POST /v1/agents/{id}/link (with a Bearer JWT). Both endpoints remain for backward compatibility with agents that pre-date POST /v1/agents. New code should not use them.
Example
Authorizations
Supabase JWT token in Authorization: Bearer header
Body
application/json
Agent name. 2-32 characters, alphanumeric and hyphens only, must start and end with alphanumeric.
Required string length:
2 - 32Pattern:
^[a-zA-Z0-9][a-zA-Z0-9-]{0,30}[a-zA-Z0-9]$Example:
"my-agent"
SHA256 hex string used to derive the agent ID and hash.
Minimum string length:
16Example:
"a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2"
Optional alignment card JSON to attach on creation.
Optional YAML policy string to create alongside the agent.
Response
Agent registered successfully