-
Notifications
You must be signed in to change notification settings - Fork 0
CLI Reference
The a1-cli crate provides the a1 command-line tool for issuing passports, managing delegation certs, revoking access, and running migrations.
cargo install a1-cliOr run from source (from the repo root):
cargo install --path a1-cliGenerate an Ed25519 keypair.
a1 keygen --out key.jsonOutput: key.json containing the public key hex and private key seed hex.
Issue a new root passport for an AI agent.
a1 passport issue \
--namespace my-trading-bot \
--allow "trade.equity,portfolio.read" \
--ttl 30d \
--out my-trading-bot-passport.json| Flag | Description |
|---|---|
--namespace |
Unique identifier for the agent (e.g. trading-bot) |
--allow |
Comma-separated capability names |
--ttl |
Duration: 1h, 30d, 1y, or raw seconds |
--out |
Output path for the passport JSON file |
--key |
Optional: path to an existing key file (generates new keypair if omitted) |
Output files:
-
<namespace>-passport.json— the passport (share with agents) -
<namespace>-key.hex— the 32-byte signing key seed (store in your vault, never commit to Git)
Inspect a passport file.
a1 passport inspect my-trading-bot-passport.jsonOutput:
Passport: my-trading-bot-passport.json
Namespace : my-trading-bot
Capability mask : a3b2c1d4...
Scope root : 7f9c4e2a...
Holder public key: 4a1b2c3d...
Cert issued_at : 1746547200 (2025-05-06 12:00:00 UTC)
Cert expires_at : 1749139200 (2025-06-05 12:00:00 UTC)
Status : VALID
Issue a scoped sub-delegation cert from a passport.
a1 passport sub \
--passport my-trading-bot-passport.json \
--key my-trading-bot-key.hex \
--allow trade.equity \
--ttl 1h \
--agent-pk 4a1b2c3d...| Flag | Description |
|---|---|
--passport |
Path to the root passport file |
--key |
Path to the passport's signing key |
--allow |
Capabilities to delegate (must be subset of passport) |
--ttl |
TTL for the sub-cert |
--agent-pk |
Hex public key of the delegatee agent |
--out |
Output path for the cert JSON |
Issue a delegation cert via the gateway (admin).
a1 issue \
--namespace trading-bot \
--allow trade.equity \
--ttl 3600 \
--agent-pk 4a1b2c3d... \
--gateway http://localhost:8080 \
--secret $A1_ADMIN_SECRETRevoke a cert by fingerprint. Takes effect immediately.
a1 revoke a3b2c1d4e5f6...Optional flags:
-
--store redis://localhost:6379— Redis RevocationStore URL -
--gateway http://localhost:8080— revoke via gateway instead
Revoke multiple certs in one operation.
a1 revoke-batch a3b2c1... d4e5f6... 7a8b9c...Check revocation status of a cert by fingerprint.
a1 inspect a3b2c1d4e5f6...Output:
Fingerprint: a3b2c1d4e5f6...
Status : VALID
Revoked : false
Verify a VerifiedToken HMAC receipt.
a1 verify receipt.tokenPrint all fields of a cert file for debugging.
a1 decode cert.jsonOutput: full cert JSON with decoded timestamps, key hex, capability mask, and SubScopeProof.
Apply a YAML policy file to the gateway.
a1 policy -f policy.yaml --gateway http://localhost:8080 --secret $A1_ADMIN_SECRETExample policy.yaml:
rules:
- name: max-ttl-trade
capability: trade.equity
max_ttl_seconds: 3600
- name: min-depth-trade
capability: trade.equity
min_chain_depth: 2
- name: allowed-namespaces
namespaces:
- trading-prod
- trading-stagingRun Postgres schema migration.
a1 migrate --pg-url postgres://a1:password@localhost/a1dbCreates the nonces and revocations tables if they don't exist.
Generate shell completions.
a1 completion bash >> ~/.bashrc
a1 completion zsh >> ~/.zshrc
a1 completion fish > ~/.config/fish/completions/a1.fish
a1 completion powershell >> $PROFILE# 1. Start the gateway
cd A1 && ./setup.sh
# 2. Issue a passport for your agent
a1 passport issue \
--namespace my-agent \
--allow "trade.equity,portfolio.read" \
--ttl 30d
# 3. Connect your agent — paste the namespace and key path into Studio
open http://localhost:8080/studioa1 passport issue \
--namespace my-agent \
--allow "trade.equity,portfolio.read" \
--ttl 30d \
--key my-agent-key.hex \
--out my-agent-passport.json# Revoke immediately — no confirmation needed
a1 revoke <compromised-cert-fingerprint>
# Verify it's revoked
a1 inspect <compromised-cert-fingerprint>
# Status: REVOKEDSource: a1-cli/src/ · Back to wiki home