Guardian Runtime sits securely on your machine, acting as a bodyguard for your code.
Whenever you use AI tools like Cursor or Claude Code, it scans every prompt locally to stop sensitive
secrets and PII from reaching the cloud.
It also tracks your API spending to prevent surprise bills, all without slowing you down.
$ pip install "guardian_runtime[all]"
✓ Successfully installed guardian_runtime-1.3.0
$ guardian_runtime proxy --port 8080
✓ Proxy active on :8080 · OpenAI · Anthropic · Gemini native
# Claude Code sends .env file with AWS key...
🚨 [GUARDIAN BLOCKED] AWS key AKIAIOSFODNN7EXAMPLE found on line 3.
Type y/n to proceed or cancel ›
# Daily budget enforced automatically...
🚨 [BUDGET_EXCEEDED] Spend $5.02 › limit $5.00. Request blocked.
AI coding agents need full access to your codebase. That creates three dangerous, silent risks.
Agents operate in loops. A stuck agent retrying a bug fix or dumping a 1 GB log file into context can generate a $100+ API bill overnight with zero warning.
daily_budget: 5.00
and Guardian blocks any request that would exceed it — instantly, zero cloud dependency.
Terse Mode cuts output tokens by 40–70%.
Agents read your entire workspace. One .env file with an
AWS key in context, and that credential silently travels to an OpenAI or Anthropic cloud server.
Sending production database content or PII (SSNs, emails, Aadhaar numbers) to public LLM APIs violates GDPR, HIPAA, and India's DPDP Act.
Every prompt passes through a strict local security pipeline — entirely on your machine — before being forwarded to the cloud.
localhost:8080 instead of the
cloud. Zero code changes needed — just point the base_url or set an env var..env,
.py, .json) go to the secret scanner. Documents (PDF, DOCX) are
converted to lean Markdown.
tiktoken before forwarding. If today's
spend would exceed your daily_budget, the request is blocked instantly.KEY=value patterns in real-time.
Reports the exact line number.daily_budget: 5.00 in your policy.yaml. Guardian counts tokens
with tiktoken and blocks any request that would push you over your limit./v1beta/models/{model}:generateContent)
formats. Works with any tool that allows setting a custom base URL.~/.guardian_runtime/.
Check live via GET /stats or the
CLI.No signup. No cloud account. Zero configuration required.
pip install "guardian_runtime[all]"
guardian_runtime proxy --port 8080
# Claude Code export ANTHROPIC_BASE_URL=http://localhost:8080 claude # Aider export OPENAI_API_BASE=http://localhost:8080/v1 aider # Gemini CLI export HTTPS_PROXY=http://localhost:8080 gemini # Cursor / Windsurf — Settings → AI → Base URL http://localhost:8080/v1
from guardian_runtime import GuardianRuntime, GuardianRuntimeBlockedError gr = GuardianRuntime() # zero-config try: response = gr.complete( model="gpt-4o", messages=[{"role": "user", "content": user_input}], raise_on_block=True ) print(response.content) except GuardianRuntimeBlockedError as e: print(f"Blocked: {e.response.violations[0].detail}")
guardian_runtime init:
version: "1.0" agents: default: llm: provider: openai default_model: gpt-4o input_guard: scanner_enabled: true jailbreak_detection: true cost: daily_budget: 5.00 # Hard block at $5/day max_input_tokens: 20000 # Block oversized context optimizer: enabled: true terse_mode: true # Cuts output tokens 40–70%
Guardian works with any AI tool that allows setting a custom base URL — no source code modification required.
.env files to
the cloud. Guardian sits between them and Anthropic/OpenAI.guardian_runtime proxy --port 8080
export ANTHROPIC_BASE_URL=http://localhost:8080
claude
# Agent tries to upload .env...
🚨 [GUARDIAN BLOCKED] secret detected on line 1
AWS_KEY=AKIAIOSFODNN7EXAMPLE
Type y/n to proceed ›
# 1. Start proxy guardian_runtime proxy --port 8080
# 2. Cursor Settings → Models → Override Base URL http://localhost:8080
# You ask: "explain this AWS config"
🚨 [GUARDIAN BLOCKED]
PII detected: email address on line 7
Proceed? y/n ›
from langchain_openai import ChatOpenAI llm = ChatOpenAI( model="gpt-4o", base_url="http://localhost:8080/v1", api_key="sk-proj-..." )
BadRequestError: 🚨 [BUDGET_EXCEEDED]
Daily spend $50.04 exceeds limit $50.00.
# Entire agent chain stops cleanly.
from guardian_runtime import GuardianRuntime gr = GuardianRuntime.from_policy("policy.yaml") response = gr.complete(messages=[...]) # response.blocked → True if threat caught # response.violations → list of what was found # response.estimated_cost_usd → spend this call
✓ response.blocked = False
✓ response.content = "Here is the answer..."
estimated_cost_usd = 0.0021
tokens_in = 312, tokens_out = 89
guardian_runtime convert report.pdf --out clean.md
# Or check live session stats: guardian_runtime analytics
curl http://localhost:8080/stats
⛨ GuardianRuntime Document Converter
Processing: financial_report.pdf
✓ Conversion Complete!
Token Count : 14,205
Saved to : clean.md
⛨ Proxy active on http://127.0.0.1:8080
Mode: Zero-Config · Providers: All
✓ Token Count: 14,205
✓ Saved to: clean.md
🛑 [HIGH] secret_detected
AWS Access Key ID found on line 1
Claude Code
Cost $2.31 · Requests 54 · Blocked 3
policy.yaml in the
current directory.policy.yaml for syntax
errors before restarting the proxy.~/.guardian_runtime/.
curl http://localhost:8080/stats
returns today's cost, tokens, and blocks.