Skip to main content

AgentGuard (devtrust-agentguard)

Policy-as-code runtime for AI agents — audit log + hard-no enforcement. The Wave 4 governance layer of the DevTrust platform.

Status

v0.0.1 alpha — deterministic policy engine, ContextVar-based agent identity, JSONL audit log, three bundled baseline policies (money-movement, destructive-filesystem, credential-disclosure) plus a composed baseline-starter. CLI for dry-runs.

What ships in v0.0.1:

  • Pydantic models — Policy, Rule, ToolCall, Decision. The on-disk audit-log shape is the same as the in-memory shape; no transformation between them.
  • evaluate(policy, call) — pure function. First-matching-rule-wins. No-match → conservative default-deny.
  • enforce(policy, call, audit=...) — same evaluation, plus appends the Decision as one JSON line to an audit file.
  • with_agent("...") / current_agent() — ContextVar that survives threads and asyncio. Same pattern as agtrace and tokencost.
  • Three baseline policies — opinionated deterministic defaults covering the OWASP Top-10 categories most expressible without an expression DSL.
  • CLI — agentguard version, agentguard policies, agentguard check.

Why

OWASP published a Top-10 for Agentic Applications in December 2025. 96% of enterprises run AI agents in production; only 12% have a central platform to manage them. AgentGuard is the runtime layer that enforces "this agent can read tickets but cannot send mail," with an auditable trail of every allow / deny / approval-needed decision.

Conservative-by-default is the design choice: anything not explicitly allowed is denied. Easier to loosen than tighten.

CLI

agentguard version
agentguard policies
agentguard check --tool stripe.charge --policy baseline-starter
agentguard check --tool fs.delete --policy destructive-filesystem \
                 --arguments-json '{"recursive":true}'

Library use

from agentguard import Policy, Rule, ToolCall, evaluate, enforce, with_agent
from agentguard.baseline import baseline_starter_policy

policy = Policy(
    name="my-agent",
    rules=[
        # Allow rules go FIRST — they short-circuit before the deny rules.
        Rule(name="allow-read-tickets", effect="allow",
             tool="zendesk.read", reason="Read-only access to support tickets."),
        # Then compose the conservative defaults:
        *baseline_starter_policy().rules,
    ],
)

with with_agent("support-bot:installation-12345"):
    decision = enforce(
        policy,
        ToolCall(tool="zendesk.read", arguments={"ticket_id": 42}),
        audit="audit.jsonl",
    )
    if decision.status == "allow":
        # ... call zendesk.read for real
        pass
    else:
        raise PermissionError(decision.reason)

Roadmap

  • v0.1 — YAML / TOML policy file format; OWASP Top-10 detector pack (full); replay-from-audit-log helper that re-runs decisions deterministically.
  • v0.2 — approval workflows (Slack / Teams / email round-trips with timeout + retry); shadow-mode (log denials but don't enforce, for the first 30 days of each new policy).
  • v0.3 — replay + time-travel debugging via agtrace integration; per-agent identity and scoped credentials.
  • v1.0 — visual policy builder (compliance-team-friendly), red-team integration, cross-agent policies, continuous compliance.

Apache-2.0

See CHANGELOG. Part of the DevTrust monorepo.

Metadata

Release files for devtrust-agentguard 0.0.1

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

Source distribution (sdist)

Source distribution for devtrust-agentguard 0.0.1
File Size Uploaded
devtrust_agentguard-0.0.1.tar.gz 13.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for devtrust-agentguard 0.0.1
File Interpreter ABI Platform
devtrust_agentguard-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.0 kB

Release files / devtrust_agentguard-0.0.1.tar.gz

Download URL devtrust_agentguard-0.0.1.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7b553498c11c697c7462c8540aeb16c77bb1e9d0fb456ccc50c7a03ae91f8a47
BLAKE2b-256 checksum
How to use checksums
cae8e286a74f466a95bb840c45baabd14062d3dc2216c60fcc1921c24bb8baf3
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 May 9, 2026.

Transparency log

Release files / devtrust_agentguard-0.0.1-py3-none-any.whl

Download URL devtrust_agentguard-0.0.1-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac0d22eb9bf9da0748da9962aea7bd0439a276c01bb62c09057e2749aed49a01
BLAKE2b-256 checksum
How to use checksums
c073146a6556b9128f916639b2d13514bc0ce0fb1bd5bdca6431919f96b5b515
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 May 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1 This release

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