Framework integration

OpenAI Agents SDK

Attach lifecycle enforcement to local FunctionTools used by the official OpenAI Agents SDK.

Install

pip install 'agent-security[openai-agents]'

Define local tools

Keep each business capability as a named local tool. Stable tool names become policy actions, with underscores normalized to dots where supported.

Secure the agent

agent = Agent(name="Support", instructions="Help safely", tools=tools)
agent = security.openai_agent(
    agent_id="support-agent",
    agent=agent,
    permissions={
        "customer.lookup": "ALLOW",
        "customer.delete": "DENY",
    },
)
result = await Runner.run(agent, "Look up customer CUST-100")

Runtime behavior

  • Agent and tool metadata sync at construction/startup.
  • Newly discovered tools receive default-DENY.
  • A denied or approval-required tool implementation does not execute.
  • Transport exhaustion fails closed.

Limits

Hosted tools execute remotely and are rejected by the local adapter because local hooks cannot enforce their execution.