Skip to main content

AI Agent Security Testing โ€” discovers dangerous tool chain compositions via knowledge graph analysis

Project description

ZIRAN ๐Ÿง˜

AI Agent Security Testing

CI Tests PyPI Downloads License Python 3.11+

Find vulnerabilities in AI agents โ€” not just LLMs, but agents with tools, memory, and multi-step reasoning.

ZIRAN Demo

Install ยท Quick Start ยท Examples ยท Docs


Benchmarks

565 attack vectors ยท 11 categories ยท 90% OWASP LLM Top 10 ยท 20 benchmarks analyzed

Benchmark Coverage
AgentHarm (ICLR 2025) 100% harm categories
JailbreakBench (NeurIPS 2024) 100% categories, 175 vectors
Agent Security Bench 100% vectors (565/400)
HarmBench (ICML 2024) 55.6% tactics, 175 jailbreak vectors
R-Judge 100% risk types
ALERT 100% micro categories (32/32)
MITRE ATLAS 73.3% attack categories

Full results: benchmarks/ ยท docs


Why ZIRAN?

Most security tools test individual prompts or tools in isolation. ZIRAN discovers how tool combinations create attack paths โ€” an agent with read_file and http_request has a critical data exfiltration vulnerability, even if neither tool is dangerous alone.

Capability ZIRAN Promptfoo Invariant (Snyk) Garak PyRIT Inspect AI
Tool chain discovery (graph-based) Yes โ€” Policy-based โ€” โ€” โ€”
Side-effect detection (execution-level) Yes โ€” Trace-based โ€” โ€” Sandbox
Multi-phase campaigns w/ graph feedback Yes Turn-level Flow analysis โ€” Composable Multi-turn
Autonomous pentesting agent Yes โ€” โ€” โ€” โ€” โ€”
Multi-agent coordination Yes โ€” โ€” โ€” โ€” โ€”
Knowledge graph tracking Yes โ€” Policy lang. โ€” โ€” โ€”
Agent-aware (tools + memory) Yes Partial Yes โ€” โ€” Partial
A2A protocol support Yes โ€” โ€” โ€” โ€” โ€”
MCP protocol support Yes Partial Yes โ€” โ€” โ€”
Encoding/obfuscation attacks Yes (8) Yes (12+) โ€” โ€” โ€” โ€”
Industry compliance plugins โ€” Yes (46) โ€” โ€” โ€” โ€”
Streaming (SSE/WebSocket) Yes โ€” โ€” โ€” โ€” โ€”
CI/CD quality gate Yes Yes โ€” โ€” โ€” โ€”
Open source Apache-2.0 MIT Partial Apache-2.0 MIT MIT

Key differentiators:

  • Tool Chain Discovery โ€” Graph-based detection of dangerous tool combinations (read_file โ†’ http_request = data exfiltration). Discovery-based, not policy-based.
  • Side-Effect Detection โ€” Catches when agents refuse in text but execute dangerous tools anyway.
  • Multi-Phase Campaigns โ€” 8-phase trust exploitation with live knowledge graph feedback between phases.
  • Autonomous Pentesting Agent โ€” LLM-driven agent that plans, executes, and adapts attack campaigns with finding deduplication.
  • Multi-Agent Coordination โ€” Discovers topologies and tests cross-agent trust boundaries.
  • A2A + MCP Protocol Depth โ€” First security tool to test Agent-to-Agent agents.
  • Framework Agnostic โ€” LangChain, CrewAI, Bedrock, MCP, browser UIs, remote HTTPS agents, or custom adapters.

What ZIRAN Is / What ZIRAN Is Not

ZIRAN is an agent security scanner that discovers dangerous tool compositions via graph analysis, detects execution-level side effects, and runs multi-phase campaigns that model real attacker behavior.

ZIRAN is not:

  • An LLM safety/alignment tool โ€” for prompt injection breadth, jailbreak templates, and compliance testing, use Promptfoo or Garak
  • A runtime guardrail โ€” for real-time input/output protection, use NeMo Guardrails, Lakera Guard, or LLM Guard
  • A general-purpose eval framework โ€” for model evaluation and benchmarking, use Inspect AI or Deepeval

Works With

ZIRAN is complementary to other tools in the AI security ecosystem:

  • Promptfoo for attack breadth (encoding strategies, jailbreak templates, compliance plugins) + ZIRAN for agent depth (tool chains, side-effects, campaigns)
  • Garak for LLM-layer vulnerability scanning + ZIRAN for agent-layer tool chain analysis
  • NeMo Guardrails / Lakera for runtime protection + ZIRAN for pre-deployment testing

Install

pip install ziran

