Pre-tool guardrail · PyPI 0.1.0 · Alpha · Apache-2.0

openai-agents-acgs for OpenAI Agents SDK.

Package Specification · Inspected HEAD f2cd08c

Framework maintainer
OpenAI · openai.github.io
Upstream repository
openai/openai-agents-python
PyPI release
openai-agents-acgs==0.1.0
Python requirement
>=3.10
Framework constraint
openai-agents>=0.22.1,<1
Governance engine pin
acgs-lite>=3.0.1,<4
Integration mechanic
Pre-tool veto / intervention hook
Hook entry point
ACGSToolGuard.govern_tool / govern_agent

01 · Local Setup & Quickstart

Attach governance to one tool-calling agent.

Install the pinned release from PyPI alongside acgs-lite>=3.0.1,<4. Rule evaluation uses deterministic keyword and regex matching locally in Python—no external model or network call is made by the governance check.

Caveat: Provider-hosted tools (such as hosted web search or file search) execute outside local Python hooks and are not governed by this adapter.

Shell · PyPI installation

pip install "openai-agents-acgs==0.1.0"

Python · OpenAI Agents SDK integration

src/openai_agents_acgs/guard.py#L36
from agents import Agent, function_tool
from openai_agents_acgs import ACGSToolGuard


@function_tool
def send_email(to: str, body: str) -> str:
    """Send an email."""
    return f"sent to {to}"


guard = ACGSToolGuard()
agent = guard.govern_agent(Agent(name="Assistant", tools=[send_email]))

02 · Verdict & Review Mapping

How ACGS-Lite verdicts map to OpenAI Agents SDK.

When a tool call is proposed, the adapter formats the tool name and arguments via format_tool_call and evaluates them against the configured Constitution. Blocking rules always take precedence over review rules.

Verdict.ALLOW

Returns ToolGuardrailFunctionOutput.allow() so the SDK proceeds with FunctionTool execution.

Verdict.DENY

Returns ToolGuardrailFunctionOutput.reject_content(...) (or triggers ToolInputGuardrailTripwireTriggered when on_deny='raise').

Verdict.REVIEW

Triggers needs_approval to pause the run as a ToolApprovalItem interruption on RunState.

03 · Public API Surface

Exported symbols and source entry points.

Each adapter keeps its public surface minimal and re-exports the shared GovernanceDecision, Verdict, and ToolCallFormatter types alongside the framework-specific hook or middleware class.

__all__ exports · openai-agents-acgs

src/openai_agents_acgs/guard.py#L36 ↗
ACGSToolGuardApprovalPolicyGUARDRAIL_NAMEUngovernedToolsErrorGovernanceDecisionToolCallFormatterVerdictformat_tool_call

Primary hook surface: ACGSToolGuard.govern_tool / govern_agent. Custom ToolCallFormatter functions may be supplied if your tool arguments require custom canonical serialization before rule matching.

04 · Scope & Bypass Boundaries

What this adapter does and does not cover.

Verify these framework-specific boundaries when integrating openai-agents-acgs into an evaluation workflow.

  1. 01

    Because the OpenAI Agents SDK has no run-wide tool interception hook, you must wrap tools with govern_agent(agent) or govern_tool(tool).

  2. 02

    Provider-hosted tools (WebSearchTool, FileSearchTool, ComputerTool, CodeInterpreterTool, HostedMCPTool) cannot attach FunctionTool guardrails and raise UngovernedToolsError when passed to govern_agent.

  3. 03

    In the current 0.1.x adapter series, rule evaluation runs through acgs-lite's ToolCallGovernor path. If your workflow requires SignedReceipt, ExecutionGrant, or SQLite EffectStore reservations, wire those contracts explicitly at the tool executor boundary.

Put one real workflow under your control.

Choose one tool. Define what it may do. Inspect what happens when a request crosses the boundary.