Overview

AgentGuard is a Human-as-a-Service (HaaS) governance layer that sits between AI agents and their tool calls. It validates every MCP tool invocation, classifies risk, and routes high-risk actions to qualified human reviewers for approval before execution.

🛡️

Risk Classification

Policy-driven 4-tier system: LOW → MID → HIGH → CRITICAL. Each tier has configurable approval thresholds.

👥

Multi-Sig Approval

Cross-pool consensus with threshold-based quorum. Higher risks need more approvers from diverse pools.

🔐

Credential Verification

Approvers authenticate via LinkedIn, GitHub, SSO, or OIDC. Skills are verified before review access.

🧠

AIOps Learning

Learns from approval patterns to auto-adjust risk tiers. Consistently-approved tools get downgraded.

📡

MCP Protocol

Official MCP SDK server exposing governance tools. Drop-in integration with Claude, Cursor, and others.

📊

Admin Dashboard

Light-themed admin console for queue monitoring, policy management, and audit log review.

System Architecture

AgentGuard operates as a transparent proxy between AI agents and tool servers. The core validates tool calls, classifies risk, and manages the approval lifecycle.

graph TB subgraph Agent Layer A[AI Agent / LLM] MCP[MCP Client] end subgraph AgentGuard Core INT[MCP Tool Validator] RC[Risk Classifier] SM[State Machine] CA[Consensus Aggregator] AI[AIOps Service] SF[Skill Framework] end subgraph Human Layer DB[Admin Dashboard] AP[Approval Page] IDP[Identity Providers] end subgraph Storage PS[Persistent Store] AL[Audit Log] end A --> MCP MCP --> INT INT --> RC RC -->|LOW| INT RC -->|MID/HIGH/CRITICAL| SM SM --> CA CA --> AP AP --> IDP IDP --> SF SF -->|Verified| CA SM -->|Resolved| AI AI -->|Adjust| RC DB --> SM SM --> PS SM --> AL

Components

HaaS Core (packages/haas-core)

The central governance engine. Contains the risk classifier, state machine, consensus aggregator, identity verification, AIOps learning, and MCP server implementations.

ModuleFilePurpose
Risk Classifierclassifier/risk-classifier.tsPolicy-driven tool name + argument matching → risk tier
State Machinestate/state-machine.tsRequest lifecycle: PENDING → WAITING → APPROVED/REJECTED/TIMEOUT
Consensusconsensus/aggregator.tsSignature collection, threshold checks, multi-pool quorum
MCP Tool Validatormcp/interceptor.tsTransparent tool call validation and governance routing
MCP Servermcp/mcp-server.tsOfficial SDK server exposing governance tools
HTTP Servermcp/server.tsREST API for dashboard, approval, and admin operations
AIOpsaiops/feedback-loop.tsAuto-tunes risk tiers from approval/rejection patterns
Skill Frameworkaiops/skill-framework.tsMaps IdP claims to HaaS approval pools
Auth Factoryauth/factory.tsPluggable identity providers (GitHub, LinkedIn, OIDC, etc.)
Persistent Storestorage/persistent-store.tsFile-backed JSON storage for settings and audit

Admin Dashboard (packages/haas-dashboard)

React + Vite + Tailwind admin console. Monitors governance queue, manages policies and identity providers, and provides shareable approval links for SMEs.

Approval Page (/approve/:requestId)

Standalone page for SME/specialist review. Three-step flow: Authenticate → Verify Skills → Review & Decide. Accessed via shareable links generated from the dashboard.

Request Flow

Every tool call from an AI agent flows through the following lifecycle:

sequenceDiagram participant Agent as AI Agent participant MCP as MCP Tool Validator participant RC as Risk Classifier participant SM as State Machine participant Human as Human Reviewer participant Tool as Tool Server Agent->>MCP: tools/call (transfer_funds) MCP->>RC: classify(toolName, args) RC-->>MCP: CRITICAL (threshold: 3) alt LOW Risk MCP->>Tool: Execute immediately Tool-->>Agent: Result else MID / HIGH / CRITICAL MCP->>SM: createRequest(request, policy) SM-->>MCP: WAITING_FOR_HUMAN Note over SM: Request queued loop Until threshold met or timeout Human->>SM: addSignature(requestId, sig) SM-->>SM: Check consensus end alt Consensus Reached SM-->>MCP: APPROVED MCP->>Tool: Execute Tool-->>Agent: Result else Rejected SM-->>MCP: REJECTED MCP-->>Agent: Error (rejected) else Timeout SM-->>MCP: TIMEOUT MCP-->>Agent: Error (timeout) end end

