securing-agentic-ai-tool-invocation
Helps your agent use tools safely. It controls which tools the agent can call to prevent problems.
What it does
This system protects an AI agent from dangerous actions. It ensures the agent only uses allowed tools, with the correct permissions, and may ask for your approval before performing important tasks.
When to use it
- ✓When the AI agent can send emails or make payments.
- ✓When building an AI agent that can modify files or execute code.
- ✓To ensure the AI agent doesn't misuse or over-use tools.
Example of what to ask your AI
“Secure my AI tool calls so they don't cause problems.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
It works by defining which tools the agent can use and how. It can also require your approval for high-risk actions and logs all actions for auditing.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill securing-agentic-ai-tool-invocationOr download just the file:
curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/securing-agentic-ai-tool-invocation/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
Securing Agentic AI Tool Invocation
Authorized-use-only notice: This is a defensive skill. The controls below govern how an AI agent invokes tools/plugins. Deploy them on systems you own or operate. Test guardrail bypasses only against your own agent in a non-production environment.
Overview
Autonomous (agentic) AI systems decide which tool to call, with what arguments, and when, based on model reasoning over untrusted inputs. That makes the tool-invocation boundary the highest-risk control point in an agent: a single successful prompt injection or a poisoned tool can turn the agent into a confused deputy that deletes data, sends money, or pivots into connected systems. The relevant threat is MITRE ATLAS AML.T0053 (LLM Plugin Compromise) and the OWASP Agentic AI Top 10 classes for Tool Misuse, Excessive Agency, and Privilege Compromise.
The defense is layered, defense-in-depth governance of tool calls: (1) a strict allowlist of which tools the agent may call and with which argument shapes; (2) least-privilege identity binding so each tool call runs with scoped, short-lived credentials tied to the acting user/session — not a single god-mode service account; (3) policy enforcement at the call boundary (NVIDIA NeMo Guardrails dialog/flow rails and tool guardrails, or a deterministic policy wrapper); (4) human-in-the-loop (HITL) approval for high-impact actions; and (5) audit logging of every invocation for detection. This skill implements all five with verified, runnable patterns using NeMo Guardrails and a framework-agnostic Python policy wrapper.
When to Use
- When building or hardening an agent that can call tools with real-world side effects (email, payments, file writes, infra changes, code execution).
- When mapping OWASP Agentic AI Top 10 controls onto an existing agent framework.
- When you need to bound the blast radius of prompt injection / tool poisoning.
- When a compliance or governance requirement mandates approvals and audit trails for autonomous actions.
- During an architecture review of an agent's tool layer.
Prerequisites
- Python 3.10+ and a virtual environment.
- An agent/LLM framework you control.
- Install the tooling:
python -m venv .venv && source .venv/bin/activate
# NVIDIA NeMo Guardrails — programmable rails incl. tool/flow controls
pip install nemoguardrails
# JSON schema validation for tool argument allowlisting
pip install jsonschema
# (Optional) cloud SDK for scoped credential issuance, e.g. AWS STS
pip install boto3
Objectives
- Define an explicit tool allowlist with per-tool argument schemas (deny-by-default).
- Bind each tool call to a scoped, short-lived identity instead of a shared service account.
- Enforce a policy decision (allow / require-approval / deny) before every invocation.
- Insert human-in-the-loop approval gates for high-impact tools.
- Wrap an agent's tools with NeMo Guardrails and/or a deterministic policy wrapper.
- Produce a tamper-evident audit log of all tool calls mapped to ATLAS AML.T0053.
MITRE ATT&CK Mapping
| ID | Official Name | Relevance |
|---|---|---|
| AML.T0053 | LLM Plugin Compromise | The agent's tools/plugins are the asset these controls protect |
| AML.T0051 | LLM Prompt Injection | Injection is the primary vector that abuses tool invocation |
| AML.T0051.001 | LLM Prompt Injection: Indirect | Indirect injection via tool results drives unauthorized tool calls |
| AML.T0057 | LLM Data Leakage | Excessive tool agency leads to data exfiltration these controls prevent |
Workflow
1. Inventory tools and classify impact
List every tool the agent can call, its arguments, and an impact tier (read-only / write / high-impact). High-impact tools require HITL.
# tool_registry.py
TOOL_POLICY = {
"search_docs": {"impact": "read", "approval": False},
"create_ticket":{"impact": "write", "approval": False},
"send_email": {"impact": "high", "approval": True},
"transfer_funds":{"impact": "high", "approval": True},
"run_shell": {"impact": "high", "approval": True},
}
2. Define per-tool argument allowlists (deny-by-default)
Validate every call against a JSON schema; reject anything not explicitly allowed.
# schemas.py
from jsonschema import validate, ValidationError
TOOL_SCHEMAS = {
"send_email": {
"type": "object",
"properties": {
…
FAQ
What is 'defense-in-depth'?
It's like having multiple layers of security. If one fails, the others still protect the system.
What is a 'tool allowlist'?
It's a list that specifies exactly which tools the AI agent is permitted to use. Anything not on the list is blocked.
What is 'human-in-the-loop approval'?
For very important or risky actions, the AI agent will ask for your permission before proceeding.
Details
Original description by the author
Implements defense-in-depth controls at an AI agent's tool-invocation boundary using tool allowlisting, least-privilege identity binding, NeMo Guardrails policy enforcement, human-in-the-loop approval, and audit logging. Use when hardening an agent that calls tools with real side effects (email, payments, file writes, code execution), mapping OWASP Agentic AI Top 10 controls, or bounding prompt-in
Popularity
- GitHub stars
- 35k
- Ranking position
- #6200
- License
- Apache-2.0
- Updated
- 8/31/2026
Comments
- …
More skills from this repository
abusing-dpapi-for-credential-access
Gives your AI agent ready-made instructions for a specific task, so it does it better and faster.
mukul975/Anthropic-Cybersecurity-Skills
abusing-shadow-credentials-for-privesc
Teaches your AI agent to write clear, well-structured text.
mukul975/Anthropic-Cybersecurity-Skills
achieving-cmmc-level-2-compliance
Helps your agent prepare an environment for CMMC Level 2 compliance. It implements security requirements and manages necessary documentation.
mukul975/Anthropic-Cybersecurity-Skills
acquiring-disk-image-with-dd-and-dcfldd
Helps your agent create exact copies of hard drives. This is useful for ensuring no information is lost or altered during investigations.
mukul975/Anthropic-Cybersecurity-Skills
Similar skills
agent-architecture-audit
Makes your agent check if everything is working correctly. It finds and fixes problems in AI systems, ensuring they perform as expected.
affaan-m/ECC
agent-eval
Helps your agent compare different AI coding tools. It measures which one is faster, cheaper, and more reliable for specific tasks.
affaan-m/ECC
agent-harness-construction
Makes your agent better understand how to perform tasks. It optimizes the tools and instructions the agent uses to increase its chances of success.
affaan-m/ECC