npx skills add ...
npx skills add better-auth/agent-auth --skill agent-auth-cli
npx skills add better-auth/agent-auth --skill agent-auth-cli
Use the Agent Auth CLI (auth-agent) to discover providers, connect agents, manage capabilities, and execute operations. Use when the user wants to interact with an Agent Auth provider from the terminal, authenticate an agent, execute capabilities, or manage agent connections.
You have access to the auth-agent CLI for interacting with Agent Auth providers. Always prefer using the CLI for any agent authentication operations rather than making raw HTTP requests or writing custom code.
The CLI binary is auth-agent (package: @auth/agent-cli). If not installed globally, run via npx @auth/agent-cli.
Follow this order when working with a provider:
discover fetches the /.well-known/agent-configuration document and caches the provider.search queries the directory and returns matching providers.describe before executing a capability to understand the required input schema and constraints.--agent-id <id> to see which capabilities are granted.agent_id — you need it for all subsequent operations.--no-browser to suppress browser opening.--force-new to create a new connection even if one exists.pending_approval, active, expired, revoked), granted capabilities, and constraints.--args flag takes a JSON string matching the capability's input schema.describe the capability first to know the required arguments.| Flag | Env var | Description |
|---|---|---|
--storage-dir <path> | AGENT_AUTH_STORAGE_DIR | Storage directory (default: ~/.agent-auth) |
--directory-url <url> | AGENT_AUTH_DIRECTORY_URL | Directory URL for provider search |
--host-name <name> | AGENT_AUTH_HOST_NAME | Host name for identification |
--no-browser | AGENT_AUTH_NO_BROWSER=1 | Suppress browser opening for approval URLs |
--url <urls...> | AGENT_AUTH_URLS | Provider URLs to auto-discover at startup |
AGENT_AUTH_ENCRYPTION_KEY in production to encrypt private keys stored in ~/.agent-auth/.Connections, keys, and provider configs are stored in ~/.agent-auth/ by default:
host.json — host identity and keypairagents/<agent-id>.json — agent connectionsproviders/<encoded-issuer>.json — cached provider configurations# Basic connection with specific capabilities
auth-agent connect --provider https://api.example.com \
--capabilities read_data transfer_money \
--name my-agent
# With constraints on capability arguments
auth-agent connect --provider https://api.example.com \
--capabilities read_data transfer_money \
--constraints '{"transfer_money":{"amount":{"max":1000}}}' \
--name constrained-agent
# Autonomous mode (no user association)
auth-agent connect --provider https://api.example.com \
--capabilities read_data \
--mode autonomous
# With CIBA approval (backchannel, sends notification to user)
auth-agent connect --provider https://api.example.com \
--capabilities read_data \
--preferred-method ciba \
--login-hint user@example.comauth-agent status <agent-id>auth-agent execute <agent-id> transfer_money \
--args '{"amount": 50, "to": "alice"}'auth-agent request <agent-id> \
--capabilities admin_panel \
--constraints '{"admin_panel":{"scope":{"in":["read","write"]}}}' \
--reason "Need admin access for deployment"# Disconnect (revoke) an agent
auth-agent disconnect <agent-id>
# Reactivate an expired agent
auth-agent reactivate <agent-id>
# View stored connection details
auth-agent connection <agent-id>
# List all connections for a provider
auth-agent connections <issuer-url># Rotate an agent's keypair
auth-agent rotate-agent-key <agent-id>
# Rotate the host keypair for a provider
auth-agent rotate-host-key <issuer-url>auth-agent enroll-host --provider https://api.example.com --token <enrollment-token> --name "My Device"# Sign an agent JWT (for use with external HTTP calls)
auth-agent sign <agent-id>
# Scope to specific capabilities
auth-agent sign <agent-id> --capabilities transfer_money read_data