# with framework adapters
pip install ziran[langchain]    # LangChain support
pip install ziran[crewai]       # CrewAI support
pip install ziran[a2a]          # A2A protocol support
pip install ziran[streaming]    # SSE/WebSocket streaming
pip install ziran[pentest]      # autonomous pentesting agent
pip install ziran[otel]         # OpenTelemetry tracing
pip install ziran[all]          # everything

Quick Start

CLI

# scan a LangChain agent (in-process)
ziran scan --framework langchain --agent-path my_agent.py

# scan a remote agent over HTTPS
ziran scan --target target.yaml

# adaptive campaign with LLM-driven strategy
ziran scan --target target.yaml --strategy llm-adaptive

# stream responses in real-time
ziran scan --target target.yaml --streaming

# scan with encoding bypass variants (Base64 + ROT13)
ziran scan --target target.yaml --encoding base64 --encoding rot13

# scan with OpenTelemetry tracing
ziran scan --target target.yaml --otel

# scan a multi-agent system
ziran multi-agent-scan --target target.yaml

# discover capabilities of a remote agent
ziran discover --target target.yaml

# autonomous pentesting agent
ziran pentest --target target.yaml

# interactive red-team mode
ziran pentest --target target.yaml --interactive

# view the interactive HTML report
open reports/campaign_*_report.html

Python API

import asyncio
from ziran.application.agent_scanner.scanner import AgentScanner
from ziran.application.attacks.library import AttackLibrary
from ziran.infrastructure.adapters.langchain_adapter import LangChainAdapter

adapter = LangChainAdapter(agent=your_agent)
scanner = AgentScanner(adapter=adapter, attack_library=AttackLibrary())

result = asyncio.run(scanner.run_campaign())
print(f"Vulnerabilities found: {result.total_vulnerabilities}")
print(f"Dangerous tool chains: {len(result.dangerous_tool_chains)}")

See examples/ for 22 runnable demos โ€” from static analysis to autonomous pentesting.


Remote Agent Scanning

ZIRAN can test any published agent over HTTPS โ€” no source code or in-process access required. Define your target in a YAML file and ZIRAN handles the rest:

# target.yaml
name: my-agent
url: https://agent.example.com
protocol: auto  # auto | rest | openai | mcp | a2a

auth:
  type: bearer
  token_env: AGENT_API_KEY

tls:
  verify: true

Supported protocols:

Protocol Use Case Auto-detected via
REST Generic HTTP endpoints Fallback default
OpenAI-compatible Chat completions API (/v1/chat/completions) Path probing
MCP Model Context Protocol agents (JSON-RPC 2.0) JSON-RPC response
A2A Google Agent-to-Agent protocol /.well-known/agent.json
# auto-detect protocol and scan
ziran scan --target target.yaml

# force a specific protocol
ziran scan --target target.yaml --protocol openai

# A2A agent with Agent Card discovery
ziran scan --target a2a_target.yaml --protocol a2a

See examples/15-remote-agent-scan/ for ready-to-use target configurations.


What ZIRAN Finds

Prompt-level โ€” injection, system prompt extraction, memory poisoning, chain-of-thought manipulation.

Tool-level โ€” tool manipulation, privilege escalation, data exfiltration chains.

Tool chains (unique to ZIRAN) โ€” automatic graph analysis of dangerous tool compositions:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Risk     โ”‚ Type                โ”‚ Tools                       โ”‚ Description                          โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ critical โ”‚ data_exfiltration   โ”‚ read_file โ†’ http_request    โ”‚ File contents sent to external serverโ”‚
โ”‚ critical โ”‚ sql_to_rce          โ”‚ sql_query โ†’ execute_code    โ”‚ SQL results executed as code         โ”‚
โ”‚ high     โ”‚ pii_leakage         โ”‚ get_user_info โ†’ external_apiโ”‚ User PII sent to third-party API     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

How It Works

flowchart LR
    subgraph agent["๐Ÿค– Your Agent"]
        direction TB
        T["๐Ÿ”ง Tools"]
        M["๐Ÿง  Memory"]
        P["๐Ÿ”‘ Permissions"]
    end

    agent -->|"adapter layer"| D

    subgraph ziran["โ›ฉ๏ธ ZIRAN Pipeline"]
        direction TB
        D["1 ยท DISCOVER\nProbe tools, permissions,\ndata access"]
        MAP["2 ยท MAP\nBuild knowledge graph\n(NetworkX MultiDiGraph)"]
        A["3 ยท ANALYZE\nWalk graph for dangerous\nchains (30+ patterns)"]
        ATK["4 ยท ATTACK\nMulti-phase exploits\ninformed by the graph"]
        R["5 ยท REPORT\nScored findings with\nremediation guidance"]
        D --> MAP --> A --> ATK --> R
    end

    R --> HTML["๐Ÿ“Š HTML\nInteractive graph"]
    R --> MD["๐Ÿ“ Markdown\nCI/CD tables"]
    R --> JSON["๐Ÿ“ฆ JSON\nMachine-parseable"]

    style agent fill:#1a1a2e,stroke:#e94560,color:#fff,stroke-width:2px
    style ziran fill:#0f3460,stroke:#e94560,color:#fff,stroke-width:2px
    style D fill:#16213e,stroke:#0ea5e9,color:#fff
    style MAP fill:#16213e,stroke:#0ea5e9,color:#fff
    style A fill:#16213e,stroke:#0ea5e9,color:#fff
    style ATK fill:#16213e,stroke:#e94560,color:#fff
    style R fill:#16213e,stroke:#10b981,color:#fff
    style HTML fill:#1e293b,stroke:#10b981,color:#fff
    style MD fill:#1e293b,stroke:#10b981,color:#fff
    style JSON fill:#1e293b,stroke:#10b981,color:#fff
    style T fill:#2d2d44,stroke:#e94560,color:#fff
    style M fill:#2d2d44,stroke:#e94560,color:#fff
    style P fill:#2d2d44,stroke:#e94560,color:#fff

