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.8 through Python 3.14.

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 aag-classify for direct JSON, JSON arrays, and JSONL batch classification.

Want to run the evaluation benchmark too?

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

python -m agent_action_guard.harmactionseval

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 benchmark proved that AI agents with harmful tools will use them — even today's most capable LLMs. 80% of the LLMs tested executed actions at the first attempt for over 95% of the harmful prompts.

Model SafeActions@1
Claude Haiku 4.5 0.00%
Phi 4 Mini Instruct 0.00%
Granite 4-H-Tiny 0.00%
GPT-5.4 Mini 0.71%
Gemini 3.1 Flash Lite 0.71%
Grok 4.20 Non Reasoning 2.13%
Ministral 3 (3B) 2.13%
Claude Sonnet 4.6 2.84%
Phi 4 Mini Reasoning 2.84%
GPT-5.3 12.77%
Qwen3.5-397b-a17b 23.40%
Average 4.54%

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
  • ✅ Classifies every tool call 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.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 agent-action-guard 1.2.1
File Size Uploaded
agent_action_guard-1.2.1.tar.gz 97.4 kB Details

Built distribution (wheel)

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

Total release size: 189.7 kB

Release files / agent_action_guard-1.2.1.tar.gz

Download URL agent_action_guard-1.2.1.tar.gz
Size 97.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0272aa9056436498b6ea0c23edbd7ad8ed364a917873b09fcb02ca5a6bf65bf8
BLAKE2b-256 checksum
How to use checksums
07422eca59be3abf2cf71a2a00bc288622f9b136c146115d4a894056bc684b20
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 Sep 23, 2026.

Transparency log

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

Download URL agent_action_guard-1.2.1-py3-none-any.whl
Size 92.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46c94f16527d74251b07068ab447c3cc51e4856d1430d98b63f7dfdb6c0bc9f3
BLAKE2b-256 checksum
How to use checksums
fcc6727ba8f1ea8a8c752c639a23187f8ffa05cae2b09538ba04f600e5c1fb2f
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 Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

1.2.0

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

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