ZeroLeaks Developer Documentation
Red-team AI agents from your code or CI, add runtime prompt defenses, or run the source-available ZeroLeaks scan engine.
ZeroLeaks red-teams AI agents: it profiles the agent's role, tools, and reachable data, derives the boundaries it must not cross, and tests those boundaries on every scan. Its three developer products are the hosted scanning SDK, the Shield API and runtime SDK, and the source-available zeroleaks scan engine.
Choose a product
ZeroLeaks SDK
Run hosted agent scans through your real AI SDK, OpenAI, or custom agent code, or against a deployed HTTPS endpoint. Tools, memory, middleware, and multi-turn behavior stay as they are in production.
Shield SDK
Add hosted injection detection or local detection, prompt hardening, and output sanitization to an LLM application.
zeroleaks package
Run the source-available scanner and CLI locally with your own model provider credentials.
How they fit together
| Product | Best for | Runs where | Credential |
|---|---|---|---|
@zeroleaks/sdk | Runtime and endpoint agent scans, plus skill scans | ZeroLeaks orchestration plus your runner | ZEROLEAKS_API_KEY |
@zeroleaks/shield | Runtime protection in an LLM request path | Hosted API for default detection; your application for local helpers | ZEROLEAKS_API_KEY for hosted detection; none for local helpers |
zeroleaks | Local scans, including system-prompt extraction tests, research, and custom scan engines | Your machine or CI runner | OPENROUTER_API_KEY |
For most production agents, run SDK runtime scans against the real agent and add Shield for runtime defense in depth. Use the zeroleaks package when you need local control over the scanning engine.
Security note
ZeroLeaks API keys are server credentials. Keep them in a server-side environment variable or secret manager and never include them in browser bundles, mobile applications, source control, or logs.