A quality-assurance engine for LLM-generated code
Project description
AgentGuard
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
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:
- Skeleton → file tree with responsibilities
- Contracts & Wiring → typed stubs with import connections
- Logic → function-by-function implementation
- Challenge → self-review against quality criteria
- 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rlabs_agentguard-0.11.0.tar.gz.
File metadata
- Download URL: rlabs_agentguard-0.11.0.tar.gz
- Upload date:
- Size: 123.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
830df1dd3a59fff72ca22a2bcca8a487569cb8abf0f23d2e37db9fff6e8c15f3
|
|
| MD5 |
60d26fc4b4b49c677e1801e1c9e6611d
|
|
| BLAKE2b-256 |
9c619f0e641b5a98342facd85c211af3822a8571bf0c125f2901a2dd7e428de2
|
Provenance
The following attestation bundles were made for rlabs_agentguard-0.11.0.tar.gz:
Publisher:
publish-pypi.yml on rlabs-cl/agentguard-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rlabs_agentguard-0.11.0.tar.gz -
Subject digest:
830df1dd3a59fff72ca22a2bcca8a487569cb8abf0f23d2e37db9fff6e8c15f3 - Sigstore transparency entry: 1264585263
- Sigstore integration time:
-
Permalink:
rlabs-cl/agentguard-lib@9501dc5d5d7c670634496b8bd77d64b3b22b212c -
Branch / Tag:
refs/tags/v0.11.0 - Owner: https://github.com/rlabs-cl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@9501dc5d5d7c670634496b8bd77d64b3b22b212c -
Trigger Event:
release
-
Statement type:
File details
Details for the file rlabs_agentguard-0.11.0-py3-none-any.whl.
File metadata
- Download URL: rlabs_agentguard-0.11.0-py3-none-any.whl
- Upload date:
- Size: 139.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1630ff3063db8655af323e4764e2be031d37f47edd7127cb781a087281bae45
|
|
| MD5 |
4ed3b75eebfd25fca971d9a681a2ce7d
|
|
| BLAKE2b-256 |
5e33eb4203e46990101838b34123c08fc76e1b4b09e69a99b18cbebaceba289d
|
Provenance
The following attestation bundles were made for rlabs_agentguard-0.11.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on rlabs-cl/agentguard-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rlabs_agentguard-0.11.0-py3-none-any.whl -
Subject digest:
a1630ff3063db8655af323e4764e2be031d37f47edd7127cb781a087281bae45 - Sigstore transparency entry: 1264585395
- Sigstore integration time:
-
Permalink:
rlabs-cl/agentguard-lib@9501dc5d5d7c670634496b8bd77d64b3b22b212c -
Branch / Tag:
refs/tags/v0.11.0 - Owner: https://github.com/rlabs-cl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@9501dc5d5d7c670634496b8bd77d64b3b22b212c -
Trigger Event:
release
-
Statement type: