Skip to main content

Core code for AgentDojo

Project description

AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for LLM Agents

GitHub License GitHub Actions Workflow Status PyPI - Python Version PyPI - Downloads PyPI - Version

Edoardo Debenedetti1, Jie Zhang1, Mislav Balunović1,2, Luca Beurer-Kellner1,2, Marc Fischer1,2, Florian Tramèr1

1ETH Zurich and 2Invariant Labs

Read Paper | Inspect Results

Quickstart

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:

pip install "agentdojo[transformers]"

Running the benchmark

The benchmark can be run with the benchmark 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:

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:

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 of the documentation. AgentDojo results are also listed in the Invariant Benchmark Registry.Agent

Documentation of the Dojo

Take a look at our documentation.

Development set-up

Take a look at the development set-up docs.

Citing

If you use AgentDojo in your research, please consider citing our paper:

@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}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentdojo_core-0.0.3.tar.gz (177.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentdojo_core-0.0.3-py3-none-any.whl (66.9 kB view details)

Uploaded Python 3

File details

Details for the file agentdojo_core-0.0.3.tar.gz.

File metadata

  • Download URL: agentdojo_core-0.0.3.tar.gz
  • Upload date:
  • Size: 177.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for agentdojo_core-0.0.3.tar.gz
Algorithm Hash digest
SHA256 febdcedeb46adc7db16337897ed491522d22187bac4ec21eea77041eadce320f
MD5 f08e93ead4338de1db857691ea3d20ed
BLAKE2b-256 655e64449a1c746a218096215207d85753ae67d71954cd570e645cb129f7126c

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentdojo_core-0.0.3.tar.gz:

Publisher: publish.yaml on ethz-spylab/agentdojo-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentdojo_core-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: agentdojo_core-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 66.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for agentdojo_core-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 deeada6b3a23332b766e71cdeae974680a0d4e679ad245237d457e6854c26aa2
MD5 1f0e99de756b458d35ad81f0b051caca
BLAKE2b-256 9381100cbaef6330d76f0943ac6fdd7b978a4b904f9b6e6f90da4c0ee29691ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentdojo_core-0.0.3-py3-none-any.whl:

Publisher: publish.yaml on ethz-spylab/agentdojo-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page