🛡️ Agentic Sidecar

Real-time decision supervision for autonomous AI agents. Transform any agent into a trustworthy, auditable, cost-controlled system ready for enterprise deployment.

📦 v0.6.0 • Production Ready • 216+ Tests • 90%+ Coverage

What is Agentic Sidecar?

Simple Concept: A "sidecar" that watches your AI agent and answers one question before EVERY action: "Should this agent do this right now?"

Agentic Sidecar is a real-time decision supervision layer that sits between your AI agent and your business logic. It evaluates every decision using multiple layers of protection:

┌──────────────────────────────────────────────────────────┐
│                  YOUR AI AGENT                           │
│         (Makes decisions, wants to execute)              │
└─────────────────────────┬────────────────────────────────┘
                          │ (Every decision goes here)
                          ▼
┌──────────────────────────────────────────────────────────┐
│           AGENTIC SIDECAR (Decision Gate)                │
│                                                          │
│  Phase 1: Rule-Based Checks (Fast & Cheap)             │
│  ├─ Policy Advisor: Is this tool allowed?              │
│  └─ Risk Evaluator: Is this action risky?              │
│                                                          │
│  Phase 2: Intent Validation                            │
│  ├─ Intent Guardian: Does this match user's request?   │
│  └─ Constraint Checker: Within limits?                 │
│                                                          │
│  Phase 3: Budget & Escalation                          │
│  ├─ Budget Guardian: Within cost/token limits?         │
│  └─ Escalation: Need human approval?                   │
│                                                          │
│  Phase 4: AI Evaluation (Optional)                     │
│  ├─ Planner: Is the plan logical?                      │
│  ├─ Critic: Are there risks?                           │
│  └─ Judge: Independent AI verification                 │
│                                                          │
│  Result: ALLOW, WARN, BLOCK, CHALLENGE, REPLAN, etc   │
└──────────────┬───────────────────────────────────────────┘
               │ (Decision with audit trail)
               ▼
┌──────────────────────────────────────────────────────────┐
│          BUSINESS LOGIC (Executes only if ALLOW)        │
│                                                          │
│  ✅ Process payment  ✅ Issue refund  ✅ Send email     │
│  ❌ Block dangerous  ❌ Pause risky   ❌ Escalate high  │
└──────────────────────────────────────────────────────────┘

All Components (7 Total)

📋
Policy Advisor
v0.1 • Rule-Based
YAML-driven allow/deny rules for tools
  • Tool whitelist/blacklist
  • Role-based access
  • Zero LLM calls
  • Instant decisions
⚠️
Risk Evaluator
v0.1 • Rule-Based
Pattern-based risk classification
  • Tool-level risk scoring
  • Argument pattern matching
  • Configurable thresholds
  • Fast execution
🎯
Intent Guardian
v0.2 • Rule-Based
Constraint validation & intent alignment
  • Constraint enforcement
  • Envelope expiry detection
  • Goal alignment check
  • No LLM overhead
💰
Budget Guardian
v0.4 • Rule-Based
Cost & token limit enforcement
  • Per-task budgets
  • Real-time tracking
  • Pause at limit
  • Cost forecasting
📊
Planner
v0.3 • Rule-Based
Plan-level intent alignment
  • Detects unnecessary steps
  • Finds contradictions
  • Validates constraints
  • Zero LLM calls
🔍
Critic
v0.3 • Pattern-Based
Risk detection & challenge assessment
  • Risky operation detection
  • Large amount flagging
  • Assumption validation
  • Fast heuristics
⚖️
Judge
v0.3 • LLM-Based
Independent AI verification
  • Model-agnostic design
  • Cost tracking
  • Async/sync modes
  • Timeout handling

How Components Work Together

Decision Flow Through All Layers:
Agent Action
→
Policy Check
→
Risk Level
Intent Align
→
Budget Check
→
Planner Review
Critic Challenge
→
Judge Verify
→
Final Decision
✅ ALLOW
or
⚠️ WARN/CHALLENGE
or
❌ BLOCK/PAUSE
Key Insight: Each layer is optional and independent. Enable only what you need. Fast rules first, AI verification last (and only when needed).

Real-World Scenarios

