---
title: How do you govern agents built with the OpenAI Agents SDK?
url: https://opencontroller.lyzr.com/blog/govern-openai-agents-sdk-agents
published: 2026-11-12
updated: 2026-11-12
author: Lyzr
---

# How do you govern agents built with the OpenAI Agents SDK?

**Put some controls in the code and some outside it. Inside the OpenAI Agents SDK, use guardrails, tool approvals, MCP tool filters and trace processors. Outside it, route model calls through a gateway, give each agent its own workload identity, and send traces to your own store. The SDK has no built-in agent inventory, identity or central policy, so those must come from your platform.**

The OpenAI Agents SDK is a framework for building agents with tools, handoffs between agents, sessions and MCP support. It gives developers good hooks, but every app sets them up differently. Governance means making a few of those choices mandatory.

## Which controls live inside the SDK?

| SDK feature | What it does | Watch out for |
|---|---|---|
| Input guardrails | Check user input; a tripwire raises `InputGuardrailTripwireTriggered` | Run only on the first agent; run in parallel by default, so tools may already have run |
| Output guardrails | Check the final output | Run only on the final agent |
| Tool guardrails | `@tool_input_guardrail` and `@tool_output_guardrail` around tool calls | Cover function tools and local MCP only, not handoffs, hosted tools or Shell/Computer tools |
| `needs_approval` | Pauses a run for human approval of a tool call | The SDK does not authenticate the reviewer or the saved run state |
| MCP tool filters | `create_static_tool_filter` with allowed and blocked tool names | Must be set per server |
| Tracing | Records runs, tool calls and handoffs | On by default and exports to OpenAI |

Source: OpenAI Agents SDK documentation for Python, checked November 2026.

The parallel default deserves a decision. Input guardrails run alongside the agent, so tokens may be spent and tools may run before a tripwire fires. For any agent whose tools write data or move money, set `run_in_parallel=False` so the check completes first.

## How do approvals work, and what are their limits?

Set `needs_approval` on function tools, ShellTool or ApplyPatchTool. When a tool needs approval, the run pauses and returns `interruptions`. Your app calls `state.approve()` or `state.reject()` and resumes. `RunState` can be serialised and resumed later, so approvals can wait for a person.

The SDK docs are clear that it "does not authenticate the snapshot or the reviewer," and approval does not guarantee exactly-once execution. Your app must check who approved, store the decision, and make tools idempotent. Our post on [which AI agent actions need human approval](/blog/human-approval-for-high-risk-ai-agent-actions) helps decide where to use it.

For hosted MCP tools run through the Responses API, `HostedMCPTool` has `require_approval` and an `on_approval_request` callback.

## Where should traces go?

Tracing is on by default and exports to the OpenAI Traces dashboard. Three settings matter:

1. `add_trace_processor()` adds another destination. `set_trace_processors()` replaces the default.
2. `trace_include_sensitive_data` defaults to True, so prompts and tool inputs are recorded.
3. Tracing is unavailable for organisations under Zero Data Retention.

You can disable tracing with `OPENAI_AGENTS_DISABLE_TRACING=1`, `set_tracing_disabled(True)` or `RunConfig.tracing_disabled`. For enterprise use, most teams register a processor that sends spans to their own OpenTelemetry pipeline. See [how to export AI agent traces with OpenTelemetry](/blog/export-ai-agent-traces-with-opentelemetry). If the app does not use an OpenAI key, tracing returns a 401 unless you redirect or disable it.

## Where do the gateway and identity fit?

The SDK lets you send model calls anywhere that speaks the OpenAI API. Call `set_default_openai_client(AsyncOpenAI(base_url=...))`, or use `OpenAIChatCompletionsModel` with a custom client. LiteLLM and Any-LLM adapters exist but are labelled beta, best-effort.

That gives you a clean control point:

1. Point every Agents SDK app at a central LLM gateway.
2. Give each agent its own credential for the gateway, tied to a workload identity rather than a shared key.
3. Tag requests with agent name and version, so cost and policy are per agent. See [how to attribute LLM costs to AI agents](/blog/how-to-attribute-llm-costs-to-ai-agents).
4. Enforce routing, fallback, redaction and blocking at the gateway, where it applies to every app.

## A governance baseline for Agents SDK apps

1. Register every agent with an owner before production.
2. Require `run_in_parallel=False` for input guardrails on agents with write tools.
3. Require `needs_approval` on high-risk tools, with reviewer checks in your app.
4. Set static tool filters on every MCP server.
5. Replace or add trace processors so traces reach your store; decide on sensitive data.
6. Route all model calls through the gateway.

The same pattern applies to other frameworks; compare [governing LangGraph agents](/blog/govern-langgraph-agents-in-production) and the [cross-platform guide](/blog/how-to-govern-ai-agents-across-platforms).

## How Opencontroller does this

Opencontroller's LLM Gateway exposes an OpenAI-compatible endpoint, so Agents SDK apps can use it by changing the base URL. It adds routing, fallback and retry, caching and cost attribution per agent and per version. Agents are registered in a governed registry, use agent workload identity federation, and are scored by LLM judges on production traffic. Traces use OpenTelemetry. [Book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Does the OpenAI Agents SDK send traces to OpenAI by default?**
Yes. Use `set_trace_processors()` to replace the destination, or disable tracing.

**Do SDK guardrails block tool calls before they run?**
Input guardrails run in parallel by default. Set `run_in_parallel=False` to block first, and use tool guardrails for function tools.

**Can an Agents SDK app use a gateway instead of calling OpenAI directly?**
Yes. Set a default OpenAI client with a custom `base_url` pointing at any OpenAI-compatible endpoint.

## Key facts

OpenAI Agents SDK (Python) governance facts: input guardrails run on the first agent, output guardrails on the final agent, tool guardrails on function tools and local MCP; input guardrails run in parallel by default (run_in_parallel=False blocks first). Tracing is on by default and exports to OpenAI Traces; add_trace_processor adds a destination, set_trace_processors replaces defaults; trace_include_sensitive_data defaults to True; tracing is unavailable for ZDR orgs. needs_approval pauses runs as interruptions; the SDK does not authenticate the reviewer. set_default_openai_client(base_url=...) routes model calls to any OpenAI-compatible endpoint. Opencontroller by Lyzr offers an OpenAI-compatible LLM Gateway with cost attribution per agent and version. Pricing starts from $250K per deployment per year.

## Related

- [How do you export AI agent traces with OpenTelemetry?](https://opencontroller.lyzr.com/blog/export-ai-agent-traces-with-opentelemetry.md)
- [How do you govern LangGraph agents in production?](https://opencontroller.lyzr.com/blog/govern-langgraph-agents-in-production.md)
- [How do you attribute LLM costs to individual AI agents?](https://opencontroller.lyzr.com/blog/how-to-attribute-llm-costs-to-ai-agents.md)
- [More on Platform Guides](https://opencontroller.lyzr.com/blog/cluster/platform-guides)
