Skip to main content

AgentGuard

PyPI version Python License: MIT Downloads CI

Agent-native quality engine for LLM code generation. AgentGuard provides structured guidance to your AI agent — it never calls an LLM itself.

878+ monthly installs · Explore Marketplace · Documentation


🎬 Video Tutorials

New to AgentGuard? Watch the demo series:

# Video Duration
00 What is AgentGuard? — Explainer 3:54
01 Installation & Setup from Zero 3:44
02 Create a Project from Scratch with AI ~6 min
03 Automatic Documentation — ADR, PRD & Dev Guide ~5 min
04 Migration: Spaghetti → CQRS Architecture ~6 min

🇪🇸 Spanish versions also available — see full playlist


Why AgentGuard

AI agents generate code fast. But without structure, they hallucinate imports, skip error handling, and produce inconsistent architecture.

AgentGuard gives your agent a disciplined framework — without replacing it. It's the quality layer between your AI and your codebase.

What It Does

AgentGuard is an MCP server that gives your AI agent (Claude, GPT, Gemini, etc.) a disciplined process for generating production-ready code:

  1. Skeleton → file tree with responsibilities
  2. Contracts & Wiring → typed stubs with import connections
  3. Logic → function-by-function implementation
  4. Challenge → self-review against quality criteria
  5. Validate → static analysis (syntax, lint, types, imports)

Your agent does the thinking. AgentGuard provides the framework.

Installation

pip install rlabs-agentguard

That's it. One command, no extras, no API keys needed.

Configure Your IDE

Claude Desktop / Claude Code

Add to your MCP config:

{
  "mcpServers": {
    "agentguard": {
      "command": "agentguard-mcp"
    }
  }
}

Cursor / Windsurf

Add to .cursor/mcp.json or equivalent:

{
  "mcpServers": {
    "agentguard": {
      "command": "agentguard-mcp"
    }
  }
}

Python (direct)

python -m agentguard  # starts MCP server on stdio

Quick Example — What You Get

Ask your agent: "Build a REST API for task management using AgentGuard"

AgentGuard's skeleton tool returns a structured file tree:

src/
├── app.py              # FastAPI application entry point
├── config.py           # Environment and app configuration
├── models/
│   └── task.py         # Task SQLAlchemy model
├── routers/
│   └── tasks.py        # CRUD endpoints for /tasks
├── services/
│   └── task_service.py # Business logic layer
└── tests/
    └── test_tasks.py   # Endpoint + service tests

Then contracts_and_wiring generates typed stubs with all imports wired:

# src/routers/tasks.py
from fastapi import APIRouter, Depends, HTTPException
from ..services.task_service import TaskService
from ..models.task import Task, TaskCreate, TaskUpdate

router = APIRouter(prefix="/tasks", tags=["tasks"])

@router.get("/", response_model=list[Task])
async def list_tasks(service: TaskService = Depends()) -> list[Task]: ...

@router.post("/", response_model=Task, status_code=201)
async def create_task(payload: TaskCreate, service: TaskService = Depends()) -> Task: ...

Your agent fills in the logic. AgentGuard ensures the structure is right from the start.

Tools

Agent-Native (structured guidance — no API key)

Tool Purpose
skeleton L1: file tree with responsibilities
contracts_and_wiring L2+L3: typed stubs with imports (saves ~15K tokens vs separate calls)
contracts L2 only: typed function/class stubs
wiring L3 only: import and call-chain connections
logic L4: implement one function body
get_challenge_criteria Self-review criteria for an archetype
digest Compact project summary for efficient review
debug Structured debugging protocol
migrate Migration plan with compatibility checks

Utility

Tool Purpose
validate Mechanical code checks (syntax, lint, types, structure)
list_archetypes List all available project archetypes
get_archetype Get detailed archetype configuration
reload_archetypes Pick up newly installed archetypes
trace_summary Get cost & token tracking summary
docs Get AgentGuard documentation on any topic
update_agentguard Update to the latest version from PyPI

Built-In Archetypes

Archetype Tech Stack
api_backend Python + FastAPI (production)
library Python reusable package (production)
cli_tool Python CLI with subcommands
react_spa TypeScript + React SPA (production)
web_app Python + TypeScript full-stack (production)
script Python one-off automation
debug_backend Python/FastAPI debugging protocol
debug_frontend React/TypeScript debugging protocol

+ 61 community archetypes on the AgentGuard Marketplace — browse, install, and publish your own.

Marketplace

Install community archetypes:

# From the AgentGuard marketplace (agentguard.rlabs.cl)
# Use the reload_archetypes tool after installing

How It Works

AgentGuard is agent-native: every tool returns structured prompts and criteria that your AI agent processes. The tool never calls an external LLM.

Your Agent (Claude, GPT, etc.)
    │
    ├── calls skeleton(spec, archetype) ─────→ returns L1 file tree prompt
    ├── calls contracts_and_wiring(spec, skeleton) → returns L2+L3 stubs prompt
    ├── calls logic(file, function) ─────────→ returns L4 implementation prompt
    └── calls get_challenge_criteria() ──────→ returns review criteria
    └── calls validate(files) ───────────────→ returns static analysis results

The agent reads the prompt, generates the code, validates it, and loops back if criteria aren't met. AgentGuard provides the structure — your agent provides the intelligence.

Development

pip install -e ".[dev]"
pytest tests/
ruff check agentguard/

Latest Release

See CHANGELOG.md for the full version history.

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines on:

  • Setting up your dev environment
  • Creating custom archetypes
  • Submitting pull requests

Looking for a place to start? Check out issues labeled good first issue.

License

MIT — see LICENSE.

Release files for rlabs-agentguard 0.15.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rlabs-agentguard 0.15.0
File Size Uploaded
rlabs_agentguard-0.15.0.tar.gz 147.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rlabs-agentguard 0.15.0
File Interpreter ABI Platform
rlabs_agentguard-0.15.0-py3-none-any.whl Python 3 none any Details

Total release size: 306.4 kB

Release files / rlabs_agentguard-0.15.0.tar.gz

Download URL rlabs_agentguard-0.15.0.tar.gz
Size 147.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f609c805511de387c3d1781e8daacc59f4885c9260cac84fa77b2d7ca4b0f0f9
BLAKE2b-256 checksum
How to use checksums
65e8976880068d68724c05151020da9b8d5fe024f02c7ed101fe02e568d9076a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

Release files / rlabs_agentguard-0.15.0-py3-none-any.whl

Download URL rlabs_agentguard-0.15.0-py3-none-any.whl
Size 158.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
337d34f29635e0364aa4449fd2c833d8a844d6dafe1d00624bbf7a5a4f0f2518
BLAKE2b-256 checksum
How to use checksums
cee9d369e76b1a9352d21351c1b2e09ebfc5297a454715fe6b868e9074b6cbb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.15.0 This release

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.3

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.1

2 release files

0.9.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page