Skip to main content

Agent Action Guard

Agent Action Guard

Framework to block harmful AI agent actions before they cause harm — lightweight, real-time, easy-to-use.

PyPI Website Medium npm

PyPI Downloads AI LLMs Python License: CC BY 4.0


🚀 Quick Start

Python package support: Python 3.10 through Python 3.14.

Python 3.14 on Intel macOS: ONNX Runtime does not currently publish a CPython 3.14 x86_64 macOS wheel. Agent Action Guard automatically uses ONNX's ReferenceEvaluator on that platform; other supported platforms continue to use ONNX Runtime. The repository-local .python-version is Python 3.14, so uv sync exercises the current supported runtime by default.

pip install agent-action-guard
# or
uv add agent-action-guard

For embedding backend options and configuration details—including zero-config ONNX embeddings, custom local ONNX models, OpenAI-compatible embedding APIs, environment variables, and backend precedence—read USAGE.md. The installed packages also provide agent-action-guard for direct JSON, JSON arrays, JSONL batch classification, and agent-action-guard serve for a local HTTP classification API.

Framework integrations ship in this package as agent_action_guard.langchain, agent_action_guard.llamaindex, agent_action_guard.openai_agents, agent_action_guard.autogen, and agent_action_guard.crewai. Framework dependencies remain optional and are only needed by applications using those frameworks.

The same distribution also provides project-level pre-tool-use hook installers for Codex, Claude Code, Cursor, Kiro, OpenCode, Antigravity CLI (agy), GitHub Copilot CLI, OpenClaw, and Hermes Agent via agent-action-guard hooks install --target <target>. Supported target names are codex, claude-code, cursor, kiro, opencode, agy, copilot, openclaw, and hermes.

OpenClaw and Hermes retain their native repository-code trust gates: run openclaw plugins enable agent-action-guard after installing the OpenClaw workspace plugin, and set HERMES_ENABLE_PROJECT_PLUGINS=1 only for trusted repositories when using the Hermes project plugin.

Want to run the evaluation benchmark too?

pip install "agent-action-guard[harmactionseval]"
# or
uv add "agent-action-guard[harmactionseval]"

agent-action-guard harmactionseval

HarmActionsEval caches each model's k value alongside its results. Re-running the same benchmark with a larger --k keeps successful cached results and only continues entries that are still false, starting at the first previously unevaluated attempt. Re-running with the same or a smaller --k does not repeat cached LLM calls. The last_attempt map records per-result attempt coverage for unresolved false entries so the same behavior stays correct when runs use --offset/--limit chunks.

JavaScript Runtime

The repository also ships an npm package in typescript/package.json for screening agent actions in Node.js.

npm install agent-action-guard

If you use pnpm, the equivalent commands are:

pnpm install agent-action-guard

❓ Why Action Guard?

HarmActionsEval found harmful tool use in every evaluated model under its reported adversarial prompts and tool setup. These results describe the tested conditions, not every deployment. 68% of the completed LLM evaluations executed actions at the first attempt for over 95% of the harmful prompts.

Model SafeActions@1
Gemini 3.8 Flash 79.43%
Claude Opus 5 48.23%
GPT 6.1 Sol 25.53%
Qwen 3.5 397B A17B 23.40%
Claude Sonnet 5 3.55%
GPT 6 Luna 3.55%
Grok 4.20 Non Reasoning 2.13%
Gemini 3.1 Flash Lite 0.71%
All 19 model average 11.91%

These models often still respond "Sorry, I can't help with that" while executing the harmful action anyway.

Action Guard sits between the agent and its tools, blocking unsafe calls before they run — no human in the loop required.

Agent Action Guard vs. Luna and Laya

Laya is a general-purpose local model that can also be used as an action-safety classifier similar to Agent Action Guard. The repository comparison benchmark evaluates Agent Action Guard, gpt-5.6-luna, and Laya on the same HarmActions rows. Local classifiers use CPU execution, and warm-up/model-loading time is excluded from the reported per-action latency.

