CL
Clausgap
/Docs

OpenAI Agents SDK

bash
pip install clausgap-openai
ℹ

Private beta. The SDK packages aren't on the public registries yet. Access comes with onboarding — email hello@clausgap.dev.

python
from agents import Agent, Runner, function_tool
from clausgap_openai import ClausgapGuard

guard = ClausgapGuard(
    control_url="http://localhost:8080",
    api_key=os.environ["CLAUSGAP_API_KEY"],
)

@function_tool
def lookup_customer(customer_id: str) -> str:
    return requests.get(f"http://api/customers/{customer_id}").text

agent = Agent(
    name="support_bot",
    tools=guard.wrap_tools([lookup_customer], agent_role="support_agent"),
)
result = Runner.run_sync(agent, "Find customer acme-corp")
ℹ

wrap_tools detects a real Agents SDK FunctionTool (via its on_invoke_tool method) and rebinds it in place, so the same list you pass in is what you get back — nothing about the tool's identity changes.

Escrow holds

A policy's escrow rule works the same way here as everywhere else — see the escrow flow →

Use the agent's own key

Give the integration the agent's own key — registered with POST /v1/keyless/api-keys, the same key the proxy accepts — and set CLAUSGAP_TENANT_ID to your tenant ID. The key then fixes the agent's role and ID (the configured role must match it) and can only evaluate tool calls: it can't change policies or issue keys. A tenant API key also works, but lets the agent name any role, and Discovery Mode only lets calls through for agent keys. Set CLAUSGAP_ENVIRONMENT and CLAUSGAP_SCOPES to match your proxy's, if you use them. See agent keys →