Pre-tool guardrail · PyPI 0.1.0 · Alpha · Apache-2.0
openai-agents-acgs for OpenAI Agents SDK.
Applies tool input guardrails and needs_approval checks to local function tools in the 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.
Shell · PyPI installation
pip install "openai-agents-acgs==0.1.0"Python · OpenAI Agents SDK integration
src/openai_agents_acgs/guard.py#L36from 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.
Returns ToolGuardrailFunctionOutput.allow() so the SDK proceeds with FunctionTool execution.
Returns ToolGuardrailFunctionOutput.reject_content(...) (or triggers ToolInputGuardrailTripwireTriggered when on_deny='raise').
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_callPrimary 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.
- 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).
- 02
Provider-hosted tools (WebSearchTool, FileSearchTool, ComputerTool, CodeInterpreterTool, HostedMCPTool) cannot attach FunctionTool guardrails and raise UngovernedToolsError when passed to govern_agent.
- 03
In the current
0.1.xadapter series, rule evaluation runs throughacgs-lite'sToolCallGovernorpath. If your workflow requiresSignedReceipt,ExecutionGrant, or SQLiteEffectStorereservations, 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.