python scripts/compare_laya_harmactions.py
Model HarmActions Accuracy Precision Recall F1 ms/action
Agent Action Guard 97.87% 97.87% 100.00% 97.87% 98.92% 19.66
gpt-5.6-luna 90.07% 90.07% 100.00% 90.07% 94.78% 3381.72
Laya 51.06% 51.06% 100.00% 51.06% 67.61% 815.86

The benchmark uses the same HarmActions rows for all classifiers; CPU execution is forced for the local systems to make the latency comparison more consistent.

Iceberg


⚙️ How It Works

  1. Agent proposes a tool call
  2. Action Guard classifies it using a lightweight neural network trained on the HarmActions dataset
  3. Harmful calls are blocked; safe calls proceed normally
Workflow Demo

🆕 Contributions:

  • 📊 HarmActions — safety-labeled agent action dataset with manipulated prompts
  • 📏 HarmActionsEval — benchmark with the SafeActions@k metric
  • 🧠 Action Guard — real-time neural classifier optimized for agent loops
  • 🏋️ Trained on HarmActions
  • ✅ Screens wrapped tool calls before execution
  • 🚫 Blocks harmful and unethical actions automatically
  • ⚡ Lightweight for real-time use

💬 Enjoyed it? Share your opinion.

Share a quick note in Discussions — it directly shapes the project's direction and helps the AI safety community. 🙌 Waiting with excitement for feedback and discussions on how this helps you or the AI community.

⭐ Star the repo if Action Guard is useful to you — it really does help!


📝 Citation

@article{202510.1415,
  title   = {{Agent Action Guard: Classifying AI Agent Actions to Ensure Safety and Reliability}},
  year    = 2025,
  month   = {October},
  publisher = {Preprints},
  author  = {Praneeth Vadlapati},
  doi     = {10.20944/preprints202510.1415.v2},
  url     = {https://www.preprints.org/manuscript/202510.1415},
  journal = {Preprints}
}

📄 License

Licensed under CC BY 4.0. If you prefer not to provide attribution, send a brief acknowledgment to praneeth.vad@gmail.com with the details of your usage and the potential impact on your project.

Project banner


Pro-GenAI
Projects for Next-Gen AI

Metadata

Release files for agent-action-guard 1.2.2

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

Source distribution (sdist)

Source distribution for agent-action-guard 1.2.2
File Size Uploaded Provenance Actions
agent_action_guard-1.2.2.tar.gz 112.3 kB With provenance Details for agent_action_guard-1.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent-action-guard 1.2.2
File Interpreter ABI Platform Actions
agent_action_guard-1.2.2-py3-none-any.whl Python 3 none any Details for agent_action_guard-1.2.2-py3-none-any.whl

Total release size: 227.3 kB

Release files / agent_action_guard-1.2.2.tar.gz

Download URL agent_action_guard-1.2.2.tar.gz
Size 112.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5ef86540f13f7f6d99c8b9a660ef3040cf33de9f728b37671e22d2de8f9acfbf
BLAKE2b-256 checksum
How to use checksums
fe45db3d877f7ad486e8697297e8b32f46b30e9981bd1f784f05751ca8b598ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Oct 29, 2026.

Transparency log

Release files / agent_action_guard-1.2.2-py3-none-any.whl

Download URL agent_action_guard-1.2.2-py3-none-any.whl
Size 115.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
632eb192f8c02f5f6cc7240469166f7d3278ef40466a3dfac462e0fd5cf4b333
BLAKE2b-256 checksum
How to use checksums
8c302edbc727719e8a2e1623062e3c6dba018f8f58c9c7a222fb09db13225682
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Oct 29, 2026.

Transparency log

Security for agent-action-guard 1.2.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agent_action_guard-1.2.2.tar.gz

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 Oct 29, 2026.

Transparency log

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.

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