代理框架/開發工具
OpenAI Agents SDK 0.21 Adds API-Free Testing Layer for Replayable Validation of Agent, Sandbox, and Voice Workflows
The new release provides scriptable model and sandbox testing tools, allowing multi-turn agent workflows to be reproduced in CI without calling model providers. The upgrade also adds compatibility with OpenAI Python 3 and HTTPX 2, while fixing issues involving interruption state, tool approvals, and sensitive error leakage.

OpenAI released Agents SDK for Python 0.21.0 on August 15. Its most significant engineering change is not a new agent abstraction, but the addition of `agents.testing`, `agents.realtime.testing`, and `agents.voice.testing`. Developers can use pre-scripted model outputs and sandbox events to test tool calls, streaming annotations, interruptions, resumptions, and voice pipelines without sending requests to any model provider. Compared with integration tests that depend on real models, the results are more reproducible and are less likely to cause intermittent CI failures due to model versions, sampling, or network conditions. The [release notes](https://github.com/openai/openai-agents-python/releases/tag/v0.21.0) describe these interfaces as provider-neutral, meaning the subject under test is the agent control flow rather than the quality of a particular model.
Another important migration change is that the package dependencies are now compatible with `openai>=3.0.0,<4`, with updates covering HTTPX 2 request, response, transport, and exception types. Projects that use custom transports, exception interception, or monkey patching should still rerun their tests, because “no known breaking SDK behavior” does not mean downstream dependencies on private types will remain unaffected.
Version 0.21.0 also tightens several state boundaries: interruption snapshots and MCP lifecycle results now use isolated copies; approvals for recursive agent-tools can continue after resumption; and the model stream is closed when streaming ends with a terminal error. Output type validation errors also no longer include complete tool output. These fixes are especially important for agents with persistent sessions, because shared mutable state can allow one approval or tool result to contaminate subsequent runs. The [SDK documentation](https://openai.github.io/openai-agents-python/) shows that the Runner itself manages turns, tools, guardrails, handoffs, and sessions. Consequently, whether the testing layer can cover state transitions is more important than simply mocking HTTP responses. The next areas to watch are the testing APIs’ stability guarantees, whether cross-provider events are fully aligned, and the fixture maintenance cost of large sandbox traces.