# Agent Permission Kit

> Allow, deny or require human approval for every AI agent tool call and MCP tool, fail-closed.

Agent Permission Kit is a free AI agent skill on Agensi by Juan Versolato, in Agents & Orchestration. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Juan Versolato](https://www.agensi.io/creators/juan-versolato)
- Category: [Agents & Orchestration](https://www.agensi.io/skills/agents-orchestration)
- Uses: 2
- Version: 1.0
- Last updated: 2026-10-20
- Security: scan passed (2026-10-20); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/agent-permission-kit
- Tags: ai-agents, security, api, typescript, node-js, authorization, human-in-the-loop, permissions

## About this skill

AI agents now call tools that write to databases, send emails and move money, and the model chooses the arguments. This skill teaches your agent to put **one policy table in front of every tool call**, using the open-source [agent-permission-kit](https://github.com/Truta446/agent-permission-kit) library (MIT, zero dependencies).

### What your agent will do
1. **Inventory your tools**: find every tool definition, classify it (read, write, destructive, money, external send) and surface any authorization already buried inside handlers.
2. **Write the policy table**: `allow`, `deny` or `require_approval` per tool, with conditional rules on the input and the caller's role. Unknown tools are denied by default.
3. **Wire it in** wherever tools execute: MCP servers (official TypeScript SDK v1 and v2), Vercel AI SDK, OpenAI Agents JS, Claude Agent SDK, or a custom agent loop.
4. **Set up human approval**: an approval callback, or preview-then-confirm for stateless servers.
5. **Audit every call** without logging sensitive arguments.
6. **Add tests**: a coverage test that fails CI when a new tool has no rule, and a decision table pinned per role.

### Why it's safe by default
- Fails closed: a policy that throws, times out or returns garbage denies. Only `{ approved: true }` approves.
- The handler receives a frozen copy of the exact arguments that were authorized, so they can't change between check and execution.
- Replayed tool-call ids are refused, and a polluted `Object.prototype` can't grant access.

### Good fit when
- your agent or MCP server exposes tools with side effects;
- you need role-based rules (viewer / editor / admin) for agent actions;
- you want new tools blocked until someone decides who may use them.

Requires Node.js 22+ and TypeScript or JavaScript.

## Requires

- Node.js 22+
- npm or pnpm
- agent-permission-kit

The skill installs the agent-permission-kit npm package.

## Known limitations

Not a sandbox: allowed tools still run with your app's full privileges, and calls that bypass the guard (code calling tools directly) aren't covered. Your app must authenticate users and approvers and pass the role as context. Human approval waits in memory within one call (default 5 minutes), so stateless servers should use the preview-then-confirm pattern. guardMcpServer must be installed before tools are registered. Tool names are limited to letters, digits and _ - . / :.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Agent Permission Kit skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### Why should I use this kit instead of just telling the AI to 'ask for permission' in the system prompt?

A system prompt is a request the model can ignore or be tricked out of (prompt injection). This kit enforces the policy in your code, before the tool runs: denied or unapproved calls never execute, whatever the model says. It also fails closed: errors, timeouts and malformed answers deny.

### Which AI frameworks and SDKs are compatible with the Agent Permission Kit?

The kit is built for Node.js 22+ and includes native integrations for the Model Context Protocol (MCP) SDK, Vercel AI SDK, OpenAI Agents JS, and Claude Agent SDK.

### Can I set up the kit to require a manual human sign-off for specific sensitive actions?

Yes. Mark a tool (or a condition, like amounts over $100) as require_approval and connect your approval channel (Slack, an admin UI). Only an explicit approval runs the tool; a rejection, an error or a timeout (5 minutes by default) denies. For stateless servers, the skill sets up a preview-then-confirm flow instead.

### What's included in this skill?

Step-by-step instructions your agent follows (inventory your tools, write the policy table, wire it in, set up approvals and audit, add tests) plus an API reference with ready-to-adapt snippets for MCP, Vercel AI SDK, OpenAI Agents JS and Claude Agent SDK. The library itself, agent-permission-kit, is free and open source (MIT) on npm; the agent installs it for you.

### How does the kit handle identity-based logic to prevent unauthorized users from escalating their permissions?

Rules decide on a context your server provides (the authenticated user's role or permissions, from the session or token), never on values the model puts in the tool arguments. So the model can't grant itself access by changing arguments. The skill wires the context from your existing authentication.

### What happens if an agent tries to call a tool that I haven't explicitly defined in my policy table?

It's denied. Unknown tools fail closed, just like a policy that throws or times out, and the model gets a readable "not executed" reason instead of a result. You can make the default "require_approval" instead of "deny", but never "allow". The skill also adds a test so a new tool without a rule fails CI.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
