# AgentGuard install guide

> Install the Python runtime guardrail SDK for AI agents that need budget, loop, timeout, and rate limits.

## Package

- Name: AgentGuard
- Package: agentguard47 (PyPI)
- Install: `pip install agentguard47`
- Import: `agentguard`
- Runtime: Python 3.9+
- License: MIT
- PyPI: https://pypi.org/project/agentguard47/
- Source: https://github.com/bmdhodl/agent47
- Product page: https://bmdpat.com/tools/agentguard
- Full capability map: https://bmdpat.com/skill.md

## External MCP listings

- npm MCP package: https://www.npmjs.com/package/@agentguard47/mcp-server - The read-only MCP server is installable through npm for Claude Code, Cursor, Codex, and other MCP clients.
- MCP Registry: https://registry.modelcontextprotocol.io/?q=agentguard47 - The official registry search surfaces the latest AgentGuard47 MCP entry and npm package metadata.
- PulseMCP: https://www.pulsemcp.com/servers/bmdhodl-agentguard47 - An external MCP directory listing gives buyers another independent discovery path back to the project.

## MCP client config

- Raw config: https://bmdpat.com/tools/agentguard/mcp.json
- Package: `@agentguard47/mcp-server`
- Command: `npx -y @agentguard47/mcp-server`
- Key source: https://app.agentguard47.com/agentguard

```json
{
  "mcpServers": {
    "agentguard": {
      "command": "npx",
      "args": [
        "-y",
        "@agentguard47/mcp-server"
      ],
      "env": {
        "AGENTGUARD_API_KEY": "ag_your_read_key_here"
      }
    }
  }
}
```

Replace `ag_your_read_key_here` with a read-only key from the AgentGuard dashboard.

## Install

- macOS/Linux venv: `python3 -m pip install agentguard47` - Use when a project virtual environment is active and you want pip tied to that Python interpreter.
- Windows venv: `py -m pip install agentguard47` - Use the Python launcher on Windows when it selects the environment you run.
- uv project: `uv add agentguard47` - Use in a uv-managed project to add AgentGuard to pyproject.toml.
- Short pip: `pip install agentguard47` - Use when pip already points at the Python environment your agent runs in.

## Verify

Run this before wiring a real agent:

```bash
agentguard doctor --json
```

The doctor command runs locally. No API key or hosted dashboard is required for the first guarded run.

## Minimal runtime guard

```python
from agentguard import AgentGuardError, BudgetGuard, LoopGuard, TimeoutGuard, Tracer

tracer = Tracer(
    guards=[
        BudgetGuard(max_calls=20),
        LoopGuard(max_repeats=3),
        TimeoutGuard(max_seconds=300),
    ],
)

try:
    with tracer.trace("agent.run"):
        agent.run(task)
except AgentGuardError as exc:
    print(f"AgentGuard stopped the run: {exc}")
```

## Trust checks

- Source proof: Verified PyPI links. PyPI shows repository, docs, issues, and changelog links for bmdhodl/agent47.
- Local proof: No key required. The SDK can run doctor, demo, quickstart, report, and incident commands locally.
- Supply chain: MIT, Python 3.9+. The source repo declares the MIT license, and the PyPI package advertises Python 3.9+ support.
- Runtime scope: Zero runtime deps. The core SDK keeps guardrails in-process instead of adding a required hosted service.

## When to install

- Your agent can call paid APIs in a loop.
- You need a hard ceiling on cost, calls, elapsed time, or call rate.
- You want local guardrails first and MCP visibility later.
- You need one guardrail layer across Anthropic, OpenAI, and local LLMs.

## What it is not

- Not prompt-injection defense.
- Not output schema validation.
- Not a human approval queue.
- Python-only. No JS/TS SDK yet.
