Skip to main content

Rules-as-Markdown AI agent governance validator. 33 compliance checks, Google A2A compatible, soul.py powered.

Project description

Agent Validator ๐Ÿ›ก๏ธ

Rules-as-Markdown governance engine for AI agent deployments. Validates any GitHub repo against enterprise compliance standards before it ships.

PyPI version License: MIT Powered by soul.py A2A Compatible arXiv

Point it at a GitHub repo. Get back a structured report card: PASS / WARN / FAIL across security, structure, safety, and governance rules โ€” before the agent ever touches production.

curl -X POST https://your-validator/validate \
  -H "Content-Type: application/json" \
  -d '{"repo_url": "https://github.com/your-org/your-agent", "submitter": "you"}'

Or install and run locally in seconds:

pip install soul-agent-validator
soul-validator serve         # starts at http://localhost:8080
soul-validator validate https://github.com/your-org/your-agent

Why

AI agents are being deployed into production with no pre-flight checks. They carry hardcoded secrets, call unauthorized APIs, skip PII redaction, have no rate limiting, and lack governance documentation. Agent Validator catches all of this before deployment โ€” running 33 rules in seconds against any public or private GitHub repo.

Rules are plain Markdown. You can read them, edit them, and PR them. No DSL, no YAML schema, no proprietary format.


What It Checks (33 rules across 4 tiers)

Tier Rules Effect
HARD โ€” security gates SEC-001 (hardcoded secrets), SEC-002 (banned imports), SEC-003 (SSRF), A2A-001 (agent card), A2A-002 (A2A endpoint) โŒ Reject โ€” agent cannot deploy
SOFT โ€” warnings Rate limiting, PII redaction, error handling, input validation, data residency โš ๏ธ Warn โ€” deployable but flagged
QUALITY โ€” best practices README, CHANGELOG, SOUL.md, test coverage, dependency pinning ๐Ÿ“‹ Advisory only
A2A compliance .well-known/agent.json, JSON-RPC 2.0 endpoint, tasks/send method Checked against Google A2A spec

Full rule definitions: rules/


Google A2A Compatible

Agent Validator is itself a Google A2A-compatible agent. It serves:

  • GET /.well-known/agent.json โ€” agent card with capabilities
  • POST /a2a โ€” JSON-RPC 2.0 tasks/send method

Orchestrators (LangGraph, CrewAI, ADK) can call it as a tool. Pass a GitHub URL, get a validation result.

POST /a2a
{
  "jsonrpc": "2.0",
  "method": "tasks/send",
  "params": {
    "message": {
      "parts": [{"text": "validate https://github.com/your-org/your-agent"}]
    }
  }
}

Architecture

agent-validator/
โ”œโ”€โ”€ main.py              # FastAPI app โ€” REST + A2A endpoints
โ”œโ”€โ”€ engine/
โ”‚   โ”œโ”€โ”€ validator.py     # Orchestrates all rules, clones repo, runs checks
โ”‚   โ”œโ”€โ”€ rule_loader.py   # Parses rules/*.md โ†’ Rule objects
โ”‚   โ”œโ”€โ”€ report.py        # Builds structured ReportCard
โ”‚   โ”œโ”€โ”€ handlers/        # Check implementations (regex, AST, structure)
โ”‚   โ””โ”€โ”€ soul/            # soul.py identity files (SOUL.md, MEMORY.md)
โ”œโ”€โ”€ rules/               # All rules as Markdown โ€” edit to customize
โ”‚   โ”œโ”€โ”€ tier1-hard-gates.md
โ”‚   โ”œโ”€โ”€ tier2-soft-gates.md
โ”‚   โ”œโ”€โ”€ tier3-quality.md
โ”‚   โ”œโ”€โ”€ a2a-compliance.md
โ”‚   โ””โ”€โ”€ RULES.md         # Rule index + authoring guide
โ”œโ”€โ”€ ui/                  # Single-page frontend (plain HTML/JS)
โ””โ”€โ”€ docs/                # GitHub Pages landing + API reference

