How It Works
Agent Control uses a two-tier API key model:| Key type | Environment variable | What it can do |
|---|---|---|
| Regular | AGENT_CONTROL_API_KEYS | Register agents, evaluate controls, read controls and agents |
| Admin | AGENT_CONTROL_ADMIN_API_KEYS | Everything above plus create/update/delete controls and manage agent-control associations |
/health endpoint is always public and requires no authentication.
Step-by-Step Setup
Start the server with authentication enabled
Pass the authentication environment variables when starting the server:
Pass the API key from the SDK
The SDK reads the
AGENT_CONTROL_API_KEY environment variable by default, or you can pass it explicitly:Use an admin key for control management
Operations that modify controls or agent-control associations require an admin key. This keeps your control plane locked down even if a runtime key is compromised.
Key Rotation
Agent Control accepts multiple comma-separated keys per variable, making zero-downtime rotation straightforward:- Add the new key alongside the old one:
AGENT_CONTROL_API_KEYS="old-key,new-key" - Redeploy the server
- Update all clients to use the new key
- Remove the old key:
AGENT_CONTROL_API_KEYS="new-key" - Redeploy again
Troubleshooting
401 Unauthorized — check these in order:- Authentication is enabled (
AGENT_CONTROL_API_KEY_ENABLED=true) - Your key is present in the correct variable (
AGENT_CONTROL_API_KEYSfor regular,AGENT_CONTROL_ADMIN_API_KEYSfor admin operations) - The
X-API-Keyheader (or SDKapi_keyargument) matches exactly — no trailing whitespace or quotes