<center>
# AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for LLM Agents
![GitHub License](https://img.shields.io/github/license/ethz-spylab/agentdojo) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ethz-spylab/agentdojo/lint-docs.yaml)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/agentdojo) ![PyPI - Downloads](https://img.shields.io/pypi/dm/agentdojo) ![PyPI - Version](https://img.shields.io/pypi/v/agentdojo)
[Edoardo Debenedetti](https://edoardo.science)<sup>1</sup>, [Jie Zhang](https://zj-jayzhang.github.io)<sup>1</sup>, [Mislav Balunović](https://www.sri.inf.ethz.ch/people/mislav)<sup>1,2</sup>, [Luca Beurer-Kellner](https://www.sri.inf.ethz.ch/people/luca)<sup>1,2</sup>, [Marc Fischer](https://marcfischer.at)<sup>1,2</sup>, [Florian Tramèr](https://floriantramer.com)<sup>1</sup>
<sup>1</sup>ETH Zurich and <sup>2</sup>Invariant Labs
[Read Paper](https://arxiv.org/abs/2406.13352) | [Inspect Results](https://agentdojo.spylab.ai/results/)
</center>
## Quickstart
```bash
pip install agentdojo
```
> [!IMPORTANT]
> Note that the API of the package is still under development and might change in the future.
If you want to use the prompt injection detector, you need to install the `transformers` extra:
```bash
pip install "agentdojo[transformers]"
```
## Running the benchmark
The benchmark can be run with the [benchmark](src/agentdojo/scripts/benchmark.py) script. Documentation on how to use the script can be obtained with the `--help` flag.
For example, to run the `workspace` suite on the tasks 0 and 1, with `gpt-4o-2024-05-13` as the LLM, the tool filter as a defense, and the attack with tool knowlege, run the following command:
```bash
python -m agentdojo.scripts.benchmark -s workspace -ut user_task_0 \
-ut user_task_1 --model gpt-4o-2024-05-13 \
--defense tool_filter --attack tool_knowledge
```
To run the above, but on all suites and tasks, run the following:
```bash
python -m agentdojo.scripts.benchmark --model gpt-4o-2024-05-13 \
--defense tool_filter --attack tool_knowledge
```
## Inspect the results
To inspect the results, go to the dedicated [results page](https://agentdojo.spylab.ai/results/) of the documentation. AgentDojo results are also listed in the [Invariant Benchmark Registry](https://explorer.invariantlabs.ai/benchmarks/).Agent
## Documentation of the Dojo
Take a look at our [documentation](https://agentdojo.spylab.ai/).
## Development set-up
Take a look at the [development set-up](https://agentdojo.spylab.ai/docs/development) docs.
## Citing
If you use AgentDojo in your research, please consider citing our paper:
```bibtex
@inproceedings{
debenedetti2024agentdojo,
title={AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for {LLM} Agents},
author={Edoardo Debenedetti and Jie Zhang and Mislav Balunovic and Luca Beurer-Kellner and Marc Fischer and Florian Tram{\`e}r},
booktitle={The Thirty-eight Conference on Neural Information Processing Systems Datasets and Benchmarks Track},
year={2024},
url={https://openreview.net/forum?id=m1YYAQjO3w}
}
```
Raw data
{
"_id": null,
"home_page": null,
"name": "agentdojo",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Edoardo Debenedetti <edoardo.debenedetti@inf.ethz.ch>",
"keywords": "benchmark, llms, machine learning, prompt injection, security",
"author": null,
"author_email": "Edoardo Debenedetti <edoardo.debenedetti@inf.ethz.ch>, Jie Zhang <jie.zhang@inf.ethz.ch>, Mislav Balunovic <mislav.balunovic@inf.ethz.ch>, Luca Beurer-Kellner <luca.beurer-kellner@inf.ethz.ch>",
"download_url": "https://files.pythonhosted.org/packages/ac/28/c449ab69b9ce9da28bc55923ec81df6fd29cd7440a50014524ae713d92e7/agentdojo-0.1.24.tar.gz",
"platform": null,
"description": "<center>\n\n# AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for LLM Agents\n\n![GitHub License](https://img.shields.io/github/license/ethz-spylab/agentdojo) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ethz-spylab/agentdojo/lint-docs.yaml)\n ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/agentdojo) ![PyPI - Downloads](https://img.shields.io/pypi/dm/agentdojo) ![PyPI - Version](https://img.shields.io/pypi/v/agentdojo)\n\n\n\n[Edoardo Debenedetti](https://edoardo.science)<sup>1</sup>, [Jie Zhang](https://zj-jayzhang.github.io)<sup>1</sup>, [Mislav Balunovi\u0107](https://www.sri.inf.ethz.ch/people/mislav)<sup>1,2</sup>, [Luca Beurer-Kellner](https://www.sri.inf.ethz.ch/people/luca)<sup>1,2</sup>, [Marc Fischer](https://marcfischer.at)<sup>1,2</sup>, [Florian Tram\u00e8r](https://floriantramer.com)<sup>1</sup>\n\n<sup>1</sup>ETH Zurich and <sup>2</sup>Invariant Labs\n\n[Read Paper](https://arxiv.org/abs/2406.13352) | [Inspect Results](https://agentdojo.spylab.ai/results/)\n</center>\n\n## Quickstart\n\n```bash\npip install agentdojo\n```\n\n> [!IMPORTANT]\n> Note that the API of the package is still under development and might change in the future.\n\nIf you want to use the prompt injection detector, you need to install the `transformers` extra:\n\n```bash\npip install \"agentdojo[transformers]\"\n```\n\n## Running the benchmark\n\nThe benchmark can be run with the [benchmark](src/agentdojo/scripts/benchmark.py) script. Documentation on how to use the script can be obtained with the `--help` flag.\n\nFor example, to run the `workspace` suite on the tasks 0 and 1, with `gpt-4o-2024-05-13` as the LLM, the tool filter as a defense, and the attack with tool knowlege, run the following command:\n\n```bash\npython -m agentdojo.scripts.benchmark -s workspace -ut user_task_0 \\\n -ut user_task_1 --model gpt-4o-2024-05-13 \\\n --defense tool_filter --attack tool_knowledge\n```\n\nTo run the above, but on all suites and tasks, run the following:\n\n```bash\npython -m agentdojo.scripts.benchmark --model gpt-4o-2024-05-13 \\\n --defense tool_filter --attack tool_knowledge\n```\n\n## Inspect the results\n\nTo inspect the results, go to the dedicated [results page](https://agentdojo.spylab.ai/results/) of the documentation. AgentDojo results are also listed in the [Invariant Benchmark Registry](https://explorer.invariantlabs.ai/benchmarks/).Agent\n\n## Documentation of the Dojo\n\nTake a look at our [documentation](https://agentdojo.spylab.ai/).\n\n## Development set-up\n\nTake a look at the [development set-up](https://agentdojo.spylab.ai/docs/development) docs.\n\n## Citing\n\nIf you use AgentDojo in your research, please consider citing our paper:\n\n```bibtex\n@inproceedings{\n debenedetti2024agentdojo,\n title={AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for {LLM} Agents},\n author={Edoardo Debenedetti and Jie Zhang and Mislav Balunovic and Luca Beurer-Kellner and Marc Fischer and Florian Tram{\\`e}r},\n booktitle={The Thirty-eight Conference on Neural Information Processing Systems Datasets and Benchmarks Track},\n year={2024},\n url={https://openreview.net/forum?id=m1YYAQjO3w}\n}\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "A Dynamic Environment to Evaluate Attacks and Defenses for LLM Agents",
"version": "0.1.24",
"project_urls": {
"documentation": "https://agentdojo.spylab.ai/api/agent_pipeline/basic_elements/",
"homepage": "https://agentdojo.spylab.ai",
"issues": "https://github.com/ethz-spylab/agentdojo/issues",
"repository": "https://github.com/ethz-spylab/agentdojo"
},
"split_keywords": [
"benchmark",
" llms",
" machine learning",
" prompt injection",
" security"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "808e85bdfcaae6ba956c5e40e2855b6662706770d29e073699b9706031b1b320",
"md5": "8f0ffbcd1bf2d7721017348096c98aed",
"sha256": "eb5968bf76bebb241c71cec96cee4efd55ca4c131c95a55174a571bc589b25d1"
},
"downloads": -1,
"filename": "agentdojo-0.1.24-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8f0ffbcd1bf2d7721017348096c98aed",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 169209,
"upload_time": "2025-01-23T14:42:49",
"upload_time_iso_8601": "2025-01-23T14:42:49.209683Z",
"url": "https://files.pythonhosted.org/packages/80/8e/85bdfcaae6ba956c5e40e2855b6662706770d29e073699b9706031b1b320/agentdojo-0.1.24-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ac28c449ab69b9ce9da28bc55923ec81df6fd29cd7440a50014524ae713d92e7",
"md5": "ffbec28b970f1a8c8cd8091f59720750",
"sha256": "251bb55edb1e9f5494efa5554e7a22cef4b989fb40d9d8412cf1ad3b962ed385"
},
"downloads": -1,
"filename": "agentdojo-0.1.24.tar.gz",
"has_sig": false,
"md5_digest": "ffbec28b970f1a8c8cd8091f59720750",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 20738563,
"upload_time": "2025-01-23T14:42:54",
"upload_time_iso_8601": "2025-01-23T14:42:54.316967Z",
"url": "https://files.pythonhosted.org/packages/ac/28/c449ab69b9ce9da28bc55923ec81df6fd29cd7440a50014524ae713d92e7/agentdojo-0.1.24.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-23 14:42:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ethz-spylab",
"github_project": "agentdojo",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "agentdojo"
}