Skip to main content

awgov

The platform's Policy Decision Point for tool calls. One YAML sanction file (agent_policy.yaml, the sanction file in the platform's config) decides; the answer is one of:

  • allow — a grant covers every descriptor the call resolves to;
  • deny — a destructive floor fired (G1..G16) or no grant covers a descriptor; the verdict carries the lane that should have been used instead;
  • needs_owner — a B2/B3 call; a decision card is raised, never a raw prompt. The card SHOWS the whole call in its facts (the command, or every input field but the agent's own description and timeout) and carries call sha256:<digest> of it (principal, session, tool, input, cwd). When the owner approves it with a signed answer (a passkey/TOTP sign-in, verified by awstorage.attest.verify_receipt), the agent's re-run of that same call is admitted once (verdict.rule_id == "owner-approved"). Refused: an unsigned answer, a different call, a second run, a call with two steps of the kind or carrying a secret-looking value (the card says approving runs nothing), and any step the call's grants do not cover. A deny cools the call and its family down for AWGOV_ASK_TTL_S (900 s); a session holds at most three open asks. AWGOV_ADMIT=0 turns admission off. The card names the session whose call it is, so the owner's answer is written into that session's steering mailbox: the agent that has to re-run the call hears the answer without polling the card.
  • a standing permit lifts G12 (spend) without a card per call. The owner signs one permit card (awgov permit request) whose facts ARE the grant: one op on one loopback/fleet host, a per-call max_price_per_hour ceiling, a number of uses and an expiry of at most 24 h. A spend call it covers is allowed as rule_id == "owner-permit", and each use is counted. The call must be one literal POST to http://<host>/api/op/<op>, with nothing that can reroute it, and a JSON body inside the ceiling. Anything else still asks per call. A permit never lifts a send, a secret write or a publish.

Claude Code reaches it through a PreToolUse hook. P1 is shadow: awgov computes and audits every call and never blocks (hook_response returns {}). Enforce is a mode switch on the hook, not a code change.

API

from awgov import evaluate, hook_response, load_policy
from awgov.audit import record

verdict = evaluate(payload, principal="agent:atlas")   # "owner-tty" by default
verdict.decision      # "allow" | "deny" | "needs_owner"
verdict.rule_id       # "G1" | "grant" | "default" | "error"
verdict.lane          # the platform lane to use instead, or ""
verdict.b_code        # "" | "B2" | "B3"
verdict.descriptors   # ("fleet:read:podman.logs", ...)

hook_response(verdict, "shadow")    # {} -- no decision
hook_response(verdict, "enforce")   # {"hookSpecificOutput": {...}}
record(verdict, payload, principal, "shadow")   # append-only, never raises

load_policy(path=None) reads AWGOV_POLICY, else the repo's the sanction file agent_policy.yaml, else a built-in deny floor (reads only), and caches by mtime.

Parsing, not pattern matching

A command is split into steps on unquoted separators, $(...) substitutions are parsed as their own commands, and every step is resolved through env, sudo, wsl -d X -u root --, nsenter, bash -c, pwsh -Command and cmd /c before it is classified on the resolved argv. rg -n "rm -rf .git" .claude/hooks is a read; the text it searches for is data, never a verb.

CLI

awgov check --tool Bash --command "git status"
awgov check --tool Edit --path C:/x/y.py --principal agent:lyra
echo '<PreToolUse json>' | awgov hook          # AWGOV_MODE=shadow|enforce
awgov replay --days 5                          # read-only audit of transcripts
awgov permit request --op burst_up --host 127.0.0.1:8200 --max-price 1.6 --uses 3 \
    --session <session id>                     # the session the signed answer reaches
awgov permit status                            # permits, their terms and uses
awgov --self-test                              # incident + sanctioned fixture

replay exits 1 if any READ-class command was denied (the false positive the parser exists to prevent) and 2 if it could not read the transcripts.

Wiring into hookd

The durable host service (awdk/adk/harnesses/hookd.py) gets a POST /pdp route that forwards the PreToolUse body here, sets AITHER_PDP_PRINCIPAL from the daemon's session record (owner-tty for the owner, agent:<name> or tainted:<name> for workers) and returns the hook_response JSON verbatim. The hook must be HTTP and must never exit non-zero in shadow.

Tests

python -m pytest tests -q          # from this package's directory
python -m pytest ../../dev/tests/test_awgov_policy.py -q --noconftest

Every incident command must deny for owner-tty; every sanctioned ops command must allow for both owner-tty and agent:atlas. Tests point AWGOV_HOME at a temp dir — nothing under ~/.aither is written by a test run.

Metadata

Release files for awgov 0.1.8

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

Source distribution (sdist)

Source distribution for awgov 0.1.8
File Size Uploaded Provenance Actions
awgov-0.1.8.tar.gz 94.8 kB Without provenance Details for awgov-0.1.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for awgov 0.1.8
File Interpreter ABI Platform Actions
awgov-0.1.8-py3-none-any.whl Python 3 none any Details for awgov-0.1.8-py3-none-any.whl

Total release size: 175.9 kB

Release files / awgov-0.1.8.tar.gz

Download URL awgov-0.1.8.tar.gz
Size 94.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f0df45a93047cd8b3c4b6ce79b11b3cfdaed183e572735656e3e8e8dcec802c5
BLAKE2b-256 checksum
How to use checksums
245cf31e84ba3d06afad2c9b5fac6e53ab12dc7c593a42303fd5352d59492b2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / awgov-0.1.8-py3-none-any.whl

Download URL awgov-0.1.8-py3-none-any.whl
Size 81.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d87160d592e4828e894198b37cabf179477aae5110bb7dada0addd9d327c1e03
BLAKE2b-256 checksum
How to use checksums
d93fda4d16e9bc54744111ed68146de6364d8b3b62747241d7e29f555ff98a89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for awgov 0.1.8

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files No provenance

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