Every setting AgentFox reads: its environment variable, its agentfox.toml key, its default, and what it changes. Then the integration formats (webhooks, OTLP, SIEM, metrics) and the gateway's headers. The defaults are offline: no egress, the echo provider, and detector packs in observe.
How a setting is resolved
AGENTFOX_<KEY> in the environment.
The [agentfox] table of the file named by AGENTFOX_CONFIG, or of ./agentfox.toml in the working directory.
The default in the tables below.
The key in the file is the setting name: taint_scope = "argument" in the file is AGENTFOX_TAINT_SCOPE=argument in the environment. Lists are TOML arrays in the file and JSON in the environment. Unknown keys are ignored with a warning naming them. Values are validated, and some (taint_scope, webhook_min_severity) stop startup on a typo rather than falling back. Settings are read once per process.
bash
export AGENTFOX_FAIL_MODE=closed
export AGENTFOX_ENABLED_DETECTORS='["pii.native","secrets.native"]'
python -c "from agentfox.core.config import Settings as S; s = S(); print(s.fail_mode, s.enabled_detectors)"
Output
closed ['pii.native', 'secrets.native']
Database, state and deployment
Key and variable
Default
What it does
database_url AGENTFOX_DATABASE_URL
sqlite:///<state dir>/agentfox.db
Where everything is stored. SQLite by default; postgresql+psycopg://… with the postgres extra. A multi-worker server refuses SQLite at startup.
sql_echo AGENTFOX_SQL_ECHO
false
Log every SQL statement. For debugging only.
evidence_dir AGENTFOX_EVIDENCE_DIR
<state dir>/var/evidence
Where agentfox report evidence writes packages.
org_id AGENTFOX_ORG_ID
org_default
The organisation (tenant) records belong to when no token says otherwise.
environment AGENTFOX_ENVIRONMENT
development
development, staging, production, … Decides whether the development identity header is accepted when auth_mode is auto; anything not recognised as development counts as production.
console_url AGENTFOX_CONSOLE_URL
""
Your dashboard's address, used to turn a decision id in a refusal into a link. Never guessed; empty omits the link.
compliance_dir AGENTFOX_COMPLIANCE_DIR
unset: the compliance packs
A directory to read controls.yaml, obligations.yaml and threats.yaml from instead of the capability packs. Set only to load your own catalog.
policies_dir AGENTFOX_POLICIES_DIR
unset: the built-in packs
A directory to read the shipped policy files from instead of the built-in capability packs.
pack_maturity AGENTFOX_PACK_MATURITY
stable
Which capability packs load: stable, incubating (stable and incubating) or sandbox (all). See agentfox policy packs list --all.
Authentication and secrets
Key and variable
Default
What it does
auth_mode AGENTFOX_AUTH_MODE
auto
auto follows environment; development accepts the X-AgentFox-User header; token requires API tokens; oidc is reserved. Check with agentfox admin auth status.
service_auth_secret AGENTFOX_SERVICE_AUTH_SECRET
dev-insecure-service-secret
Shared between the gateway and the dashboard for the GitHub sign-in provisioning call, which mints owner tokens. Must be identical on both. Outside development the gateway refuses to start while it is the published default.
Retired encryption keys, comma-separated. They still decrypt and never encrypt; agentfox admin keys rotate moves everything to the current key, then remove them.
cron_secret AGENTFOX_CRON_SECRET
unset
Bearer secret for /api/internal/jobs/run. Unset: the route refuses every call. CRON_SECRET is also read.
Comma-separated browser origins allowed to call the public playground, added to localhost.
trusted_proxy_hops AGENTFOX_TRUSTED_PROXY_HOPS
1 on Vercel, else 0
Proxies in front of the gateway that append to X-Forwarded-For. The per-visitor limits (playground, waitlist, showcase) read the visitor's address that many entries from the right. 0 ignores the header.
max_request_bytes AGENTFOX_MAX_REQUEST_BYTES
10000000
The largest request body the gateway reads, in bytes. A larger one is refused with 413 before it is buffered. 0 for no limit.
Inline requests per minute per address from a caller with no credential (429 past it). 0 for no limit, the right setting for a self-hosted gateway serving its own unregistered agents; set it on a gateway open to the internet.
How long an older setup key (afi_…) stays valid after it is made. 0: never expires. The key the setup card makes now (nom_api_…, which init writes for your app) never expires: rotate or revoke it.
Policy and enforcement
Key and variable
Default
What it does
default_policy_mode AGENTFOX_DEFAULT_POLICY_MODE
observe
The mode of a policy that does not declare one. Packs that declare a mode keep it: tool-containment declares enforce.
fail_mode AGENTFOX_FAIL_MODE
open
What happens when a detector errors or exceeds its budget: open lets the request through and records the gap; closed refuses.
taint_scope AGENTFOX_TAINT_SCOPE
session
session: a call's provenance is the worst untrusted content in the run so far. argument: only what its own arguments were copied from. Any other value is an error. See Concepts.
Latency ceiling for the whole pre-flight pipeline on one surface.
detector_timeout_ms AGENTFOX_DETECTOR_TIMEOUT_MS
40
Default per-detector budget.
request_budget_ms AGENTFOX_REQUEST_BUDGET_MS
350
Ceiling across every surface one governed call touches. Kept above enforcement_budget_ms.
long_text_chars AGENTFOX_LONG_TEXT_CHARS
200
Past this many characters, the injection classifier's check gets long_text_budget_ms instead of the default budget.
long_text_budget_ms AGENTFOX_LONG_TEXT_BUDGET_MS
1000
Budget for the injection classifier on long text, whose windows take longer to read on a CPU. A ceiling, not a wait.
policy_engine AGENTFOX_POLICY_ENGINE
native
native, or opa to evaluate through an Open Policy Agent sidecar (falls back to native if it is unreachable).
opa_url AGENTFOX_OPA_URL
http://localhost:8181
The OPA sidecar, when policy_engine is opa.
streaming_mode AGENTFOX_STREAMING_MODE
buffered
buffered enforces streamed output exactly like non-streamed, at the cost of first-token latency; windowed forwards as it goes and cannot recall what it already sent.
Required (1/true) before a Meta model loads: safety.restricted (Llama Guard) or Prompt Guard 2 as injection.classifier. Their licences are not OSI-approved.
Primary model for injection.classifier: leolee99/PIGuard, protectai/deberta-v3-base-prompt-injection-v2, or Meta's meta-llama/Llama-Prompt-Guard-2-22M or -86M (gated; needs the licence flag above). Each is read with its own labels, threshold and window.
Which detectors go to the model server. Empty: every model-backed one.
model_device AGENTFOX_MODEL_DEVICE
auto
Where a model runs in this process: cpu, cuda, mps, or auto (cuda, then mps, then cpu).
Judgment tiers and egress
Key and variable
Default
What it does
allow_egress AGENTFOX_ALLOW_EGRESS
false
Master switch for anything leaving the machine: hosted model providers, hosted judgment tiers, webhooks, write-back to LangSmith or Langfuse. Off by default.
judgment_backend AGENTFOX_JUDGMENT_BACKEND
local
local keeps every judgment in-process; remote and auto may call a hosted judgment model, only with allow_egress on.
judgment_tiers AGENTFOX_JUDGMENT_TIERS
["deterministic"]
Evaluators that may be consulted: deterministic (always on), local_model, local_llm, jev, llm. Each tier is forbidden from the decisions it measured worse on.
Deny an enforcing request when an LLM judge does not answer and a rule on that surface relies on it (pipeline.judge_outage). True also stops a workspace turning it off. A payload the egress gate refused is never an outage.
judgment_pii_egress AGENTFOX_JUDGMENT_PII_EGRESS
redact
block, redact or allow: what to do when a payload bound for a hosted tier contains personal data. Only block guarantees none leaves.
Seconds one LLM judge call may take before it is abandoned.
judgment_inline AGENTFOX_JUDGMENT_INLINE
when_relied
when_relied: judges run on the request path only when an enforcing rule on that surface could act on their findings, otherwise after the response. always: inline on every check.
trusted_model_hosts AGENTFOX_TRUSTED_MODEL_HOSTS
[]
Hosts you run that count as inside the deployment (a model server, a vLLM or LiteLLM box). A judgment call to one is local_llm, not egress.
Model providers
Key and variable
Default
What it does
default_provider AGENTFOX_DEFAULT_PROVIDER
echo
echo is the offline provider: deterministic, no key, no network. Others: openai, anthropic, azure, bedrock, vertex, litellm.
openai_api_key AGENTFOX_OPENAI_API_KEY
unset
Key for the openai provider (gateway proxy and judgment tiers).
Oldest an inter-agent message signature may be and still verify.
degraded_warn_ratio AGENTFOX_DEGRADED_WARN_RATIO
0.05
Share of checks in the window answered without a selected detector above which the gateway logs a warning and /api/health reports unhealthy. Per process.
Per-agent circuit breaker: off, alert (raise an issue), or pause (also refuse the agent's calls for the cool-down, then probe). Each agent can override.
Retired signing keys, comma-separated. Checkpoints they signed still verify; agentfox admin keys rotate verifies the chain and re-signs them with the current key, then remove them.
AgentFox Enterprise (monitoring). Slack incoming webhook for monitor findings opened, reopened or closed. Needs allow_egress. A tenant can also set its own (PUT /api/alerts/slack).
Let outbound calls an operator configures (API specs, custom models, probe targets, GitHub) reach loopback and private addresses. Link-local (cloud metadata), multicast and reserved addresses stay refused.
Webhook deliveries
With webhook_url set and allow_egress on, AgentFox POSTs a JSON body for each finding at or above webhook_min_severity:
Part
What it is
Events
finding.created; finding.resolved, finding.suppressed, finding.reopened on a status change; webhook.test from agentfox.core.webhooks.send_test_event().
Body
{"event", "finding", "org_id", "sent_at"}. finding has the fields of GET /api/findings/{id}; it is null for a test.
X-AgentFox-Signature
sha256= and the hex HMAC-SHA256 of the raw body, keyed with webhook_secret. Verify before parsing; compare in constant time.
X-AgentFox-Event
The event name.
X-AgentFox-Delivery
A delivery id. A retry reuses it with the same body and signature: de-duplicate on it.
X-AgentFox-Timestamp
Unix seconds. Not signed: check freshness with sent_at, which the signature covers.
Retries
One retry after half a second on a timeout, connection error or 5xx. A redirect is a failure. Failures are logged and dropped; use the SIEM export to backfill.
Queue
A background thread behind a 1,000-item queue, so delivery never slows the code that raised the finding. Nothing is sent for work that was rolled back.
OpenTelemetry ingest
POST /v1/traces takes an OTLP/HTTP trace export, protobuf (application/x-protobuf, the exporters' default) or JSON, either gzip-compressed. Protobuf needs agentfox[otel]; without it the server answers 415 and JSON still works. Outside development it needs an agent key or an operator token. Each agent a span names goes into the registry, and one nobody registered raises a shadow_agent finding. The agent is agentfox.agent, else service.name, else gen_ai.agent.name. Ingest records spans only: it runs no policy or detectors and keeps no parent-child structure.
AgentFox has no push exporter. GET /api/export/siem?format=otlp returns decisions and findings as OTLP/JSON log records to forward yourself.
SIEM export
GET /api/export/siem returns recent decisions and findings, oldest first, as text/plain. It needs a token when token auth is on.
Findings are governance.finding.<type> events. CEF and LEEF severity runs 0 to 10 (block 8, escalate 6, a critical finding 10). A decision recorded without a trace exports with agent: null.
Prometheus metrics
GET /metrics serves the Prometheus text format with no token; keep it on a private network. Every series is computed from the last 24 hours of records at scrape time, so the _total series go down as records age out: rate() and increase() misread them. Alert on the value, for example agentfox_detector_degraded_total > 0 or agentfox_open_findings{severity="critical"} > 0. Others worth alerting on: agentfox_detector_duration_ms_max, agentfox_missed_escalation_rate, agentfox_circuit_breaker_state (1 is open). Observe-mode decisions carry mode="observe". The per-process agentfox_checks_total and agentfox_checks_degraded_total only go up until restart, so rate() works on those.
Gateway requests
Headers the proxy routes (/v1/chat/completions, /v1/messages) read and return. Routes and bodies are in the HTTP API reference.
Request header
What it does
X-AgentFox-Agent
The agent slug. Without it, no grant or agent-scoped policy applies.
X-AgentFox-Session
Ties calls into one conversation; turns on loop checks (loop_* settings).
X-AgentFox-Intent
The declared task.
X-AgentFox-Trust
JSON map of message index to source, e.g. {"1":"retrieved"}.
X-AgentFox-Environment
Default production.
X-AgentFox-Provider
Which configured provider to forward to (default default_provider). Outside development, naming a provider other than the default needs an agent key or API token.
X-AgentFox-Stream-Mode
buffered or windowed for this request (below).
X-AgentFox-Priority
Admission priority when shedding load (default normal).
X-AgentFox-Approval
An approved apr_… id: the held request runs once.
X-AgentFox-Tool-Hook
1 when a tool hook checks each call again as it runs (the OpenClaw plugin does): an approved tool call in the reply passes unspent, and the hook spends it.
What the policy asks for; differs only in observe.
x-agentfox-mode
observe or enforce.
x-agentfox-trace, x-agentfox-decision
Ids to look the decision up by.
x-agentfox-latency-ms
Time spent in governance.
x-agentfox-explain
Link to the trace in the app, when console_url is set.
x-agentfox-degraded
A dependency was unavailable while serving the request.
Status
Meaning
200
Allowed; content may have been redacted or tokenised.
428
Held for a person (agentfox_approval_required, with approval_id and poll). Retry with X-AgentFox-Approval once approved.
403
Blocked (agentfox_policy_violation). Do not retry.
429
Load shed before governance ran (agentfox_admission_shed). Retry after Retry-After.
503
A dependency is down and fail_mode says refuse (agentfox_service_degraded).
/v1/guard/* answer 200 with a verdict field for every decision; 429 and 503 apply to every /v1 route.
Streaming modes
streaming_mode
Behaviour
buffered (default)
The whole answer is collected and checked before anything is sent. Output checks are identical to a non-streamed call; first-token latency is the cost.
windowed
Chunks are forwarded as they arrive while detectors run over a growing window (stream_window_chars, 200). A block ends the stream but cannot recall what was already sent.
A streamed response sends headers before anything is decided, so it carries x-agentfox-streaming: enforced and an empty trace header; the decision arrives as an {"agentfox": {...}} data frame before [DONE]. A streamed Anthropic reply carries text only: do not stream tool use through /v1/messages. agentfox.auto() checks a stream only once it is exhausted.
What deploy/docker-compose.yml sets
Variable
Compose value
Why it differs from the default
AGENTFOX_DATABASE_URL
the bundled Postgres
Multi-worker servers refuse SQLite.
AGENTFOX_ENVIRONMENT
production
Tokens required; the development audit key is refused.
The published image never carries gated weights. To run safety.restricted (Llama Guard 3) or Prompt Guard 2:
Accept Meta's licence for the model on Hugging Face.
Build the image yourself with that account's token: export HF_TOKEN=hf_…, then docker compose -f deploy/docker-compose.yml build gateway. The token is a BuildKit secret and is not written to a layer. Without it the step is skipped.
The build arg GATED_MODELS (space-separated, default meta-llama/Llama-Guard-3-8B) picks what to bake. Add meta-llama/Llama-Prompt-Guard-2-22M or -86M and set prompt_injection_classifier_model, or use meta-llama/Llama-Guard-3-1B with llama_guard_model.
Add the detector to AGENTFOX_ENABLED_DETECTORS and set AGENTFOX_ACCEPT_RESTRICTED_MODEL_LICENSES=1. The code refuses to load these models without it.
Read outside Settings
A few variables are read straight from the environment, because they decide where settings come from or are used by a separate program. None of them can go in agentfox.toml.
Variable
What it does
AGENTFOX_STATE_DIR
Directory for the default database and evidence. It decides the defaults of database_url and evidence_dir, so it is not itself a setting.
AGENTFOX_CONFIG
Path to the TOML file to read. It must exist. none, off or - turns file loading off.
AGENTFOX_AGENT
Agent slug for agentfox.auto() when none is passed. Then OTEL_SERVICE_NAME, SERVICE_NAME, APP_NAME, K_SERVICE, the script name, and finally default-agent.
AGENTFOX_URL, AGENTFOX_API_KEY
Your account's gateway and API key, read by agentfox.auto(), the SDK, the LiteLLM guardrail and the CLI: agentfox up, scan --submit, and findings, agents list, permit, declare, policy, report and test suites, which then read and write the account. agentfox login saves both in .agentfox/agentfox.env. The older names AGENTFOX_API_URL and AGENTFOX_API_TOKEN are still accepted.
AGENTFOX_LOCAL
1 makes the CLI use this machine's database although an account key is configured: what coding-agent hooks record. An explicit AGENTFOX_DATABASE_URL does the same.
AGENTFOX_SOCKET
Path of the coding-agent hook daemon's socket. Default: run/agentfoxd.sock under the state directory, or a short private path in the system temp directory when that is too long for a Unix socket. Moves only the socket.
AGENTFOX_USER
Without an API key, the identity agentfox scan --submit sends to a development deployment.
AGENTFOX_RUN_DIR
Where small runtime records go (which agentfox serve is running, which warnings were already shown). Default: run/ under the state directory.
AGENTFOX_AUDIT_KEY
Then AGENTFOX_AUDIT_SIGNING_KEY. Read by the verify_chain.py inside an evidence package to check checkpoint signatures.
AGENTFOX_MCP_LOG_LEVEL
Log level of agentfox serve mcp. Default WARNING.
CRON_SECRET
Accepted in addition to cron_secret by /api/internal/jobs/run (Vercel Cron sets it).
JEV_API_KEY
Key for the hosted jev judgment tier. Without it that tier is unavailable.
Dashboard
The web app is a separate Next.js process with its own variables. Each AGENTFOX_ name below falls back to its AGENTFOX_ spelling (for example AGENTFOX_API_URL) when unset. They are read at request time, so one image can point at any gateway.
Variable
Default
What it does
AGENTFOX_API_URL
http://127.0.0.1:8080
The gateway the dashboard calls, server to server. Include the scheme.
AGENTFOX_API_TOKEN
unset
A static operator token for the dashboard's own calls. A signed-in user's token takes precedence.
AGENTFOX_USER
admin@example.com
The development identity header value, used when there is no token. A gateway outside development refuses it.
AGENTFOX_PLAYGROUND_API_URL
AGENTFOX_API_URL
The gateway address the visitor's browser uses on the public playground page.
AGENTFOX_SERVICE_AUTH_SECRET
unset
Must equal the gateway's service_auth_secret, or GitHub sign-in fails at provisioning.
AGENTFOX_SITE_URL
the public site
Canonical URL used in page metadata.
AGENTFOX_SELF_HOSTED
unset
Marks a self-hosted dashboard in the interface.
GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET
unset
The GitHub OAuth app for sign-in. Unset: sign-in is unavailable. A GitHub sign-in token lasts 365 days; signing out revokes it at the gateway.
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET
unset
A Google OAuth client for "Continue with Google". Callback: /api/auth/google/callback. The button shows only when both are set.
MICROSOFT_CLIENT_ID, MICROSOFT_CLIENT_SECRET
unset
A Microsoft Entra app registration (any account type) for "Continue with Microsoft". Callback: /api/auth/microsoft/callback. The button shows only when both are set.
What can go wrong
A hosted provider or webhook does nothing.allow_egress is false. A configured key or URL with egress off sends nothing.
A detector you enabled never fires. Its extra or weights are missing, so it is unavailable and skipped. agentfox doctor lists the available ones.
The development header is refused.environment is not a development name, so auth_mode = auto requires tokens. agentfox admin auth status says which.
GitHub sign-in fails at provisioning.service_auth_secret differs between the gateway and the dashboard.