💳 Scenario 1: Refund Error
Without Sidecar:
Customer asks for $50 refund. Agent hallucinates and processes $5,000. Lost.
With Sidecar:
✅ Intent Guardian catches: "$5000 > limit"
✅ Critic flags: "Large amount without evidence"
✅ Correct $50 refund approved
🏥 Scenario 2: Wrong Procedure
Without Sidecar:
Patient requests flu shot. Agent adds pain medication. HIPAA violation.
With Sidecar:
✅ Planner catches: "Medication not in request"
✅ Policy blocks: "Rx requires MD approval"
✅ Only flu shot processed
📊 Scenario 3: Budget Overrun
Without Sidecar:
Process 1000 orders. Agent uses expensive model. $500 bill for $50 budget.
With Sidecar:
✅ Budget Guardian tracks: Real-time costs
✅ At 90%: Alert sent
✅ At 100%: Pauses for human decision
⚖️ Scenario 4: Compliance Breach
Without Sidecar:
Request for case file. Agent sends to external party. Breach of attorney-client privilege.
With Sidecar:
✅ Policy rule: "Case files → internal only"
✅ Judge verifies: "Is this authorized?"
✅ Escalates to human review

How to Integrate (Step-by-Step)

1
Install Package
Install Agentic Sidecar from PyPI
pip install agentic-sidecar==0.6.0
2
Create Sidecar Instance
Initialize with your configuration
from agentic_sidecar import Sidecar sidecar = Sidecar( on_sidecar_failure="fail_closed", risk_block_threshold="HIGH" )
3
Add Components (Optional)
Enable Planner, Critic, Judge as needed
from agentic_sidecar import ( PlanEvaluator, CriticEvaluator, JudgeEvaluator, OpenAIJudge ) sidecar = Sidecar( on_sidecar_failure="fail_closed", planner=PlanEvaluator(enabled=True), critic=CriticEvaluator(enabled=True), judge=JudgeEvaluator( provider=OpenAIJudge(model="gpt-4") ) )
4
Wrap Your Agent
Connect Sidecar to your agent framework (LangGraph, AutoGen, CrewAI)
from agentic_sidecar.adapters.langgraph import attach # Your existing agent agent = create_react_agent(model, tools) # Add protection (1 line) agent = attach(agent, sidecar)
5
Evaluate Decisions
Every decision goes through Sidecar first
from agentic_sidecar import DecisionContext decision = sidecar.evaluate( DecisionContext( tool_name="issue_refund", tool_args={"amount": 500} ) ) if decision.status == "ALLOW": execute_action() elif decision.status == "BLOCK": handle_blocked(decision.reason)
6
Monitor & Iterate
Use CLI for live monitoring and audit trails
# Live execution tracking agentic-sidecar status --follow # View audit trail agentic-sidecar audit --export pdf

Why Agentic Sidecar is Useful

🛡️
Risk Mitigation
Catches dangerous decisions BEFORE execution. No damage control needed.
💰
Cost Control
Real-time budget tracking prevents surprise LLM bills and cost overruns.
👥
Human Oversight
Intelligent escalation for high-value decisions. Reduces human toil.
📋
Audit Trail
Complete decision provenance for compliance and investigation.
⚡
Fast Integration
3 lines of code. Works with your existing agent framework.
✅
Zero Breaking Changes
All features optional. Existing agents work without modification.

Before vs After

Capability Without Sidecar With Sidecar
Error Detection ❌ After execution (damage done) ✅ Before execution (prevented)
Cost Visibility ❌ Only on billing day ✅ Real-time tracking
Human Oversight ❌ Manual review process ✅ Intelligent escalation
Audit Trail ❌ No audit trail ✅ Complete provenance
Decision Transparency ❌ Black box ✅ Full reasoning
Compliance Ready ❌ High risk ✅ SOX/PCI/GDPR ready
Integration Effort ❌ Manual builds ✅ 3 lines of code

Financial Impact

$2.5M
Annual losses prevented
1000 decisions × 0.5% error × $5K loss
11 days
Payback period
Cost to recover on refund errors alone
3,362%
ROI Year 1
Savings / Initial cost

Quick Start (5 Minutes)

👉
Copy This Code
Paste into your Python project
from agentic_sidecar import Sidecar from agentic_sidecar.adapters.langgraph import attach # 1. Create Sidecar sidecar = Sidecar(on_sidecar_failure="fail_closed") # 2. Wrap your agent agent = create_react_agent(model, tools) agent = attach(agent, sidecar) # 3. Run normally result = agent.invoke({"input": user_request}) # Sidecar protects every decision automatically ✅