ZeroLeaks SDK
Quick Start
Run a production-fidelity scan against an existing application agent.
Quick Start
The universal runtime target can wrap any agent framework.
import { ZeroLeaks, createRuntimeTarget } from "@zeroleaks/sdk";
import { productionAgent } from "./agent";
const zeroleaks = new ZeroLeaks();
const target = createRuntimeTarget({
definition: {
name: "Support agent",
provider: "custom",
model: "production-model",
instructions: SUPPORT_INSTRUCTIONS,
tools: productionTools.map((tool) => ({
name: tool.name,
description: tool.description,
inputSchema: tool.inputSchema,
outputSchema: tool.outputSchema,
})),
},
invoke: async ({ messages, sessionId, signal }) => {
const result = await productionAgent({ messages, sessionId, signal });
return {
text: result.text,
messages: result.messages,
toolCalls: result.toolCalls,
usage: result.usage,
};
},
reset: async (sessionId) => {
await productionAgent.reset(sessionId);
},
});
const { scan, report } = await zeroleaks.runtimeScans.run(target, {
eventConcurrency: 8,
workerStallTimeoutMs: 6 * 60_000,
scan: {
scanMode: "full",
knowledgeProfile: "production",
attackSurfaces: [
"direct_chat",
"indirect_content",
"tool_calling",
"multi_turn",
],
},
onPoll: (current) => console.log(current.currentPhase),
});
console.log(scan.status, report.overallScore);What happens
- The SDK sends the serializable target and tool definitions to ZeroLeaks.
- The hosted engine begins extraction, injection, tool, indirect-content, and multi-turn probes.
- Your process claims independent probes concurrently and invokes the same production agent function used by your application.
- The SDK keeps each session ordered, maintains isolated conversation histories, and forwards tool-call traces.
- ZeroLeaks evaluates the responses and returns one consolidated report.
Your model provider key, executable tool functions, retrieved documents, and local application state remain in your environment.
scanMode: "full" is the default and includes the complete production probe catalog. Use scanMode: "quick" only for a smaller development smoke test.