Approval Flow

When a request needs human approval, the admin dashboard generates a shareable link. The SME/specialist follows this flow:

sequenceDiagram participant Admin as Admin Dashboard participant SME as SME / Specialist participant AP as Approval Page participant IdP as Identity Provider participant SF as Skill Framework participant SM as State Machine Admin->>SME: Share approval link SME->>AP: Open /approve/:requestId AP->>AP: Load request details AP->>IdP: Authenticate (LinkedIn/GitHub/SSO) IdP-->>AP: Claims + credentials AP->>SF: Verify skills match pool alt Skills Match SF-->>AP: ✅ Qualified AP->>SME: Show Review & Decide SME->>AP: Approve / Reject AP->>SM: submitSignature() SM-->>AP: Decision recorded else Skills Mismatch SF-->>AP: ❌ Not qualified AP->>SME: Show blocked message end

Risk Classification

Every tool call is classified into one of four tiers based on configurable policies:

TierThresholdDefault TimeoutPoolsExample
LOWAuto-approve——read_customer_data
MID1 signature3 mingeneralupdate_customer_notes
HIGH2 signatures5 minfinanceapply_discount
CRITICAL3 signatures15 minfinance + security + legaltransfer_funds

Policy Configuration

Policies are defined as JSON arrays, editable via the dashboard Settings page or loaded from config/risk-policies.example.yml:

[
  {
    "tool": "transfer_*",
    "tier": "CRITICAL",
    "threshold": 3,
    "pools": ["finance", "security", "legal"],
    "timeout": "15m",
    "conditions": [
      { "field": "amount", "operator": ">", "value": 10000 }
    ]
  },
  {
    "tool": "read_*",
    "tier": "LOW",
    "autoApprove": true
  }
]

AIOps Feedback Loop

AgentGuard learns from approval patterns and progressively adjusts risk tiers to reduce friction for consistently-approved operations.

graph LR A[Tool Call] --> B[Risk Classifier] B --> C{Approval Decision} C -->|Approved| D[Record Approval] C -->|Rejected| E[Record Rejection] D --> F{50+ consecutive approvals?} F -->|Yes| G[Recommend Downgrade] G --> H{Is CRITICAL tier?} H -->|Yes| I[Block - Protected Tier] H -->|No| J[Auto-downgrade tier] E --> K{5+ consecutive rejections?} K -->|Yes| L[Auto-upgrade tier] F -->|No| M[Continue tracking] K -->|No| M

Safety Guardrails

  • CRITICAL tier is protected — never auto-downgraded, only flagged for manual review
  • Configurable thresholds — default: 50 approvals to downgrade, 5 rejections to upgrade
  • Full audit trail — every adjustment is logged with timestamp and reason
  • Manual override — admins can lock any tool's tier via the dashboard

Skill Framework

The Skill Framework maps identity provider claims to HaaS approval pools, ensuring only qualified personnel can review specific risk categories.

PoolRequired SkillsMinimum Seniority
financeFinancial Analysis, Treasury, Budget Approval, ComplianceSenior
securitySecurity Architecture, Incident Response, Threat AssessmentSenior
engineeringSoftware Engineering, DevOps, Cloud ArchitectureMid-level
legalContract Review, Regulatory Compliance, Data PrivacySenior
executiveStrategic Planning, Executive Oversight, Risk ManagementDirector+
generalGeneral ApprovalAny

Quickstart

Clone & Install

git clone https://github.com/anthropics/agentguard.git
cd agentguard
npm install

Build

cd packages/shared-proto && npx tsc && cd ../..
cd packages/haas-core && npx tsc && cd ../..

Start Everything

Use the deploy script to start the API server + dashboard:

./deploy-mcp.sh

Open Dashboard

Visit http://localhost:5173 for the admin dashboard.