The rule engine parses Markdown at startup. Each rule has:

  • Tier (HARD/SOFT/QUALITY)
  • Check type (regex_scan, ast_check, structure_check)
  • Parameters (YAML block in the Markdown)
  • Pass condition and failure message

Add a rule = write a Markdown file. No code changes required.


Custom Rules

Copy rules/tier1-hard-gates.md as a template and create rules/custom.md:

## RULE: CUSTOM-001 โ€” No Direct DB Writes

**Tier:** HARD (fail = reject)
**Check type:** regex_scan
**Tags:** data-integrity

### Description
Agents must not write directly to the database. All mutations must go through the data layer.

### Parameters
```yaml
patterns:
  - "execute\\s*\\(.*INSERT"
  - "execute\\s*\\(.*UPDATE"
file_glob: "**/*.py"

Failure Message

โŒ Direct DB write detected. Use the data access layer instead.


---

## Quickstart (Local)

**Prerequisites:** Python 3.11+, `git` installed on PATH (for repo cloning).

```bash
# 1. Clone
git clone https://github.com/menonpg/agent-validator-oss.git
cd agent-validator-oss

# 2. Install dependencies
pip install -r requirements.txt

# 3. Set required env vars
export OPENAI_API_KEY=sk-...           # for LLM-judge checks (optional โ€” rule engine works without it)
export SERVICE_URL=http://localhost:8080

# 4. Run
uvicorn main:app --host 0.0.0.0 --port 8080 --reload

# 5. Validate a repo
curl -X POST http://localhost:8080/validate \
  -H "Content-Type: application/json" \
  -d '{"repo_url": "https://github.com/menonpg/soul.py", "submitter": "you"}'
# โ†’ {"job_id": "abc123", "status": "queued"}

# 6. Poll for result
curl http://localhost:8080/validate/abc123

Open http://localhost:8080 in your browser for the full UI.

No LLM key? The regex, AST, and structure checks all run without one. Only llm_judge checks require OPENAI_API_KEY โ€” the report will skip those rules gracefully.


Deploy

Docker:

docker build -t agent-validator .
docker run -p 8080:8080 \
  -e RULES_VERSION=v1.0.0 \
  -e SERVICE_URL=https://your-domain.com \
  agent-validator

Cloud Run (GCP):

gcloud run deploy agent-validator \
  --source . \
  --region us-central1 \
  --allow-unauthenticated

Railway:

railway up

soul.py Integration

The validator's governance auditor persona is powered by soul.py โ€” it loads engine/soul/SOUL.md and engine/soul/MEMORY.md on startup to maintain consistent, principled review behavior across validations.

Related paper: Persistent Identity in AI Agents โ€” arXiv:2604.09588


License

MIT โ€” use it, fork it, embed it in your CI pipeline.

Built by The Menon Lab

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

soul_agent_validator-0.1.2.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

soul_agent_validator-0.1.2-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file soul_agent_validator-0.1.2.tar.gz.

File metadata

  • Download URL: soul_agent_validator-0.1.2.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for soul_agent_validator-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6df4a4f607530d62bae03b2668943b57ca42abb98fe64146a424255cf9fee75a
MD5 3f92ddb022d562243cdfa03c77c2b7f2
BLAKE2b-256 9d27ed8ea6c7def64196c22b346520873510f15cf7a5f91f2191cb44af159768

See more details on using hashes here.

File details

Details for the file soul_agent_validator-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for soul_agent_validator-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fab3f10b9c5e63f50039bcd0488df59bc2daa8ae8bcac7cdcd34ce01027fd3b2
MD5 53ae1fc2a6afda4db1e6a3b837345a4e
BLAKE2b-256 62e848aa94f17102f6f66ddf7b1b316d0f801f66356350f2e7ec905ff00a36a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page