Install options
Ways to install, the optional extras, detector weights, where state lives, and how to upgrade or remove AgentFox.
Install
AgentFox needs Python 3.11 or newer. The core install has no model weights and nothing that downloads them.
| How | Command |
|---|---|
| pip, in a virtual environment | pip install agentfox |
| uv, in a project | uv add agentfox |
| As a tool, on the PATH everywhere. Claude Code and Codex hooks call AgentFox by absolute path, so they work from any of these installs; a tool install keeps them working if you delete the virtual environment. | uv tool install agentfox or pipx install agentfox |
| From source, latest commit | pip install "git+https://github.com/architsharm/agentfox.git" |
The package installs one command, agentfox. agentfox --version prints the version.
Then, with an account, run the command from the dashboard's card: pip install -U agentfox and agentfox init --key … --server … (Quickstart). Without one, run agentfox scan and agentfox up (Quickstart without an account).
Extras
Add extras in brackets: pip install "agentfox[pii,sql]". An extra makes a detector available; it runs only once it is also listed in enabled_detectors (Configuration).
| Extra | Installs | Enables |
|---|---|---|
pii | presidio-analyzer, presidio-anonymizer | The pii.presidio detector. Also needs a spaCy model (below). |
classifiers | transformers, torch | injection.classifier (PIGuard with a backstop model, on by default once it can run), injection.similarity (embedding match), safety.granite (Granite Guardian). Each needs its weights. |
sql | sqlglot | SQL blast-radius and data-access analysis. Without it, SQL analysis fails closed rather than passing statements through. |
langgraph | langgraph | The AgentFoxGuard node wrappers in agentfox.frameworks.langgraph. |
openai-agents | openai-agents | The OpenAI Agents SDK adapter. Not in all, because it pulls in the openai client, which changes what auto() patches. |
postgres | psycopg[binary] | A Postgres database_url (postgresql+psycopg://…). |
otel | opentelemetry-api, -sdk, -exporter-otlp-proto-http | OpenTelemetry trace export, and decoding protobuf OTLP on ingest. |
rails | nemoguardrails | The rails.nemo detector, once nemo_rails_config_path points at a NeMo Guardrails config. |
validators | guardrails-ai | rails.guardrails_ai, to run your own Guard. The Guardrails AI validators themselves are built in and need no extra. |
redteam | garak, pyrit | The wrapped Garak and PyRIT runners next to the built-in probes (agentfox test probes lists them). |
bedrock | boto3 | The Amazon Bedrock model provider. |
vertex | google-auth | The Google Vertex model provider. |
prometheus | prometheus-client | Pushing metrics to a Prometheus push gateway. Scraping needs no extra. |
ragas | ragas | Ragas scorers in evaluation suites. |
all | pii, classifiers, rails, validators, redteam, otel, postgres, langgraph, sql | Every permissive extra. Excludes the cloud provider SDKs, openai-agents and restricted-classifiers. |
restricted-classifiers | transformers, torch | safety.restricted (Llama Guard). Non-OSI licence: it also refuses to load unless AGENTFOX_ACCEPT_RESTRICTED_MODEL_LICENSES=1. |
dev | pytest, pytest-asyncio, pytest-xdist, ruff, mypy, import-linter | Working on AgentFox itself. |
Enabled by default: injection.heuristic, injection.classifier, pii.native, secrets.native, safety.lexicon, schema.json, unicode.tags, custom.lists and code.insecure. All but injection.classifier need no extra; without the classifiers extra and its weights, the classifier is skipped and agentfox doctor says so. agentfox.auto() needs no extra: it patches whichever of openai, anthropic, litellm and langchain are installed.
Detector weights
No detector downloads anything while handling a request. A model-backed detector without its weights reports itself unavailable. Fetch weights once, on purpose:
agentfox admin detectors pull injection.classifier
python -m spacy download en_core_web_lg # for pii.presidio, about 400MBThe classifier detectors load from Hugging Face (leolee99/PIGuard, protectai/deberta-v3-base-prompt-injection-v2, sentence-transformers/all-MiniLM-L6-v2, ibm-granite/granite-guardian-3.0-2b); the model names are settings. The gateway Docker image ships with the permissive ones inside. agentfox admin detectors list shows what can run here. Pulling injection.classifier fetches two of them, and says so: PIGuard, which it checks with, and the protectai model, a second opinion asked only when PIGuard finds nothing, whose hits are recorded and never blocked on.
Where state lives
| Situation | Database | Evidence packages |
|---|---|---|
AGENTFOX_STATE_DIR is set | $AGENTFOX_STATE_DIR/agentfox.db | $AGENTFOX_STATE_DIR/var/evidence |
| Installed package (pip, uv) | ~/.agentfox/agentfox.db, or $XDG_DATA_HOME/agentfox/agentfox.db when that is set | ~/.agentfox/var/evidence |
| Source checkout | agentfox.db at the repository root | var/evidence at the repository root |
State is per installation, not per directory: agentfox findings shows the same findings from anywhere. Give each project its own AGENTFOX_STATE_DIR to keep them apart. AGENTFOX_DATABASE_URL and AGENTFOX_EVIDENCE_DIR override the two locations one at a time.
With an account key (AGENTFOX_URL and AGENTFOX_API_KEY, or the .agentfox/agentfox.env that init --key, up and login write), the commands that show what the dashboard shows read and write the account instead, and say so on their first line. An explicit AGENTFOX_DATABASE_URL, or AGENTFOX_LOCAL=1, keeps them on the database.
Postgres
SQLite is fine for one process. For a server or more than one worker, use Postgres with the postgres extra, and create the database with UTF-8 encoding:
pip install "agentfox[postgres]"
export AGENTFOX_DATABASE_URL="postgresql+psycopg://agentfox:PASSWORD@db.internal:5432/agentfox"
agentfox initagentfox init and agentfox.toml
Without --key, agentfox init sets up a local install. It is offline and safe to run twice. To connect to an account without the key showing in ps or your shell history, export it and name the server: export AGENTFOX_API_KEY=… then agentfox init --server <url> (with --server and no --key, init reads AGENTFOX_API_KEY).
agentfox initSetting up AgentFox
✓ database ready sqlite:////…/agentfox.db
✓ 44 controls across 7 frameworks v0.1.0-draft (draft)
✓ 4 policy packs loaded
agent-integrity observe recorded, nothing blocked
baseline observe recorded, nothing blocked
eu-ai-act-high-risk observe recorded, nothing blocked
tool-containment observe recorded, nothing blocked
coding-agent not enabled — no coding-agent hooks in this repo. `agentfox admin hooks install
--agent <slug> --write` turns it on for that agent.
Missing grants, destructive commands and tampering are still refused. When the would-block
decisions look right: `agentfox policy enforce tool-containment`.
✓ wrote agentfox.tomlIt creates and migrates the database, loads the control catalog and the policy packs every one watching (switch one to blocking with agentfox policy enforce <key>; a second run keeps each pack's mode), and writes agentfox.toml in the current directory (or --path, which must be an existing directory). A second run leaves an existing agentfox.toml alone. The fifth pack, coding-agent, applies only once a coding agent has hooks installed (Claude Code and Codex). --demo also loads three demo agents and an eval suite.
The generated file:
[agentfox]
environment = "development"
# Default mode for a policy that does not declare its own. `agentfox init` starts every
# shipped pack in observe; `agentfox policy enforce <key>` starts one blocking.
default_policy_mode = "observe"
# Zero egress: no model call leaves this machine unless you turn it on.
allow_egress = false
# The whole pre-flight pipeline's latency ceiling, in milliseconds.
enforcement_budget_ms = 300
# Where a tool call's provenance is read from, for the taint rules.
# "session" - the worst untrusted content anywhere in the run so far, or in the
# call's own arguments. Contains more; escalates more benign calls.
# "argument" - only what the call's own arguments were copied from.
taint_scope = "session"Settings are read in this order, first match wins:
AGENTFOX_*environment variables.- The
[agentfox]table of$AGENTFOX_CONFIGif set (it must exist), otherwise of./agentfox.toml. - Built-in defaults.
Keys are the setting names without the prefix. An unknown key is ignored with a warning. AGENTFOX_CONFIG=none turns file loading off. Settings are read once per process, so restart after a change. Every key is on Configuration.
Check it: agentfox doctor
agentfox doctor grades the configuration, not the traffic, and changes nothing. ! lines are warnings and ✗ lines are failures. On a fresh install expect warnings for no traffic yet, development authentication, no declared tools, no row scoping, fail-open detectors and no knowledge boundary. agentfox doctor --json prints one record per check and exits non-zero on a failed check, for CI.
Upgrade
pip install -U agentfox
agentfox admin db upgrade
agentfox admin db currentadmin db upgrade applies new migrations and is safe to run when there are none. Run it before restarting a server on new code; agentfox init also migrates. agentfox admin db downgrade can drop columns and data: take a backup first.
Turn it off for a while
Set AGENTFOX_DISABLED=1 in the app's environment and restart it. agentfox.auto() then patches nothing, checks nothing, stores nothing and sends nothing; it prints one line, agentfox: off (AGENTFOX_DISABLED is set), so a switch left on is easy to spot. Unset it to turn AgentFox back on. No code change either way.
- To keep recording but never refuse a call, use
agentfox.auto(mode="observe")instead. - To stop one agent everywhere at once, press Pause on its page (or Stop, which also records an incident). That refuses its calls until you resume; it does not turn checks off.
- Coding-agent hooks have no switch: remove them from the settings file (below) to pause them.
Uninstall
Uninstalling the package removes the code and keeps your data. Remove each piece you set up, in this order.
- Your code. Delete the two lines
agentfox uporinitadded to your entry point:import agentfoxand theagentfox.auto(…)line marked# added by `agentfox up`. - The project folder.
.agentfox/holdsagentfox.env(your account key, if you connected one),up.json(yourupanswers) and logs.agentfox.tomlis the project's settings.agentfox up --with ciwrote.github/workflows/agentfox.yml;upmay also have added anagentfoxentry to.mcp.json. - Coding-agent hooks. Remove the entries whose command runs
hooks runfrom.claude/settings.json(orsettings.local.json, or~/.claude/settings.jsonfor--scope user) and, for Codex, from.codex/hooks.jsonor~/.codex/hooks.json. Stop the daemon if it is running:agentfox admin hooks statussays whether it is. - The package. Whichever way you installed it:
pip uninstall agentfox,uv remove agentfox,uv tool uninstall agentfoxorpipx uninstall agentfox. - Local state. The database and evidence in the state directory. The audit chain is evidence, so this is a separate, deliberate step.
- Your account key. If you connected an account, revoke the key on Settings → API keys. Deleting
agentfox.envdoes not revoke it.
rm -rf .agentfox agentfox.toml .github/workflows/agentfox.yml # in each project
uv tool uninstall agentfox # or: pip uninstall agentfox / pipx uninstall agentfox
rm -rf ~/.agentfox # or $AGENTFOX_STATE_DIR / $XDG_DATA_HOME/agentfoxTroubleshooting
| You see | Do this |
|---|---|
ConfigFileError: AGENTFOX_CONFIG=… does not point at a readable file. | Fix the path, or set it to none. |
taint_scope … must be one of session, argument | Fix the typo. Validated settings stop startup rather than fall back. |
A setting in agentfox.toml has no effect | An environment variable overrides it, the key is misspelled (look for the warning), or the process started in another directory. |
Postgres: TypeError: cannot use a string pattern on a bytes-like object | The database uses SQL_ASCII. Create it with UTF-8 encoding. |