AI Agent Security Testing Framework โ multi-phase scan campaigns with knowledge graph tracking
Project description
ZIRAN ๐ง
AI Agent Security Testing
Find vulnerabilities in AI agents โ not just LLMs, but agents with tools, memory, and multi-step reasoning.
Install ยท Quick Start ยท Examples ยท Docs
Why ZIRAN?
Most security tools test the LLM (prompt injection, jailbreaks) or the web app (XSS, SQLi). ZIRAN tests the AI agent โ the system that wields tools, retains memory, and chains reasoning. That's a fundamentally different attack surface.
| Capability | ZIRAN | Garak | Promptfoo | PyRIT | Shannon |
|---|---|---|---|---|---|
| Agent-aware (tools + memory) | Yes | โ | Partial | โ | โ |
| Tool chain analysis | Yes | โ | โ | โ | โ |
| Multi-phase campaigns | Yes | โ | โ | Partial | Yes |
| Knowledge graph tracking | Yes | โ | โ | โ | โ |
| CI/CD quality gate | Yes | โ | Yes | โ | Pro |
| Open source | Apache-2.0 | Apache-2.0 | MIT | MIT | AGPL-3.0 |
Key differentiators:
- Tool Chain Analysis โ Detects dangerous tool combinations (
read_fileโhttp_request= data exfiltration). No other tool does this. - Romance Scan โ Multi-phase campaigns that build trust before testing boundaries, like a real attacker.
- Knowledge Graph โ Every discovered capability, relationship, and attack path is tracked in a live graph.
- Framework Agnostic โ LangChain, CrewAI, MCP, or write your own adapter.
Install
pip install ziran
# with framework adapters
pip install ziran[langchain] # LangChain support
pip install ziran[crewai] # CrewAI support
pip install ziran[all] # everything
Quick Start
CLI
# scan a LangChain agent
ziran scan --framework langchain --agent-path my_agent.py
# 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 14 runnable demos โ from static analysis to multi-agent supervisor scans.
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
Romance Scan Phases
| Phase | Goal |
|---|---|
| Reconnaissance | Discover capabilities and data sources |
| Trust Building | Establish rapport with the agent |
| Capability Mapping | Map tools, permissions, data access |
| Vulnerability Discovery | Identify attack paths |
| Exploitation Setup | Position without triggering defences |
| Execution | Execute the exploit chain |
| Persistence | Maintain access across sessions (opt-in) |
| Exfiltration | Extract sensitive data (opt-in) |
Each phase builds on the knowledge graph from previous phases.
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
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@v1
with:
command: scan
framework: langchain # langchain | crewai | bedrock
agent-path: my_agent.py
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@v1
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:
- Report bugs
- Request features
- Submit Skill CVEs for tool vulnerabilities
- Add attack vectors (YAML) or adapters
License
Apache License 2.0 โ See NOTICE for third-party attributions.
Built by TaoQ AI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ziran-0.2.0.tar.gz.
File metadata
- Download URL: ziran-0.2.0.tar.gz
- Upload date:
- Size: 978.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c212bdeafd852a95ea16e23f8ef41eccc055bbabdb927a9707779ac9ac440168
|
|
| MD5 |
51e68c1bed5a3f147088640fdcd97f09
|
|
| BLAKE2b-256 |
b3e4400ed944d014309930c67527b603a0cf00ee16a0c999a9106c8acefc20b1
|
Provenance
The following attestation bundles were made for ziran-0.2.0.tar.gz:
Publisher:
release.yml on taoq-ai/ziran
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ziran-0.2.0.tar.gz -
Subject digest:
c212bdeafd852a95ea16e23f8ef41eccc055bbabdb927a9707779ac9ac440168 - Sigstore transparency entry: 944011735
- Sigstore integration time:
-
Permalink:
taoq-ai/ziran@2371062c3504d02a954fe5ac29bc6dd335d2dfbc -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/taoq-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2371062c3504d02a954fe5ac29bc6dd335d2dfbc -
Trigger Event:
push
-
Statement type:
File details
Details for the file ziran-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ziran-0.2.0-py3-none-any.whl
- Upload date:
- Size: 176.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a9d253ccf6757c93f479f6e9e85321fbdcffba14ba2aec705c568efd93acddd
|
|
| MD5 |
fe417254f4d0478364f457ed30901841
|
|
| BLAKE2b-256 |
6eaefa461f80d3b0cfd231019266332d11a166ca9d40399dba0cd200dcd0ae23
|
Provenance
The following attestation bundles were made for ziran-0.2.0-py3-none-any.whl:
Publisher:
release.yml on taoq-ai/ziran
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ziran-0.2.0-py3-none-any.whl -
Subject digest:
3a9d253ccf6757c93f479f6e9e85321fbdcffba14ba2aec705c568efd93acddd - Sigstore transparency entry: 944011742
- Sigstore integration time:
-
Permalink:
taoq-ai/ziran@2371062c3504d02a954fe5ac29bc6dd335d2dfbc -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/taoq-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2371062c3504d02a954fe5ac29bc6dd335d2dfbc -
Trigger Event:
push
-
Statement type: