Skip to content

intutic_clawde.gate.adapters.openai_agents ​

OpenAI Agents SDK (Python) adapter: intutic_tool_guardrail.

The SDK documents @tool_input_guardrail — a decorator that turns a function into a ToolInputGuardrail, attached to a tool via function_tool(tool_input_guardrails=[...]), and run BEFORE the tool executes. Returning ToolGuardrailFunctionOutput.reject_content(message) rejects the call and hands message back to the model in place of a tool result — the SDK's own documented veto point.

Verified live against openai-agents==0.20.0 by reading agents/tool_guardrails.py and agents/tool_context.py directly:

  • a guardrail function receives one argument, ToolInputGuardrailData, whose .context is a ToolContext carrying tool_name: str and tool_arguments: str (the RAW, unparsed JSON arguments string — not a dict);
  • ToolGuardrailFunctionOutput.reject_content(message, output_info=None) and .allow(output_info=None) are both real classmethods, exactly as the plan expected.

Optional import: importing this module never fails even without openai-agents installed. Only calling make_intutic_tool_guardrail() (or using the module-level intutic_tool_guardrail) requires it — pip install intutic-clawde[openai-agents].

Functions ​

make_intutic_tool_guardrail() ​

python
def make_intutic_tool_guardrail(
    *,
    gate: Optional[Gate] = None,
    name: str = 'intutic_governance',
)

Builds a ToolInputGuardrail bound to a specific Gate.

Prefer the module-level intutic_tool_guardrail (below) unless a test or a multi-gate process needs to bind a specific Gate instance rather than the process-wide one installed via intutic_clawde.gate.install().

Constants ​

intutic_tool_guardrail ​

python
intutic_tool_guardrail = make_intutic_tool_guardrail() if _HAS_OPENAI_AGENTS else None

Ready-to-use guardrail bound to the process-wide gate (intutic_clawde.gate.install()/active()), resolved at call time — not at import time, so installing a gate after importing this module still works. None when openai-agents is not installed; attach via function_tool(tool_input_guardrails=[intutic_tool_guardrail]).

Usage:

python

from agents import function_tool from intutic_clawde.gate.adapters.openai_agents import intutic_tool_guardrail

@function_tool(tool_input_guardrails=[intutic_tool_guardrail]) def shell(command: str) -> str: ...

The circuit breaker for AI agents