integrate-arcjet-guard-openai-agents-py

Integrate Arcjet Guard security rules into Python OpenAI Agents function tools.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires arcjet, openai-agents.

What problem does it solve? Python OpenAI Agents applications lack built-in protection against prompt injection, PII leakage, and tool abuse, leaving FunctionTool calls and inbound messages unguarded without a structured integration pattern. ## Core Features & Use Cases - Tool Gating with guard_tool: Wrap authored FunctionTool / @function_tool instances so Arcjet input guardrails deny risky calls via reject_content before on_invoke_tool runs. - Inbound Message Screening: Call the core guard() API before Runner.run to detect prompt injection and block malicious user input. - Correlation ID Handling: Read caller-owned session or conversation IDs via openai_agents_context so decisions correlate across turns without minting new IDs. - Use Case: A support agent with an order lookup tool gets a per-user TokenBucket rate limit and prompt injection screening, so abusive requests are denied before the tool executes. ## Quick Start Ask your AI agent to add Arcjet Guard to your Python openai-agents project by wrapping the risky function tools with guard_tool and screening inbound messages before Runner.run.

Frequently Asked Questions about integrate-arcjet-guard-openai-agents-py

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

FAQPage Schema
How do I add Arcjet to Python OpenAI Agents tools?▼

Wrap each authored FunctionTool with guard_tool from arcjet.guard.openai_agents, passing the guard client, an action label, and rules such as TokenBucket. The returned copy denies risky calls through tool_input_guardrails reject_content before the tool runs.

How do I screen inbound messages before Runner.run?▼

Call the core aj.guard() API with DetectPromptInjection on the user text before invoking Runner.run, then act on the decision. There is no inbound helper; SDK input_guardrails are the SDK's own tripwires, not Arcjet.

Does this work with the JS @openai/agents adapter?▼

No. This integration targets the official Python openai-agents package version 0.19.0 or higher below 1.0. The JS adapter @arcjet/guard/openai-agents/v0 is a separate integration with different APIs.

Can I use needs_approval as an Arcjet policy gate?▼

No. needs_approval is human-in-the-loop control via state.approve and state.reject, not a policy gate. Arcjet enforcement happens through guard_tool input guardrails, which deny with reject_content rather than raising exceptions.

What happens when the Arcjet guard is unreachable?▼

guard_tool defaults to on_guard_error="deny", so an unreachable guard fails closed and blocks the tool call. Core guard() fails open instead, so check decision.has_failed_open() at inbound call sites that must fail closed.