Configuration
Every control-plane setting is an environment variable with the AGENTIC_AUTH_ prefix, read
from the environment or from a .env file in the working directory. Unknown variables are
ignored. The sidecar and gateway have their own config files, covered in
Deploy the sidecar PEP and
Deploy the gateway PEP.
The later controls are off by default. With step-up, cold start, consent granularity, required identity and telemetry all off, you get manifest-driven authorization, token exchange, transaction tokens, taint enforcement and the audit chain, and nothing else.
Core
| Variable | Default | Notes |
|---|---|---|
AGENTIC_AUTH_DATABASE_URL | postgresql+asyncpg://app:app@localhost:5432/agentic_auth | PostgreSQL 16 |
AGENTIC_AUTH_REDIS_URL | redis://localhost:6379/0 | Sessions, replay guards, decision cache |
AGENTIC_AUTH_ADMIN_TOKEN | dev-admin-token | Full-trust bearer for every control-plane write. Replace it before any shared deployment. |
AGENTIC_AUTH_DISCOVERY_TIMEOUT_SECONDS | 5.0 | RFC 9728 capability discovery during reconciliation |
Token issuance
| Variable | Default | Notes |
|---|---|---|
AGENTIC_AUTH_ISSUER | agentic-auth | The iss on every token the control plane issues |
AGENTIC_AUTH_ISSUER_PRIVATE_KEY | empty | Ed25519 private key, PEM. Empty generates an ephemeral key at startup: every token stops verifying on restart, and two replicas won't agree. Development only. |
AGENTIC_AUTH_ISSUER_KID | empty | Key id in the JWKS and each token header. Empty uses the key's thumbprint. |
AGENTIC_AUTH_HOP_TOKEN_TTL_SECONDS | 60 | Lifetime of one hop token |
AGENTIC_AUTH_SESSION_TTL_SECONDS | 1800 | How long a session pins its policy version. Sized to one piece of agent work, not a user login. |
AGENTIC_AUTH_DECISION_CACHE_TTL_SECONDS | 30 | The policy version is part of the cache key, so a session never reads another version's decision |
Generate an issuer key with openssl genpkey -algorithm ED25519 -out issuer-key.pem.
Audit and metrics
| Variable | Default | Notes |
|---|---|---|
AGENTIC_AUTH_AUDIT_READ_TOKEN | empty | Read-only bearer for /v1/audit/* and the identity routes verifiers bootstrap from. Give auditors and resource servers this, not the admin token. Empty disables it. |
AGENTIC_AUTH_AUDIT_WRITE_TIMEOUT_SECONDS | 1.0 | An allowed call whose audit record can't commit in time is refused with AUDIT_UNAVAILABLE, never dispatched without a record |
AGENTIC_AUTH_METRICS_ENABLED | true | Prometheus at /metrics. Internal networks only; labels carry no identities. |
Transaction tokens and taint
| Variable | Default | Notes |
|---|---|---|
AGENTIC_AUTH_TRANSACTION_TOKENS_ENABLED | true | Privileged calls need a call-bound transaction token. false makes POST /v1/token/transaction return 404. |
AGENTIC_AUTH_TRANSACTION_TOKEN_TTL_SECONDS | 30 | One privileged call, minted right before it |
AGENTIC_AUTH_MAX_PRIVILEGED_BODY_BYTES | 1048576 | Largest parameter body bound into a transaction token. Larger is refused, never forwarded unbound. |
AGENTIC_AUTH_TAINT_ENFORCEMENT_ENABLED | true | Return TAINTED_INTO_PRIVILEGED. false still derives and records taint, so you can tune before enforcing. |
Identity
| Variable | Default | Notes |
|---|---|---|
AGENTIC_AUTH_IDENTITY_REQUIRED | false | Every exchange needs proof of possession from an enrolled agent; others are denied AGENT_NOT_ENROLLED. Enroll every agent before turning this on. |
AGENTIC_AUTH_ENROLL_TOKEN | empty | Bearer that may begin and complete enrollment. Empty disables it; the admin token always works. |
AGENTIC_AUTH_ENROLL_CHALLENGE_TTL_SECONDS | 120 | How long an enrollment challenge stays valid |
AGENTIC_AUTH_PRINCIPAL_IDP_ISSUER | empty | Your human IdP's issuer, for principal binding |
AGENTIC_AUTH_PRINCIPAL_IDP_JWKS_URL | empty | Its JWKS endpoint |
AGENTIC_AUTH_PRINCIPAL_IDP_AUDIENCE | empty | The audience its ID tokens carry for this control plane. Leave the three IdP settings empty and every enrollment completes as quarantined (PRINCIPAL_IDP_NOT_CONFIGURED). |
AGENTIC_AUTH_PRINCIPAL_BINDING_CLAIM | agent | The ID-token claim that must equal agent://<name> |
AGENTIC_AUTH_PRINCIPAL_IDP_ALGORITHMS | RS256,ES256,EdDSA | Signing algorithms accepted on any token from your human IdP: enrollment, step-up and verified consent. none and HS* are refused at startup. Applies with every setting off from 0.4.0; before it, the token's own header chose. Set it if your IdP signs with another algorithm, such as PS256. |
AGENTIC_AUTH_REVOCATION_FRESHNESS_SECONDS | 30 | How long an offline verifier may go without refreshing revocations before it refuses every identity as stale |
Step-up and cold start
Each is independent and off by default.
| Variable | Default | Notes |
|---|---|---|
AGENTIC_AUTH_CONSENT_GRANULARITY_ENABLED | false | A session may consent to a subset of its policy's data classes. Off, the consented set is the declared set, and data_classes on consent is rejected. |
AGENTIC_AUTH_STEP_UP_ENABLED | false | A recoverable deny carries a step-up challenge, and /v1/consent/step-up* are served. Requires consent granularity: the process refuses to start without it. |
AGENTIC_AUTH_STEP_UP_CHALLENGE_TTL_SECONDS | 300 | How long a challenge may go unanswered. It can be answered once. |
AGENTIC_AUTH_SANDBOX_ENABLED | false | Serve /v1/agents/{id}/sandbox* and the proposal routes. Off, they return 404. |
AGENTIC_AUTH_SANDBOX_RUN_DEADLINE_SECONDS | 300 | Default length of an observation run |
MCP OAuth 2.1 (0.4.0)
Standard MCP clients sign in at your IdP and call through the connector proxy or gateway. Each setting is off by default; turn them on one at a time. The proxy and gateway side is in the next section. How it fits together: How an MCP client's login becomes per-hop authority.
| Variable | Default | Notes |
|---|---|---|
AGENTIC_AUTH_VERIFIED_CONSENT_ENABLED | false | Consent requires the user's IdP token as subject_token, verifies it against the principal IdP, and roots the session at issuer#subject, recorded as verified. An asserted user_sub alone is refused. Needs PRINCIPAL_IDP_ISSUER, PRINCIPAL_IDP_JWKS_URL and CONSENT_IDP_AUDIENCES, or the process refuses to start. |
AGENTIC_AUTH_CONSENT_IDP_AUDIENCES | empty | Comma-separated audiences a subject_token may carry: this control plane's identifier, and the resource URL of every proxy or gateway that relays tokens to consent |
AGENTIC_AUTH_CONSENT_TOKEN | empty | Bearer that may call POST /v1/consent and nothing else. Give it, never the admin token, to a proxy or gateway. Empty disables it. |
AGENTIC_AUTH_CLIENT_MAPPING_ENABLED | false | Serve /v1/agents/{id}/clients, and run each session in the scope of the agent its client maps to. An unmapped client is refused with CLIENT_NOT_AUTHORIZED. Requires verified consent. |
AGENTIC_AUTH_AS_METADATA_ENABLED | false | Serve authorization server metadata, and check each MCP server's authorization server at registration. Requires ISSUER to be an https URL, which changes iss in new tokens. |
Enforcement points
| Variable | Default | Notes |
|---|---|---|
AGENTIC_AUTH_GATEWAY_DECISION_DEADLINE_MS | 2000 | Past this the gateway refuses the call, never retries it. Matches the sidecar's control-plane timeout. |
AGENTIC_AUTH_DEFAULT_GUARANTEE_LEVEL | full | The guarantee_level recorded when an enforcement point predates that field. Every such caller decided per hop, so full is accurate. |
As an OAuth protected resource
Set on each connector proxy (agentic-auth-boundary mcp-proxy) or gateway, with the
AGENTIC_AUTH_GATEWAY_ prefix. Available from 0.4.0.
| Variable | Default | Notes |
|---|---|---|
AGENTIC_AUTH_GATEWAY_OAUTH_RESOURCE_ENABLED | false | Publish Protected Resource Metadata, challenge with 401, validate the IdP token locally and start sessions through consent. Refused together with observe mode. |
AGENTIC_AUTH_GATEWAY_RESOURCE_URL | empty | Required. This proxy's public https URL: the resource in its metadata, and the audience inbound tokens must carry. http://localhost only with AGENTIC_AUTH_DEV=true. |
AGENTIC_AUTH_GATEWAY_IDP_ISSUER | empty | Required. Your IdP's issuer, named as the authorization server |
AGENTIC_AUTH_GATEWAY_IDP_JWKS_URL | empty | Overrides the jwks_uri from the IdP's discovery document. The keys are fetched before serving; if they cannot be, the process does not start. |
AGENTIC_AUTH_GATEWAY_IDP_ALGORITHMS | RS256,ES256,EdDSA | Accepted signing algorithms. none and HS* are refused at startup |
AGENTIC_AUTH_GATEWAY_CLOCK_LEEWAY_SECONDS | 60 | Tolerated clock skew, at most 300 |
AGENTIC_AUTH_GATEWAY_CONSENT_TOKEN | empty | Required. The control plane's CONSENT_TOKEN |
AGENTIC_AUTH_GATEWAY_CONSENT_SCOPE | empty | The scope to start sessions in. Leave empty when client mapping chooses it |
AGENTIC_AUTH_GATEWAY_ASSERTED_ROOT_SCOPE | empty | Only for a control plane with verified consent off. Sessions are rooted in an asserted subject and say so. A step on the way to verified consent, not a place to stay |
AGENTIC_AUTH_GATEWAY_SESSION_CACHE_SIZE | 10000 | Sessions kept in memory, one per IdP token, until the earlier of the token's and the session's expiry |
A connector proxy route may also set relay_authorization: an operator credential sent
upstream on relayed methods such as initialize and tools/list. From 0.4.0 the client's own
Authorization, Cookie and Proxy-Authorization headers are never relayed, with every
setting off.
There is deliberately no control-plane observe mode. The PDP always decides and records
honestly; observe mode belongs to each enforcement point (observe_mode in a sidecar or
gateway config), the only component that knows whether it will act on a deny.
Telemetry
Off by default, and the OpenTelemetry SDK is never imported while it's off. Install with
pip install 'authzai[otel]'. Where telemetry goes is set with the standard OTEL_*
variables. Metrics stay on /metrics.
| Variable | Default | Notes |
|---|---|---|
AGENTIC_AUTH_TELEMETRY_ENABLED | false | |
AGENTIC_AUTH_TELEMETRY_KEY | empty | Required when telemetry is on. Keys the pseudonyms in traces and logs. Empty, the exporter refuses to start and logs once, and the process still serves traffic. There is no plaintext fallback. Generate one with openssl rand -hex 32. |
AGENTIC_AUTH_TELEMETRY_IDENTITY_DISCLOSURE | false | Export real agent names instead of pseudonyms. Its state is exported too, so you can alert on it. Metric labels never carry identities either way. |
AGENTIC_AUTH_TELEMETRY_ALLOW_SAMPLE_RATIO | 1.0 | Fraction of allow spans kept. Refusals are always exported. |
With more than one worker, set PROMETHEUS_MULTIPROC_DIR to an empty writable directory so
/metrics aggregates across them.