Campaigns run 8 phases (reconnaissance โ†’ trust building โ†’ capability mapping โ†’ vulnerability discovery โ†’ exploitation setup โ†’ execution โ†’ persistence โ†’ exfiltration), each feeding a live knowledge graph. Three strategies: fixed (sequential), adaptive (rule-based reordering), llm-adaptive (LLM-driven planning). See adaptive campaigns docs.


Reports

Three output formats, generated automatically:

  • HTML โ€” Interactive knowledge graph with attack path highlighting
  • Markdown โ€” CI/CD-friendly summary tables
  • JSON โ€” Machine-parseable for programmatic consumption
ZIRAN HTML Report

CI/CD Integration

Use ZIRAN as a quality gate in your pipeline:

Live scan (runs the full attack suite against your agent)

# .github/workflows/security.yml
- uses: taoq-ai/ziran@v0
  with:
    command: scan
    framework: langchain        # langchain | crewai | bedrock
    agent-path: my_agent.py     # OR use target: target.yaml for remote agents
    coverage: standard           # essential | standard | comprehensive
    gate-config: gate_config.yaml
  env:
    OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}   # or ANTHROPIC_API_KEY, etc.

Offline CI gate (evaluate a previous scan result)

- uses: taoq-ai/ziran@v0
  with:
    command: ci
    result-file: scan_results/campaign_report.json
    gate-config: gate_config.yaml

Outputs: status (passed/failed), trust-score, total-findings, critical-findings, sarif-file.

See the full example workflow or use the Python API.


Development

git clone https://github.com/taoq-ai/ziran.git && cd ziran
uv sync --group dev

uv run ruff check .            # lint
uv run mypy ziran/             # type-check
uv run pytest --cov=ziran      # test

Contributing

See CONTRIBUTING.md. Ways to help:


Citation

If you use ZIRAN in academic work, please cite:

@software{ziran2026,
  title     = {ZIRAN: AI Agent Security Testing},
  author    = {{TaoQ AI} and Lage Perdigao, Leone},
  year      = {2026},
  url       = {https://github.com/taoq-ai/ziran},
  license   = {Apache-2.0},
  version   = {0.20.0}
}

License

Apache License 2.0 โ€” See NOTICE for third-party attributions.

Built by TaoQ AI

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

ziran-0.23.0.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

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

ziran-0.23.0-py3-none-any.whl (512.1 kB view details)

Uploaded Python 3

File details

Details for the file ziran-0.23.0.tar.gz.

File metadata

  • Download URL: ziran-0.23.0.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ziran-0.23.0.tar.gz
Algorithm Hash digest
SHA256 5da1c1ed88e3aeac1aae2f020c68e11379734ca17a4078a9be81938abc5965ba
MD5 5cab6281aa39810aad61a1e669138081
BLAKE2b-256 3e49f2acbd885f8d9a3d3e695422355044d8bf18233a22ba4e534bdc48d94d12

See more details on using hashes here.

Provenance

The following attestation bundles were made for ziran-0.23.0.tar.gz:

Publisher: release.yml on taoq-ai/ziran

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

File details

Details for the file ziran-0.23.0-py3-none-any.whl.

File metadata

  • Download URL: ziran-0.23.0-py3-none-any.whl
  • Upload date:
  • Size: 512.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ziran-0.23.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01e04cd6edf0eadfdec2003295a4e64f7910694c35494f4cb364da7701574240
MD5 ac7e74acf00bb829e8ea2d3da7f0de27
BLAKE2b-256 7729ac03f386caf4e08b359a5e94d4e0fb62ce4231a8fefa680c66593713c721

See more details on using hashes here.

Provenance

The following attestation bundles were made for ziran-0.23.0-py3-none-any.whl:

Publisher: release.yml on taoq-ai/ziran

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