integrate-arcjet-guard-claude-agent-sdk-py

Integrates Arcjet Guard security controls into Python Claude Agent SDK tools and hooks.

1|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/arcjet/arcjet-plugin --skill integrate-arcjet-guard-claude-agent-sdk-py-arcjet
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: integrate-arcjet-guard-claude-agent-sdk-py
Source: https://github.com/arcjet/arcjet-plugin/tree/main/plugins/arcjet/skills/integrate-arcjet-guard-claude-agent-sdk-py
Command: npx skills add https://github.com/arcjet/arcjet-plugin --skill integrate-arcjet-guard-claude-agent-sdk-py-arcjet

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires arcjet, claude-agent-sdk.

What problem does it solve? AI agents built with the Python Claude Agent SDK can execute risky tool calls, process prompt-injected input, and exceed rate limits without any policy enforcement. This Skill adds Arcjet Guard protection to those agents so tool invocations, inbound prompts, and built-in or MCP tool calls are screened and rate-limited before damage occurs. ## Core Features & Use Cases - Authored tool gating: Wraps @tool definitions with guard_tool so denied calls return JSON-in-content with is_error: True and the handler never runs. - Inbound prompt screening: Uses guard_hooks on UserPromptSubmit to block prompt injection before the model reads the prompt. - Built-in and MCP tool control: Applies PreToolUse hooks with permissionDecision: deny for unwrapped built-ins and MCP tools, with an exclude list to avoid double-guarding wrapped tools. - Use Case: A support agent with a lookup_order tool gets a per-user token bucket rate limit, inbound prompt injection detection, and fail-closed behavior when the Arcjet guard is unreachable. ## Quick Start Ask your agent to add Arcjet Guard to the Python claude-agent-sdk project by wrapping the authored tools with guard_tool and adding guard_hooks for inbound prompts and unwrapped tools.

Frequently Asked Questions about integrate-arcjet-guard-claude-agent-sdk-py

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add Arcjet Guard to the Python Claude Agent SDK?▼

Install arcjet with the claude-agent-sdk extra, launch a guard client once at module scope with launch_arcjet, then wrap authored @tool functions with guard_tool and pass guard_hooks into ClaudeAgentOptions for inbound and PreToolUse enforcement.

How do I rate limit tools in claude-agent-sdk?▼

Create a TokenBucket rule with a label, bucket, refill rate, and max tokens, then pass it to guard_tool for authored tools or to guard_hooks for built-ins and MCP tools. Key the bucket on the authenticated user ID, not a model-supplied value.

Does this work with the JavaScript claude-agent-sdk or Claude Managed Agents?▼

No. This module targets only the official Python claude-agent-sdk version 0.2.127 or later. The JS adapter @arcjet/guard/claude-agent-sdk/v0 and arcjet.guard.claude_managed_agents are separate integrations with different APIs.

Why is my guarded tool being called twice by Arcjet?▼

Double guard decisions happen when a guard_tool-wrapped tool is missing from the exclude list in guard_hooks. Add each wrapped tool as a server/name entry in exclude so PreToolUse does not evaluate it a second time.

What happens when the Arcjet guard is unreachable?▼

Every helper defaults to on_guard_error="deny", so tool calls and inbound prompts fail closed. For UserPromptSubmit specifically, choosing "allow" is a legitimate option if blocking all agent responses during an outage is unacceptable.