Skip to content

Configuration

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

  1. AGENTFOX_<KEY> in the environment.
  2. The [agentfox] table of the file named by AGENTFOX_CONFIG, or of ./agentfox.toml in the working directory.
  3. 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 variableDefaultWhat it does
database_url
AGENTFOX_DATABASE_URL
sqlite:///<state dir>/agentfox.dbWhere 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
falseLog every SQL statement. For debugging only.
evidence_dir
AGENTFOX_EVIDENCE_DIR
<state dir>/var/evidenceWhere agentfox report evidence writes packages.
org_id
AGENTFOX_ORG_ID
org_defaultThe organisation (tenant) records belong to when no token says otherwise.
environment
AGENTFOX_ENVIRONMENT
developmentdevelopment, 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 packsA 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 packsA directory to read the shipped policy files from instead of the built-in capability packs.
pack_maturity
AGENTFOX_PACK_MATURITY
stableWhich capability packs load: stable, incubating (stable and incubating) or sandbox (all). See agentfox policy packs list --all.

Authentication and secrets

Key and variableDefaultWhat it does
auth_mode
AGENTFOX_AUTH_MODE
autoauto 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-secretShared 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.
token_encryption_key
AGENTFOX_TOKEN_ENCRYPTION_KEY
unsetFernet key that encrypts every secret stored at rest: GitHub tokens, source credentials, alert URLs, probe auth headers, agent signing keys. Unset: those features fail closed.
token_encryption_key_previous
AGENTFOX_TOKEN_ENCRYPTION_KEY_PREVIOUS
unsetRetired 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
unsetBearer secret for /api/internal/jobs/run. Unset: the route refuses every call. CRON_SECRET is also read.
playground_cors_origin
AGENTFOX_PLAYGROUND_CORS_ORIGIN
unsetComma-separated browser origins allowed to call the public playground, added to localhost.
trusted_proxy_hops
AGENTFOX_TRUSTED_PROXY_HOPS
1 on Vercel, else 0Proxies 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
10000000The largest request body the gateway reads, in bytes. A larger one is refused with 413 before it is buffered. 0 for no limit.
anonymous_inline_per_minute
AGENTFOX_ANONYMOUS_INLINE_PER_MINUTE
0Inline 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.
onboarding_key_ttl_days
AGENTFOX_ONBOARDING_KEY_TTL_DAYS
30How 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 variableDefaultWhat it does
default_policy_mode
AGENTFOX_DEFAULT_POLICY_MODE
observeThe 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
openWhat 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
sessionsession: 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.
enforcement_budget_ms
AGENTFOX_ENFORCEMENT_BUDGET_MS
300Latency ceiling for the whole pre-flight pipeline on one surface.
detector_timeout_ms
AGENTFOX_DETECTOR_TIMEOUT_MS
40Default per-detector budget.
request_budget_ms
AGENTFOX_REQUEST_BUDGET_MS
350Ceiling across every surface one governed call touches. Kept above enforcement_budget_ms.
long_text_chars
AGENTFOX_LONG_TEXT_CHARS
200Past 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
1000Budget 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
nativenative, 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:8181The OPA sidecar, when policy_engine is opa.
streaming_mode
AGENTFOX_STREAMING_MODE
bufferedbuffered 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.
stream_window_chars
AGENTFOX_STREAM_WINDOW_CHARS
200Window size for windowed streaming.
approval_ttl_minutes
AGENTFOX_APPROVAL_TTL_MINUTES
30How long a held call waits for a person before it is denied.

Detectors

