Metadata-Version: 2.4
Name: evrguard
Version: 0.1.1
Summary: Policy enforcement for AI agents. Every action checked before it runs.
Author-email: Evrmind Limited <ibrahim@evrmind.io>
License: MIT
Project-URL: Homepage, https://labs.evrmind.io
Project-URL: Repository, https://github.com/Evrmind-UK/evrguard-sdk
Project-URL: Documentation, https://labs.evrmind.io/evrguard
Keywords: ai,safety,agents,guardrails,verification
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENCE
Dynamic: license-file

# EvrGuard

[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![PyPI version](https://img.shields.io/pypi/v/evrguard.svg)](https://pypi.org/project/evrguard/)

**Policy enforcement for AI agents. Every action checked before it runs.**

---

## What is EvrGuard?

EvrGuard checks what your AI agent is about to do, before it does it.

This package is the Python client. You decorate the tools your agent can
call; before each call executes, the action is sent to the EvrGuard API,
which checks it against your configured constitution and compliance rules
and returns one of three verdicts:

| Verdict | Meaning | Effect |
|---------|---------|--------|
| `PASS`    | No rule matched | The wrapped function runs |
| `STEERED` | A rule matched; a compliant alternative is suggested | `EvrmindSteered` is raised; the function does not run |
| `BLOCKED` | The action is refused outright | `EvrmindBlocked` is raised; the function does not run |

Enforcement is done by the decorator, in your process. When a verdict is
`STEERED` or `BLOCKED` the exception is raised before the wrapped function
is invoked, so the action cannot proceed regardless of what the model does
next.

Verification itself runs in the hosted EvrGuard API. This repository
contains the client and an MCP server, not the verification engine.

## Quick Start

```python
from evrguard import EvrmindGuard

guard = EvrmindGuard(api_url="https://api.evrmind.io", api_key="evk_...")

@guard.wrap_tool
def execute_query(sql):
    return db.execute(sql)
```

Each tool you want guarded needs the decorator.

## Installation

```bash
pip install evrguard
```

Python 3.9 or newer. The client uses only the standard library.

## Fails closed

If the EvrGuard API cannot be reached, the client does not fall through
and allow the action. After exhausting retries it returns a `BLOCKED`
verdict with the proof hash `API_UNREACHABLE`, so the wrapped function
still does not run.

Network failure cannot become a silent bypass.

## MCP Server for Claude Code

EvrGuard ships an MCP server. Add to your `.mcp.json`:

```json
{
  "mcpServers": {
    "evrguard": {
      "command": "python",
      "args": ["-m", "evrguard.mcp_server"],
      "env": {
        "EVRGUARD_API_URL": "https://api.evrmind.io"
      }
    }
  }
}
```

Restart Claude Code. This exposes an `evrguard_verify` tool that the agent
can call to check an action. Note that this is advisory: the MCP server
offers verification to the agent, it does not intercept the agent's own
built-in tools. For enforcement that cannot be skipped, use the
`wrap_tool` decorator around your own tool functions.

## Features

- **Three verdicts** — `PASS`, `STEERED`, `BLOCKED`, returned per action.
- **Blocking decorator** — `@guard.wrap_tool` raises before the wrapped
  function runs. Enforcement does not depend on the model agreeing.
- **Fails closed** — an unreachable API produces a blocking verdict, not
  a bypass.
- **Signed verdicts** — each verdict carries an HMAC-SHA256 signature
  generated by the service, so a verdict record can be checked for
  tampering.
- **Monitor mode** — record verdicts without blocking, to measure impact
  before enforcing.
- **Allowlist mode** — allow only explicitly permitted actions and refuse
  everything else.
- **Industry constitutions** — pre-built rule sets that ship in the
  `constitutions/` directory.
- **Regulatory compliance packs** — rule sets derived from published
  regulations, selectable per account. Each pack cites the article or
  section a rule comes from. These are an enforcement aid, not legal
  advice, and do not by themselves establish compliance.

## Testing

Tested against an internal adversarial suite. Those test cases are not
distributed with this package.

## Industry Constitutions

| Industry                | Use For                                 |
|-------------------------|-----------------------------------------|
| General Enterprise      | Any business using AI agents            |
| Financial Services      | Banks, trading, fintech, payments       |
| Healthcare              | Hospitals, clinics, health tech         |
| Legal                   | Law firms, legal tech, compliance       |
| DevOps / Engineering    | Software teams, coding agents           |
| Retail / E-commerce     | Online retailers, marketplaces          |
| Education               | Schools, universities, edtech           |
| Insurance               | Insurers, brokers, insurtechs           |
| Government              | Public sector, civil service            |
| Critical Infrastructure | Energy, water, telecoms, transport      |

All ten templates ship in the `constitutions/` directory.

## Integration Examples

| Framework  | Example                                                          |
|------------|------------------------------------------------------------------|
| LangChain  | [examples/langchain_integration.py](examples/langchain_integration.py)   |
| LangGraph  | [examples/langgraph_integration.py](examples/langgraph_integration.py)   |
| AutoGen    | [examples/autogen_integration.py](examples/autogen_integration.py)       |
| CrewAI     | [examples/crewai_integration.py](examples/crewai_integration.py)         |
| Claude Code| [examples/claude_code_setup.md](examples/claude_code_setup.md)           |
| OpenClaw   | [examples/openclaw_setup.md](examples/openclaw_setup.md)                 |

These show the decorator pattern against plain Python functions. They
illustrate the integration shape; they are not framework adapters.

## How it Works

```
   action ─▶  EvrGuard API  ─▶  verdict (PASS / STEERED / BLOCKED)
                                 │
              decorator raises ◀─┘  on STEERED or BLOCKED
```

The client sends the action description to the API and acts on the
verdict it returns. The verification engine runs in the hosted service.

## Licence

MIT. See [LICENCE](LICENCE).

Copyright © 2026 Evrmind Limited.

---

[labs.evrmind.io](https://labs.evrmind.io) · [GitHub](https://github.com/Evrmind-UK/evrguard-sdk) · [PyPI](https://pypi.org/project/evrguard/)
