Open-source AI gateway from Maxim with one OpenAI-compatible API across providers, failover, budgets and an MCP gateway.

PromptInject
Open-source Python research framework for building adversarial prompts and testing LLMs against goal hijacking and prompt leaking.
What is PromptInject?
PromptInject is a Python framework that accompanies the paper Ignore Previous Prompt: Attack Techniques For Language Models, from the team at Agency Enterprise. It builds adversarial inputs by combining modular pieces in a mask-based, iterative way, so that researchers can measure how easily a language model is pulled away from its instructions. The paper studies two attacks. In goal hijacking, the attacker's text makes the model print a chosen target string, which could itself hold malicious instructions. In prompt leaking, the text makes the model print the application prompt. The authors tested GPT-3 and found that simple handcrafted inputs could misalign it, creating long-tail risks. The GitHub repository installs with pip straight from the repository URL and ships an example notebook that shows usage. It is research code released as open source rather than a hosted product, so there is no pricing, and you run it yourself. You run it yourself against the models you want to test.
Use cases
- Test an LLM for goal hijacking
- Test prompts for prompt leaking
- Build adversarial prompt test sets
- Benchmark prompt injection robustness
- Reproduce the Ignore Previous Prompt paper
- Teach prompt injection risks in a class
Who it's for
Why use PromptInject
- It gives researchers a repeatable way to compose attack prompts instead of writing each one by hand.
- The two defined attack types, hijacking and leaking, give results you can compare across models.
- The code accompanies a published paper, so methods can be traced to a source.
- A single pip command installs it from GitHub, with a notebook showing how to run it.
PromptInject features
- Mask-based iterative adversarial prompt composition
- Modular assembly of attack prompts
- Goal hijacking attack type
- Prompt leaking attack type
- Quantitative robustness analysis of language models
- Example Jupyter notebook for getting started
- Install with pip from the GitHub repository
- Open contribution through the issues tracker
How to get started with PromptInject
- Install the package with pip install git+https://github.com/agencyenterprise/PromptInject.
- Open notebooks/Example.ipynb to see how a run is set up.
- Define the application prompt and the attack pieces to combine.
- Run the generated adversarial prompts against the language model you want to test.
- Compare how often goal hijacking or prompt leaking succeeds.
PromptInject limitations
- Research code rather than a packaged security product
- The paper's experiments targeted GPT-3, so attacks may need adapting for newer models
- No hosted interface; you install and run it yourself
- Usage guidance is limited to one example notebook
PromptInject pricing
PromptInject is open source, so you can use and self-host it for free.
Prices can change and may vary by country or exclude tax. Check the official pricing page.
PromptInject alternatives
The main PromptInject alternatives listed on Debuly are Promptfoo, Ragas, Agent Development Kit (ADK), Braintrust, gpt-prompt-engineer and Lacy Shell. The table compares pricing and platforms; order is A–Z.
| Tool | Pricing | Starting price | Platforms |
|---|---|---|---|
| PromptInject | Open source | — | — |
| Agent Development Kit (ADK) | Open source | — | CLI, Self-hosted, API |
| Braintrust | Freemium | $249/mo | Web, API, Self-hosted |
| gpt-prompt-engineer | Open source | — | Google Colab, Jupyter |
| Lacy Shell | Open source | — | CLI, ZSH, Bash |
| Promptfoo | Open source | — | CLI, Web, API, Self-hosted |
| Ragas | Open source | — | CLI |

Agent Development Kit (ADK)
Google's open-source, code-first Python framework for building, testing and deploying AI agents and multi-agent workflows.

Braintrust
AI observability and evaluation platform for tracing LLM apps and agents, scoring outputs and catching regressions before release.
FreemiumVisit Braintrust (official site)gpt-prompt-engineer
Open source notebook that writes many candidate prompts for a task, tests them on your cases and ranks them with ELO scores.
Open sourceVisit gpt-prompt-engineer (official site)
Lacy Shell
Free MIT-licensed ZSH and Bash plugin that runs shell commands normally and sends plain-English questions to the AI CLI you choose.
Open sourceVisit Lacy Shell (official site)
Promptfoo
Open-source LLM evaluation and red-teaming tool that finds prompt injections, jailbreaks and data leaks in AI apps and agents.
Open sourceVisit Promptfoo (official site)
Ragas
Open-source Python library for evaluating LLM and RAG applications with metrics, experiments and synthetic test data generation.
Open sourceVisit Ragas (official site)
PromptInject FAQ
Is PromptInject free and open source?
Yes. It is a public GitHub repository with no price, and the project accepts contributions through its issues tracker. You run it on your own machine.
How do I install PromptInject?
Run pip install git+https://github.com/agencyenterprise/PromptInject, then follow the example notebook in the notebooks folder.
What attacks does PromptInject test?
Two types: goal hijacking, where the model is made to print a target string, and prompt leaking, where it is made to reveal the application prompt.
Which models has PromptInject been tested on?
The accompanying paper examines GPT-3. Other models may need adapted attacks.
Who is PromptInject for?
Security researchers, ML engineers and students who want a quantitative baseline for prompt injection robustness.
What are alternatives to PromptInject?
Promptfoo, Garak, PyRIT and Giskard also test LLMs for prompt injection and related risks.
Sources & verification
Facts on this page come from the official sources below, each with the date we read it. Written by Debuly; the vendor did not review this page.
| Source | Type | Accessed |
|---|---|---|
| github.com/agencyenterprise/PromptInject | official |
Image credits
- Logo: from avatars.githubusercontent.com · fetched · Vendor trademark, used only to identify the product; removed on request
- Cover: none collected yet, so a generated tile is shown.
Spot an error? Report an issue with this listing. We also remove a logo or image on the owner's request.



