Skip to main content

Policy-as-code runtime for AI agents — audit log + hard-no enforcement.

Project description

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 modelsPolicy, 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.
  • CLIagentguard 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.

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

devtrust_agentguard-0.0.1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

devtrust_agentguard-0.0.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file devtrust_agentguard-0.0.1.tar.gz.

File metadata

  • Download URL: devtrust_agentguard-0.0.1.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for devtrust_agentguard-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7b553498c11c697c7462c8540aeb16c77bb1e9d0fb456ccc50c7a03ae91f8a47
MD5 f4c59b19df4ff37a17e1740258df0dda
BLAKE2b-256 cae8e286a74f466a95bb840c45baabd14062d3dc2216c60fcc1921c24bb8baf3

See more details on using hashes here.

Provenance

The following attestation bundles were made for devtrust_agentguard-0.0.1.tar.gz:

Publisher: release.yml on AbdullahBakir97/DevTrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file devtrust_agentguard-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for devtrust_agentguard-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ac0d22eb9bf9da0748da9962aea7bd0439a276c01bb62c09057e2749aed49a01
MD5 ec7d032c59d7e5f5d009928f474c1964
BLAKE2b-256 c073146a6556b9128f916639b2d13514bc0ce0fb1bd5bdca6431919f96b5b515

See more details on using hashes here.

Provenance

The following attestation bundles were made for devtrust_agentguard-0.0.1-py3-none-any.whl:

Publisher: release.yml on AbdullahBakir97/DevTrust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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