Trigger Demo

Click "Trigger Demo" in the dashboard, or run:

./deploy-mcp.sh demo

Test Approval Flow

Click "Open" next to a pending request → authenticate → verify skills → approve or reject.

Connect MCP Client

For Claude Desktop or Cursor, add to your mcp_config.json:

{
  "mcpServers": {
    "agentguard": {
      "command": "npx",
      "args": ["tsx", "packages/haas-core/src/mcp/mcp-server.ts"],
      "cwd": "/path/to/agentguard"
    }
  }
}

Deployment Modes

CommandDescription
./deploy-mcp.shAPI server (port 3100) + Dashboard (port 5173)
./deploy-mcp.sh httpAPI server only
./deploy-mcp.sh mcpMCP stdio server for Claude Desktop / Cursor
./deploy-mcp.sh demoAPI server + trigger sample scenarios

Persistent Data

Settings and audit logs are stored in .agentguard/ directory:

  • .agentguard/providers.json — Identity provider configuration
  • .agentguard/audit-log.json — Governance decision history
  • .agentguard/policies.json — Risk policy overrides

REST API Reference

All endpoints are served from the HaaS Core HTTP server (default port 3100).

Core Endpoints

POST /mcp/tools/call

Validate a tool call. Body: { method, params: { name, arguments } }

POST /mcp/approve

Submit approval/rejection. Body: { requestId, signature: { approverId, pool, decision, reason } }

GET /pending

List all pending approval tasks.

GET /health

Health check. Returns { status: "ok", uptime }

Settings Endpoints

GET /settings/policies

Get current risk policies.

POST /settings/policies

Update risk policies. Body: { policies: [...] }

GET /settings/providers

Get all identity provider settings.

POST /settings/providers

Save identity provider settings. Body: { providers: [{ name, enabled }] }

GET /settings/providers/enabled

Get only enabled providers (used by approval page).

Monitoring Endpoints

GET /aiops/stats

AIOps learning statistics: tracked tools, adjustments, pending recommendations.

GET /audit/log

Governance audit log (last 100 entries from persistent storage).

POST /demo/trigger

Trigger demo scenarios. Body: { scenario: "all" | "low" | "mid" | "high" | "critical" }

MCP Server Tools

The MCP server exposes five governance tools via the official MCP SDK:

ToolDescriptionParameters
haas_evaluateClassify a tool call's risk without executingtoolName, toolArgs
haas_submitSubmit a tool call for governancetoolName, toolArgs, agentId
haas_statusCheck approval status of a requestrequestId
haas_approveSubmit approval/rejection signaturerequestId, approverId, pool, decision
haas_policiesList current risk policiesnone

Configuration

MCP Client Config

Add to Claude Desktop or Cursor's mcp_config.json:

{
  "mcpServers": {
    "agentguard": {
      "command": "npx",
      "args": ["tsx", "packages/haas-core/src/mcp/mcp-server.ts"],
      "cwd": "/path/to/agentguard"
    }
  }
}

Environment Variables

VariableDefaultDescription
PORT3100HTTP server port
HOST0.0.0.0HTTP server bind address
GITHUB_CLIENT_ID—GitHub OAuth client ID
GITHUB_CLIENT_SECRET—GitHub OAuth client secret
OIDC_ISSUER—OIDC issuer URL

Project Structure

agentguard/
├── packages/
│   ├── haas-core/          # Governance engine
│   │   ├── src/
│   │   │   ├── aiops/      # AIOps + Skill Framework
│   │   │   ├── auth/       # Identity providers
│   │   │   ├── classifier/ # Risk classification
│   │   │   ├── consensus/  # Multi-sig consensus
│   │   │   ├── mcp/        # Validator + servers
│   │   │   ├── state/      # State machine + store
│   │   │   ├── storage/    # Persistent file store
│   │   │   └── telemetry/  # OpenTelemetry spans
│   │   └── tests/
│   ├── haas-dashboard/     # React admin console
│   └── shared-proto/       # Shared types + schemas
├── docs/                   # This documentation
├── config/                 # Example configurations
├── deploy-mcp.sh           # Deployment script
└── mcp-config.json         # MCP client config