Getting Started with AgentShield
Install AgentShield on Python 3.10+ with Pydantic v2, FastAPI, and Uvicorn included cleanly in runtime dependencies.
uv & pip Install
uv sync --extra dev && uv run agentshield evaluate
pip install git+https://github.com/codesphere-u/agentshield.git
CLI Commands
agentshield evaluate --output report.md— Runs 25 OWASP 2026 scenarios.agentshield check-prompt "..."— Runs multi-layer injection detection.agentshield check-tool --tool ... --args '{...}'— Evaluates deep argument safety.agentshield scan-output "..."— Scans and redacts leaked credentials & XSS.agentshield serve --port 8090— Starts FastAPI Security Lab.
Python SDK & Adapters
@guard_tool Decorator
Wrap arbitrary tools with @guard_tool(runtime, tool_name="read_file") to enforce path sandboxes and automatically redact secret tokens returned to callers.
OpenAI & MCP Schemas
ShieldedAgentRuntime normalizes OpenAI tool calls and Anthropic/MCP JSON payloads through a single deterministic policy pipeline.
Tamper-Evident Audit Ledger
SHA-256 Hash Chain
Every verdict appends to an immutable SHA-256 hash chain. Call runtime.audit_ledger.verify_integrity() at startup or inside /readyz health probes to verify chain integrity.
FastAPI Security Lab
Workbench & Health Probes
agentshield serve --port 8090 serves the FastAPI Security Lab with hardened security headers, /health, /healthz, /readyz (returns 503 if audit chain is tampered), and /metrics (Prometheus or JSON).