Catalog PyPI
PACKAGE EXPLORERView in registry

agent-action-policy

PyPI

Declarative action policies for AI agents — approve, deny, or escalate any tool call before execution

agentai-agentguardrailllmpolicysafetysecuritytool-use
Versions collected1
Direct dependencies1From release 0.1.1
Last observed20 Oct, 21:27 UTC

README

Version 0.1.1 documentation

agent-action-policy

한국어 문서

Declarative action policies for AI agents — approve, deny, or escalate any tool call before execution.

Install

pip install agent-action-policy
pip install agent-action-policy[yaml]  # for YAML policy files

Quick Start

from action_policy import PolicyEngine, Action

engine = PolicyEngine.from_dict({
    "policies": [{
        "name": "no-force-push",
        "match": {"tool": "bash", "args_pattern": "git push --force"},
        "action": "deny",
        "reason": "Force push requires human approval",
    }]
})

decision = engine.evaluate(tool="bash", args={"command": "git push --force origin main"})
print(decision.denied)  # True
print(decision.reason)  # "Force push requires human approval"

Sandboxing vs Policy

Sandboxing (containers)Policy (this library)
ControlsWhere code runsWhat the agent can do
GranularityProcess-levelPer-tool-call
ConfigurationInfrastructureYAML/Python
Use withAny runtimeAny agent framework

Sandboxing and policies are complementary. Use both.

Policy Definition (YAML)

policies:
  - name: no-destructive-git
    match:
      tool: bash
      args_pattern: "git (push --force|reset --hard|branch -D)"
    action: deny
    reason: "Destructive git operations require human approval"

  - name: escalate-system-files
    match:
      tool: "~(file_write|write_file)"
      path_patterns:
        - "/etc/*"
        - "/usr/*"
    action: escalate
    reason: "System file modification needs confirmation"

  - name: approve-reads
    match:
      tool: "~(read|search|grep)"
    action: approve
    priority: 10  # lower = higher priority

Built-in Templates

engine = PolicyEngine.from_template("safe_coding")
TemplateWhat it protects
safe_codingBlocks force-push, rm -rf, system file writes, credential access, hook skipping
safe_browsingBlocks internal URLs, file:// protocol, escalates downloads
safe_databaseBlocks DDL (DROP/TRUNCATE), escalates DELETE and WHERE-less UPDATE
strictWhitelist mode — only read operations allowed, everything else denied

Python API

# From YAML file
engine = PolicyEngine.from_yaml("policies.yaml")

# From dict
engine = PolicyEngine.from_dict({"policies": [...]})

# From template
engine = PolicyEngine.from_template("safe_coding")

# Evaluate
decision = engine.evaluate(tool="bash", args={"command": "rm -rf /"})
decision.action     # Action.DENY
decision.denied     # True
decision.reason     # "..."
decision.policy_name  # "no-rm-rf"

# Fail-closed mode (deny by default)
engine = PolicyEngine.from_template("strict", default_action=Action.DENY)

# Decorator
@engine.guard
def execute_tool(tool: str, args: dict = None):
    ...  # raises PolicyDenied or PolicyEscalated

Pattern Matching

Pattern typeSyntaxExample
Exact matchtool_name"bash"
Glob*, ?, [...]"file_*"
Regex~pattern"~(bash|shell|exec)"
Args regexany regex"git\\s+push\\s+--force"
Path globglob or ~regex"/etc/*", "~\\.env$"

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.125 Mar 20261

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

ACCESSIBLE
quartzunit/agent-action-policy

Shared repository data · GitHub

License detected in repository
MIT
License branch / ref
main
Last push
15 Apr 2026
Archived
No
Contributor identities
— · partial collection

Public sponsor counts have not been collected. These signals belong to the repository owner.

Downloads & popularity

0count
Gauge · observed snapshots21 Oct 2026
10.50
2026-10-21: 0 · observed 2026-10-21T18:53:19.7018404Z
21 Oct21 Oct

github · 1 observations shown. Missing days are unknown.

View observed values
Date / source periodValueObserved at
2026-10-2102026-10-21T18:53:19.7018404Z

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:27 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:d746bf9fd7712b1a9005ab051691bd3d526ced747e713b807375a02a5560abc3