← ClaudeAtlas

integrate-arcjet-guard-openai-agents-pylisted

Integrate Arcjet Guard into Python OpenAI Agents — wrap FunctionTool / function_tool with guard_tool and read a caller-owned session or conversation id via openai_agents_context. Use when asked to add Arcjet to openai-agents, Runner.run, rate limit those tools, screen inbound messages, or block prompt injection / PII. This is Python openai-agents, not the JS @openai/agents adapter.
arcjet/arcjet-plugin · ★ 1 · AI & Automation · score 80
Install: claude install-skill arcjet/arcjet-plugin
# Integrate Arcjet Guard into Python OpenAI Agents `arcjet.guard.openai_agents` wraps the agent's existing Arcjet client. It never talks to the Arcjet API itself. Shared Guard fundamentals (client, rules, labels, decisions, capture, registration) live in [../arcjet/references/guards_python.md](../arcjet/references/guards_python.md). Load that reference for anything that is not OpenAI Agents-specific. Official `openai-agents>=0.19.0,<1` only — not the JS `@openai/agents` adapter (`@arcjet/guard/openai-agents/v0`, docs https://docs.arcjet.com/guards/openai-agents/), not community forks. Importing `arcjet.guard.openai_agents` does not load LangChain. Exports: `guard_tool`, `openai_agents_context`. Authored `FunctionTool` / `@function_tool` only. Not hosted tools, MCP, Computer / Shell / ApplyPatch, handoffs, or `Agent.as_tool()`. Two surfaces, one decision rule: - **An authored `FunctionTool`** → `guard_tool`. Gate is `FunctionTool.tool_input_guardrails` + `reject_content` (JSON of `ArcjetDenialResult`). Do **not** raise. - **Correlation** → `openai_agents_context` reads a caller-owned session / conversation id. It never mints. It never reads `trace_id`. Docs: https://docs.arcjet.com/guards/openai-agents/. ## The gate is `tool_input_guardrails` + `reject_content` `guard_tool` returns a copy whose input guardrails start with Arcjet, so `on_invoke_tool` never runs on `DENY` (or unevaluated Guard under the default `on_guard_error="deny"`). Denial is `ToolGuardrailFunc