Key and variableDefaultWhat it does
enabled_detectors
AGENTFOX_ENABLED_DETECTORS
["injection.heuristic", "pii.native", "secrets.native", "safety.lexicon", "schema.json"]Which detectors run. A listed detector whose extra or weights are missing is unavailable and does not run.
accept_restricted_model_licenses
AGENTFOX_ACCEPT_RESTRICTED_MODEL_LICENSES
falseRequired (1/true) before a Meta model loads: safety.restricted (Llama Guard) or Prompt Guard 2 as injection.classifier. Their licences are not OSI-approved.
prompt_injection_classifier_model
AGENTFOX_PROMPT_INJECTION_CLASSIFIER_MODEL
leolee99/PIGuardPrimary 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.
prompt_injection_classifier_threshold
AGENTFOX_PROMPT_INJECTION_CLASSIFIER_THRESHOLD
(the model's own)Score a label must reach. Unset uses the model's published default: 0.5 for PIGuard and protectai, 0.9 for Prompt Guard 2 (LlamaFirewall's).
prompt_injection_classifier_secondary_model
AGENTFOX_PROMPT_INJECTION_CLASSIFIER_SECONDARY_MODEL
protectai/deberta-v3-base-prompt-injection-v2Backstop model consulted only when the primary finds nothing. Empty disables it.
prompt_injection_classifier_secondary_threshold
AGENTFOX_PROMPT_INJECTION_CLASSIFIER_SECONDARY_THRESHOLD
0.92The backstop's score bar.
embedding_similarity_model
AGENTFOX_EMBEDDING_SIMILARITY_MODEL
sentence-transformers/all-MiniLM-L6-v2Embedding model for injection.similarity.
embedding_similarity_attack_threshold
AGENTFOX_EMBEDDING_SIMILARITY_ATTACK_THRESHOLD
0.6Cosine similarity to the nearest known attack before injection.similarity fires.
embedding_similarity_benign_margin
AGENTFOX_EMBEDDING_SIMILARITY_BENIGN_MARGIN
0.05How far above the nearest benign example that similarity must be.
granite_guardian_model
AGENTFOX_GRANITE_GUARDIAN_MODEL
ibm-granite/granite-guardian-3.0-2bModel for safety.granite.
llama_guard_model
AGENTFOX_LLAMA_GUARD_MODEL
meta-llama/Llama-Guard-3-8BModel for safety.restricted: meta-llama/Llama-Guard-3-8B or -1B (gated). Llama Guard 4 is not supported yet.
nemo_rails_config_path
AGENTFOX_NEMO_RAILS_CONFIG_PATH
unsetA NeMo Guardrails config directory. rails.nemo is unavailable until this is set (rails extra).
guardrails_ai_validators
AGENTFOX_GUARDRAILS_AI_VALIDATORS
[]Guardrails AI Hub validator slugs for rails.guardrails_ai (validators extra). Each must be installed separately.
prompt_injection_classifier_secondary_inline
AGENTFOX_PROMPT_INJECTION_CLASSIFIER_SECONDARY_INLINE
falseRun the classifier's advisory backstop model inline. Off: it runs after the response and its hit is recorded on the same trace.
classifier_cache_size
AGENTFOX_CLASSIFIER_CACHE_SIZE
4096Classifier scores kept per model, by hash of the text. 0 turns the cache off.
grounding_nli_model
AGENTFOX_GROUNDING_NLI_MODEL
cross-encoder/nli-deberta-v3-smallModel for the opt-in grounding.nli detector. Read from the local cache only.
model_server_url
AGENTFOX_MODEL_SERVER_URL
unsetSend model-backed detectors to an agentfox serve models process at this URL, under the same budgets. Unset: they run in this process.
model_server_token
AGENTFOX_MODEL_SERVER_TOKEN
unsetBearer token shared with the model server. It refuses to listen beyond loopback without one.
model_server_detectors
AGENTFOX_MODEL_SERVER_DETECTORS
[]Which detectors go to the model server. Empty: every model-backed one.
model_device
AGENTFOX_MODEL_DEVICE
autoWhere a model runs in this process: cpu, cuda, mps, or auto (cuda, then mps, then cpu).

Judgment tiers and egress

Key and variableDefaultWhat it does
allow_egress
AGENTFOX_ALLOW_EGRESS
falseMaster 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
locallocal 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.
judgment_redact_before_egress
AGENTFOX_JUDGMENT_REDACT_BEFORE_EGRESS
trueRedact locally detected personal data before a judgment leaves.
judgment_fail_closed
AGENTFOX_JUDGMENT_FAIL_CLOSED
falseDeny 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
redactblock, redact or allow: what to do when a payload bound for a hosted tier contains personal data. Only block guarantees none leaves.
judgment_llm_provider
AGENTFOX_JUDGMENT_LLM_PROVIDER
""Provider for the llm and local_llm tiers. Empty uses default_provider.
judgment_llm_model
AGENTFOX_JUDGMENT_LLM_MODEL
""Model for those tiers. Empty uses the provider's default.
judgment_llm_timeout_s
AGENTFOX_JUDGMENT_LLM_TIMEOUT_S
4.0Seconds one LLM judge call may take before it is abandoned.
judgment_inline
AGENTFOX_JUDGMENT_INLINE
when_reliedwhen_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 variableDefaultWhat it does
default_provider
AGENTFOX_DEFAULT_PROVIDER
echoecho is the offline provider: deterministic, no key, no network. Others: openai, anthropic, azure, bedrock, vertex, litellm.
openai_api_key
AGENTFOX_OPENAI_API_KEY
unsetKey for the openai provider (gateway proxy and judgment tiers).
openai_base_url
AGENTFOX_OPENAI_BASE_URL
https://api.openai.comOpenAI-compatible endpoint.
anthropic_api_key
AGENTFOX_ANTHROPIC_API_KEY
unsetKey for the anthropic provider.
anthropic_base_url
AGENTFOX_ANTHROPIC_BASE_URL
https://api.anthropic.comAnthropic endpoint.
azure_openai_endpoint
AGENTFOX_AZURE_OPENAI_ENDPOINT
unsetAzure OpenAI resource endpoint.
azure_openai_api_key
AGENTFOX_AZURE_OPENAI_API_KEY
unsetAzure OpenAI key.
azure_openai_api_version
AGENTFOX_AZURE_OPENAI_API_VERSION
2024-10-21Azure OpenAI API version.
azure_openai_deployment
AGENTFOX_AZURE_OPENAI_DEPLOYMENT
unsetAzure OpenAI deployment name.
aws_region
AGENTFOX_AWS_REGION
unsetRegion for Bedrock (bedrock extra).
bedrock_model
AGENTFOX_BEDROCK_MODEL
anthropic.claude-sonnet-4-20250514-v1:0Bedrock model id.
vertex_project
AGENTFOX_VERTEX_PROJECT
unsetGoogle Cloud project for Vertex (vertex extra).
vertex_location
AGENTFOX_VERTEX_LOCATION
us-central1Vertex region.
vertex_model
AGENTFOX_VERTEX_MODEL
gemini-2.0-flashVertex model.
litellm_base_url
AGENTFOX_LITELLM_BASE_URL
unsetA LiteLLM proxy to route through. On loopback it counts as local and does not egress.
litellm_api_key
AGENTFOX_LITELLM_API_KEY
unsetKey for that proxy.

Budgets, loops and reliability

Key and variableDefaultWhat it does
loop_max_steps
AGENTFOX_LOOP_MAX_STEPS
25Most steps one run may take before loop.runaway blocks it.
loop_max_repeats
AGENTFOX_LOOP_MAX_REPEATS
2Identical re-issued calls tolerated.
loop_max_cycle_length
AGENTFOX_LOOP_MAX_CYCLE_LENGTH
4Longest alternating cycle detected.
loop_max_steps_without_progress
AGENTFOX_LOOP_MAX_STEPS_WITHOUT_PROGRESS
5Steps that produce no new observation before the run counts as stuck.
fallback_chain
AGENTFOX_FALLBACK_CHAIN
[]Model degradation ladder, preferred first. Empty means fail rather than serve from a model the agent was not evaluated on.
breaker_failure_threshold
AGENTFOX_BREAKER_FAILURE_THRESHOLD
5Provider failures before the circuit breaker opens.
breaker_recovery_seconds
AGENTFOX_BREAKER_RECOVERY_SECONDS
30.0How long it stays open.
admission_rate_per_second
AGENTFOX_ADMISSION_RATE_PER_SECOND
200.0Admission control on /v1/*: sustained rate.
admission_burst
AGENTFOX_ADMISSION_BURST
400Burst allowance.
admission_max_concurrent
AGENTFOX_ADMISSION_MAX_CONCURRENT
256Concurrent requests admitted.
admission_shed_below_priority
AGENTFOX_ADMISSION_SHED_BELOW_PRIORITY
normalUnder saturation, work below this priority is shed first.
service_probe_interval_seconds
AGENTFOX_SERVICE_PROBE_INTERVAL_SECONDS
5.0How long a dependency health probe is reused. Status endpoints always probe fresh.
verified_state_max_age_seconds
AGENTFOX_VERIFIED_STATE_MAX_AGE_SECONDS
300How fresh a state read must be to authorise an irreversible act.
data_access_strictness
AGENTFOX_DATA_ACCESS_STRICTNESS
standardstandard escalates a query on an undeclared table; strict blocks it.
sql_dialect
AGENTFOX_SQL_DIALECT
postgresDialect SQL artefacts are parsed in (sql extra). A wrong parse fails closed.
memory_unverified_ttl_seconds
AGENTFOX_MEMORY_UNVERIFIED_TTL_SECONDS
86400How long an unverified memory entry survives before it decays.
agent_message_validity_seconds
AGENTFOX_AGENT_MESSAGE_VALIDITY_SECONDS
300Oldest an inter-agent message signature may be and still verify.
degraded_warn_ratio
AGENTFOX_DEGRADED_WARN_RATIO
0.05Share of checks in the window answered without a selected detector above which the gateway logs a warning and /api/health reports unhealthy. Per process.
degraded_window_seconds
AGENTFOX_DEGRADED_WINDOW_SECONDS
60The sliding window for degraded_warn_ratio.
degraded_warn_min_checks
AGENTFOX_DEGRADED_WARN_MIN_CHECKS
20Fewer checks than this in the window never warn.
agent_breaker_mode
AGENTFOX_AGENT_BREAKER_MODE
alertPer-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.
agent_breaker_window_seconds
AGENTFOX_AGENT_BREAKER_WINDOW_SECONDS
300Window the breaker counts blocked decisions over.
agent_breaker_min_calls
AGENTFOX_AGENT_BREAKER_MIN_CALLS
20Decisions needed in the window before it can trip.
agent_breaker_block_ratio
AGENTFOX_AGENT_BREAKER_BLOCK_RATIO
0.5Share of blocked decisions that trips it.
agent_breaker_cooldown_seconds
AGENTFOX_AGENT_BREAKER_COOLDOWN_SECONDS
300How long a paused agent stays paused before probing.
agent_breaker_probe_calls
AGENTFOX_AGENT_BREAKER_PROBE_CALLS
5Calls let through to test recovery.

Entitlement

Key and variableDefaultWhat it does
entitlement_engine
AGENTFOX_ENTITLEMENT_ENGINE
nativenative, or openfga. The OpenFGA adapter is a declared seam, not an implementation yet.
openfga_url
AGENTFOX_OPENFGA_URL
unsetOpenFGA endpoint.
openfga_store_id
AGENTFOX_OPENFGA_STORE_ID
unsetOpenFGA store.
k_anonymity_threshold
AGENTFOX_K_ANONYMITY_THRESHOLD
5Smallest group an aggregate answer may describe.

Audit and evidence

Key and variableDefaultWhat it does
audit_signing_key
AGENTFOX_AUDIT_SIGNING_KEY
dev-insecure-checkpoint-keySigns audit-chain checkpoints. Keep it outside the database. Outside development the gateway refuses to start while it is the published default.
audit_signing_key_previous
AGENTFOX_AUDIT_SIGNING_KEY_PREVIOUS
unsetRetired 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.
audit_checkpoint_interval
AGENTFOX_AUDIT_CHECKPOINT_INTERVAL
100Chain entries between signed checkpoints.
redact_at_capture
AGENTFOX_REDACT_AT_CAPTURE
trueRedact detected sensitive values before they are written to the audit log.

Improvement loop and scheduler

Key and variableDefaultWhat it does
improvement_frozen
AGENTFOX_IMPROVEMENT_FROZEN
falseKill switch for the improvement loop: nothing is applied automatically; proposals are still filed.
improvement_actor_id
AGENTFOX_IMPROVEMENT_ACTOR_ID
agentfox-improverThe identity automated changes are recorded under.
improvement_max_auto_changes_per_day
AGENTFOX_IMPROVEMENT_MAX_AUTO_CHANGES_PER_DAY
20Cap on automated applies per tenant per day.
improvement_rollback_budget
AGENTFOX_IMPROVEMENT_ROLLBACK_BUDGET
0.05A change class rolled back more often than this drops an autonomy level.
canary_min_dwell_seconds
AGENTFOX_CANARY_MIN_DWELL_SECONDS
3600Minimum time a canaried change runs before it can be settled.
canary_max_block_rate_drop
AGENTFOX_CANARY_MAX_BLOCK_RATE_DROP
0.15How much less the candidate may block before the canary rolls it back.
scheduler_enabled
AGENTFOX_SCHEDULER_ENABLED
trueWhether scheduled jobs are queued.
monitor_batch_limit
AGENTFOX_MONITOR_BATCH_LIMIT
5AgentFox Enterprise (monitoring). Most due monitors one monitors.run job runs; the rest wait for the next runner call.
monitor_failure_threshold
AGENTFOX_MONITOR_FAILURE_THRESHOLD
3AgentFox Enterprise (monitoring). Failed runs in a row before a monitor raises a monitor_failing finding.
job_stuck_after_seconds
AGENTFOX_JOB_STUCK_AFTER_SECONDS
900A running job older than this counts as crashed and is recovered.
job_backoff_base_seconds
AGENTFOX_JOB_BACKOFF_BASE_SECONDS
60Base of the exponential retry delay.
live_probes_enabled
AGENTFOX_LIVE_PROBES_ENABLED
trueKill switch for scheduled probes against deployed agents. Each target also needs its own recorded opt-in.
showcase_enabled
AGENTFOX_SHOWCASE_ENABLED
falseProbe the demo support agent in its own tenant every hour and publish the counts at GET /api/public/showcase.
showcase_org_id
AGENTFOX_SHOWCASE_ORG_ID
org_showcaseThe tenant the showcase lives in. The public endpoint reads nothing else.
jobs_on_traffic
AGENTFOX_JOBS_ON_TRAFFIC
trueAlso run due jobs off ordinary traffic, at most every 10 minutes per instance, for hosts whose cron runs once a day.

Evaluation

Key and variableDefaultWhat it does
eval_runner
AGENTFOX_EVAL_RUNNER
nativenative, or promptfoo.
promptfoo_bin
AGENTFOX_PROMPTFOO_BIN
promptfooThe promptfoo executable.
online_eval_sample_rate
AGENTFOX_ONLINE_EVAL_SAMPLE_RATE
0.25Share of production traffic agentfox test online samples.
drift_psi_threshold
AGENTFOX_DRIFT_PSI_THRESHOLD
0.2Population stability index above which agentfox report drift reports drift.

Integrations: webhooks and trace correlation

Key and variableDefaultWhat it does
webhook_url
AGENTFOX_WEBHOOK_URL
unsetEach new finding at or above webhook_min_severity is POSTed here. Needs allow_egress.
webhook_secret
AGENTFOX_WEBHOOK_SECRET
unsetAdds X-AgentFox-Signature: sha256=<HMAC of the body>.
webhook_timeout_seconds
AGENTFOX_WEBHOOK_TIMEOUT_SECONDS
3.0Per-delivery timeout; one retry on 5xx or timeout.
webhook_min_severity
AGENTFOX_WEBHOOK_MIN_SEVERITY
highcritical, high, medium or low.
slack_webhook_url
AGENTFOX_SLACK_WEBHOOK_URL
unsetAgentFox 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).
slack_min_severity
AGENTFOX_SLACK_MIN_SEVERITY
mediumcritical, high, medium or low.
github_webhook_secret
AGENTFOX_GITHUB_WEBHOOK_SECRET
unsetVerifies X-Hub-Signature-256 on /api/integrations/github/webhook. A connection may carry its own instead; with neither, push deliveries are refused.
correlation_push
AGENTFOX_CORRELATION_PUSH
falseWrite the verdict back onto the LangSmith or Langfuse run. Correlation itself needs no setting.
correlation_timeout_seconds
AGENTFOX_CORRELATION_TIMEOUT_SECONDS
2.0Timeout for that write-back.
langsmith_api_key
AGENTFOX_LANGSMITH_API_KEY
unsetLangSmith key for write-back.
langsmith_project
AGENTFOX_LANGSMITH_PROJECT
unsetLangSmith project.
langsmith_api_url
AGENTFOX_LANGSMITH_API_URL
https://api.smith.langchain.comLangSmith API.
langsmith_ui_url
AGENTFOX_LANGSMITH_UI_URL
https://smith.langchain.comLangSmith UI, for links.
langfuse_public_key
AGENTFOX_LANGFUSE_PUBLIC_KEY
unsetLangfuse public key.
langfuse_secret_key
AGENTFOX_LANGFUSE_SECRET_KEY
unsetLangfuse secret key.
langfuse_project
AGENTFOX_LANGFUSE_PROJECT
unsetLangfuse project.
langfuse_host
AGENTFOX_LANGFUSE_HOST
https://cloud.langfuse.comLangfuse host.
outbound_allow_private_hosts
AGENTFOX_OUTBOUND_ALLOW_PRIVATE_HOSTS
falseLet 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:

PartWhat it is
Eventsfinding.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-Signaturesha256= and the hex HMAC-SHA256 of the raw body, keyed with webhook_secret. Verify before parsing; compare in constant time.
X-AgentFox-EventThe event name.
X-AgentFox-DeliveryA delivery id. A retry reuses it with the same body and signature: de-duplicate on it.
X-AgentFox-TimestampUnix seconds. Not signed: check freshness with sent_at, which the signature covers.
RetriesOne 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.
QueueA 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.

ParameterDefaultValues
formatjsonljsonl, cef (ArcSight), leef (QRadar), otlp (OTLP/JSON log records)
since_days7How far back.
limit1000Applied to decisions and to findings separately.

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 headerWhat it does
X-AgentFox-AgentThe agent slug. Without it, no grant or agent-scoped policy applies.
X-AgentFox-SessionTies calls into one conversation; turns on loop checks (loop_* settings).
X-AgentFox-IntentThe declared task.
X-AgentFox-TrustJSON map of message index to source, e.g. {"1":"retrieved"}.
X-AgentFox-EnvironmentDefault production.
X-AgentFox-ProviderWhich 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-Modebuffered or windowed for this request (below).
X-AgentFox-PriorityAdmission priority when shedding load (default normal).
X-AgentFox-ApprovalAn approved apr_… id: the held request runs once.
X-AgentFox-Tool-Hook1 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.
Authorization: Bearer nom_agt_…Optional agent key.
Response headerMeaning
x-agentfox-verdict, x-agentfox-applied-verdictWhat happened to this request. Gate on this.
x-agentfox-effective-verdict, x-agentfox-would-be-verdictWhat the policy asks for; differs only in observe.
x-agentfox-modeobserve or enforce.
x-agentfox-trace, x-agentfox-decisionIds to look the decision up by.
x-agentfox-latency-msTime spent in governance.
x-agentfox-explainLink to the trace in the app, when console_url is set.
x-agentfox-degradedA dependency was unavailable while serving the request.
StatusMeaning
200Allowed; content may have been redacted or tokenised.
428Held for a person (agentfox_approval_required, with approval_id and poll). Retry with X-AgentFox-Approval once approved.
403Blocked (agentfox_policy_violation). Do not retry.
429Load shed before governance ran (agentfox_admission_shed). Retry after Retry-After.
503A 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_modeBehaviour
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.
windowedChunks 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

VariableCompose valueWhy it differs from the default
AGENTFOX_DATABASE_URLthe bundled PostgresMulti-worker servers refuse SQLite.
AGENTFOX_ENVIRONMENTproductionTokens required; the development audit key is refused.
AGENTFOX_ENFORCEMENT_BUDGET_MS, AGENTFOX_DETECTOR_TIMEOUT_MS100, 40Raise both to run a slow model such as safety.granite on CPU.
AGENTFOX_ENABLED_DETECTORSthe defaults plus injection.similarityIts weights are in the image.
AGENTFOX_POLICY_ENGINE, AGENTFOX_OPA_URLnative, http://opa:8181Set opa to use the sidecar; it falls back to native when unreachable.
AGENTFOX_EVIDENCE_DIR/var/agentfox/evidenceA volume, so evidence packages survive a restart.
AGENTFOX_AUDIT_SIGNING_KEY, AGENTFOX_SERVICE_AUTH_SECRETrequiredCompose refuses to start without them (openssl rand -hex 32).
AGENTFOX_ACCEPT_RESTRICTED_MODEL_LICENSES"0"Below.

Licence-gated models (Llama Guard, Prompt Guard 2)

The published image never carries gated weights. To run safety.restricted (Llama Guard 3) or Prompt Guard 2:

  1. Accept Meta's licence for the model on Hugging Face.
  2. 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.
  3. 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.
  4. 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.

VariableWhat it does
AGENTFOX_STATE_DIRDirectory for the default database and evidence. It decides the defaults of database_url and evidence_dir, so it is not itself a setting.
AGENTFOX_CONFIGPath to the TOML file to read. It must exist. none, off or - turns file loading off.
AGENTFOX_AGENTAgent 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_KEYYour 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_LOCAL1 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_SOCKETPath 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_USERWithout an API key, the identity agentfox scan --submit sends to a development deployment.
AGENTFOX_RUN_DIRWhere small runtime records go (which agentfox serve is running, which warnings were already shown). Default: run/ under the state directory.
AGENTFOX_AUDIT_KEYThen AGENTFOX_AUDIT_SIGNING_KEY. Read by the verify_chain.py inside an evidence package to check checkpoint signatures.
AGENTFOX_MCP_LOG_LEVELLog level of agentfox serve mcp. Default WARNING.
CRON_SECRETAccepted in addition to cron_secret by /api/internal/jobs/run (Vercel Cron sets it).
JEV_API_KEYKey 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.

VariableDefaultWhat it does
AGENTFOX_API_URLhttp://127.0.0.1:8080The gateway the dashboard calls, server to server. Include the scheme.
AGENTFOX_API_TOKENunsetA static operator token for the dashboard's own calls. A signed-in user's token takes precedence.
AGENTFOX_USERadmin@example.comThe development identity header value, used when there is no token. A gateway outside development refuses it.
AGENTFOX_PLAYGROUND_API_URLAGENTFOX_API_URLThe gateway address the visitor's browser uses on the public playground page.
AGENTFOX_SERVICE_AUTH_SECRETunsetMust equal the gateway's service_auth_secret, or GitHub sign-in fails at provisioning.
AGENTFOX_SITE_URLthe public siteCanonical URL used in page metadata.
AGENTFOX_SELF_HOSTEDunsetMarks a self-hosted dashboard in the interface.
GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRETunsetThe 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_SECRETunsetA 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_SECRETunsetA 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.