Skip to main content

CLI: agentic-auth identity

Agent keys, the enrollment handshake by hand, and revocation. These commands do what AgentKey and AgenticAuthClient.enroll / revoke do in Python, for a shell script or for an agent that isn't written in Python. Install with pip install 'authzai[drift]'.

identity keygen --out FILE​

Generates an Ed25519 agent key, writes it to FILE as a PKCS8 PEM with mode 0600, and prints its public JWK. The private key stays where the agent runs.

agentic-auth identity keygen --out balance-agent.pem

identity identity-document --key FILE --agent NAME [--principal-assertion TOKEN]​

Prints {"identity_doc": ...}, the body for POST /v1/agents/{agent_id}/enroll. --principal-assertion is the owner's ID token from your IdP, naming the agent in its binding claim. Leave it out and the enrollment completes as quarantined.

identity sign-challenge --key FILE --agent NAME --challenge FILE [--aud AUDIENCE]​

Signs an enrollment challenge. --challenge is the JSON body POST .../enroll returned. The command prints a compact JWS, the signed_response for POST .../enroll/complete. --aud defaults to agentic-auth.

The whole handshake by hand:

agentic-auth identity identity-document --key balance-agent.pem --agent balance-agent \
--principal-assertion "$ID_TOKEN" > doc.json
curl -s -X POST "$CP/v1/agents/$AGENT_ID/enroll" -H "Authorization: Bearer $ENROLL_TOKEN" \
-H 'Content-Type: application/json' -d @doc.json > challenge.json
SIGNED=$(agentic-auth identity sign-challenge --key balance-agent.pem --agent balance-agent \
--challenge challenge.json)
curl -s -X POST "$CP/v1/agents/$AGENT_ID/enroll/complete" -H "Authorization: Bearer $ENROLL_TOKEN" \
-H 'Content-Type: application/json' \
-d "{\"challenge_id\": \"$(jq -r .challenge_id challenge.json)\", \"signed_response\": \"$SIGNED\"}"

identity revoke AGENT_ID [--base-url URL] [--admin-token TOKEN] [--reason TEXT]​

Revokes the agent's trust anchor. --base-url defaults to http://localhost:8000. --admin-token defaults to AGENTIC_AUTH_ADMIN_TOKEN; prefer the environment variable, so the token doesn't land in shell history. Revoking an agent that is already revoked is not an error.