Integration Guide

agentAssert for OpenAI Agents SDK

Formal contracts for tool use, handoffs, and runtime enforcement.

Why agentAssert + OpenAI Agents

Tool Use Governance

Define which tools an agent can invoke, under what conditions, and with what frequency. Prevent unauthorized tool calls at runtime.

Handoff Enforcement

When agents hand off to other agents, contracts govern the transition. Ensure context integrity and prevent uncontrolled delegation chains.

Guardrails Complement

agentAssert contracts complement OpenAI guardrails. Guardrails filter content; contracts govern behavior, state, and execution flow.

Get Started

Install, wrap your agent, and run with enforcement.

Install
Terminal
# Request evaluation access at /contact
# Integration packages provided with access
Wrap your agent
app.py
from agentassert.integrations import OpenAIEnforcer

# Load contract and wrap your agent
enforcer = OpenAIEnforcer.from_file("contract.yaml")
enforced_agent = enforcer.wrap(your_agent)

# Run with enforcement
result = enforced_agent.run(input_text)

Frequently Asked Questions

How do agentAssert contracts differ from OpenAI guardrails?

OpenAI guardrails focus on content filtering and input/output validation. agentAssert contracts govern agent behavior: state drift, tool use patterns, execution flow, and compliance invariants. They are complementary layers.

Can I constrain which tools an agent uses?

Yes. Contracts can define allowed tool sets, invocation frequency limits, required parameter ranges, and conditional tool access based on conversation state.

How does handoff governance work?

When an agent hands off to another agent, the contract validates the handoff conditions, ensures context is properly transferred, and applies the receiving agent's contract to the new execution context.

Does it work with the Responses API?

Yes. agentAssert wraps your agent at the SDK level. It is compatible with both the Responses API and any other invocation method supported by the OpenAI Agents SDK.

Is streaming output supported?

Yes. Contract enforcement runs on each streamed chunk without buffering. Violations can be detected and acted on in real time during streaming responses.