Attack tests
Attack your agent with the built-in attack library, see what got through, and fix it before real users find it.
Before you start
- Your repository is connected with
agentfox init(see the Quickstart), andinitis still running. The attacks run your agent on your machine, with every tool faked. - Your agent is built with LangChain or LangGraph, the OpenAI Agents SDK, CrewAI, or is a function that runs its own function-calling loop. It runs on its own model, with the key in your environment.
CrewAI
AgentFox finds a crew in a module-level Crew(...) or in a @CrewBase class (its @crew and @agent methods, with config/agents.yaml and tasks.yaml), and builds a fresh crew for each attack. The crew gets the attack in every {input} its tasks take, as kickoff(inputs=...) would; a hierarchical crew runs its manager, which hands work to the agents as it would live. Each agent is also attacked on its own, as the one task of a crew. Your tools are faked; CrewAI's own delegation tools still run. A crew with no {input} in its tasks, and an agent with MCP servers or CrewAI platform apps, are reported as not run, with the reason.
Agents that hand off
An agent is attacked through the tools it reaches by handing off too (Agents SDK handoffs and agents used as tools, LangGraph supervisor and swarm hand-offs, CrewAI delegation), not only its own. A triage agent that can only look up an order but hands refunds to another agent is attacked with unsafe refunds: the attack goes to the triage agent, the hand-off happens inside the run, and a refund there counts against the triage agent, read as reached issue_refund through Refunds specialist. The call is checked under the agent that makes it. The agents it hands off to are still attacked on their own.
Run the attack test
Open Agents and pick the project. With nothing selected on the map, the panel shows the Attack test: one row per attack set. Press the play button to run it. Use + to add more sets from the library.

Read what got through
Each row shows how many attacks in that set got through. A set that got through also raises an issue on Issues, with each attack that was tried and the verdict it got.
Add guardrails and test again
Press Turn on basic guardrails and test again. It turns on the basic guardrails and reruns the same attacks. Each row then reads no guardrails → basic guardrails. For what is still getting through, add a custom rule or tighten tool access, then run it again.
See past runs
Testing → Attack tests lists every run of this test, for every project, with the same numbers as the agent's panel: attacks, stopped, got through, and the normal requests. Choose an agent and press Run to run its project's test again (its
agentfox initmust be running). An agent's page shows that agent's own attacks.
Without a dashboard,
agentfox test redteam <agent>checks the same attacks against the agent's rules with no model: each message, then the tool call it is after, as live traffic checks them. It measures your rules; the test above measures the agent. Its runs are listed apart, under Checked without a model.
How to read a result
- Blocked: a rule that blocks stopped it. Live traffic is stopped too.
- Would block (watching): only a rule in Watch stopped it. Real requests still go through until you switch that guardrail to Block.
- The library includes a few ordinary requests. If one of those is refused, the test reports it as over-blocking.
- A clean run means these attacks were stopped, not that every attack would be. Adaptive mode retries blocked attacks in disguised forms; see In CI and in production.
Try one message
Testing → Try it checks a single message or tool call against an agent's real rules and shows the verdict and the rules that matched. It is not counted as traffic.

The public playground
The playground needs no account. It has three sample agents: try a prompt attack, or ask an agent to call a tool it was not given, and see the decision and why. Press switch to enforce to see watching (it calls this observe) turn into blocking. No model runs and no tool does anything real. A sandbox expires 30 minutes after your last action; don't paste real data into it.
If something goes wrong
| You see | Do this |
|---|---|
| The play button is greyed out | Run agentfox init in this project's repository and keep it running. |
| Waiting for agentfox init on your machine… | init stopped. Start it again in the repository. |
| "resume it to run the attack test" | An agent in the project is stopped. Resume it first. |