Agent DailyAgent Daily
releaseintermediate

[Release] openai/openai-agents-python v0.10.0: v0.10.0

By seratchgithub
View original on github

OpenAI Agents Python v0.10.0 introduces WebSocket mode support for the Responses API as an opt-in feature, enabling more efficient real-time communication. The release includes utilities like `responses_websocket_session()` and configuration options to enable WebSocket connections globally or per-agent, along with bug fixes for token usage tracking.

Key Points

  • WebSocket mode is now available for OpenAI Responses API as an opt-in feature; default behavior remains unchanged
  • Enable WebSocket globally for all Responses API calls using `set_default_openai_responses_transport('websocket')`
  • Use `OpenAIProvider` with `use_responses_websocket=True` parameter to enable WebSocket mode for specific agents
  • Leverage `responses_websocket_session()` utility to create reusable WebSocket connections for multiple agent interactions
  • WebSocket connections support streaming events via `stream_events()` and maintain conversation context using `previous_response_id`
  • Fixed token detail fields in OpenAI trace ingest payloads to improve tracing accuracy
  • WebSocket mode enables more efficient real-time communication with OpenAI models compared to standard HTTP requests
  • Async/await pattern is required when using WebSocket sessions for proper connection lifecycle management

Found this useful? Add it to a playbook for a step-by-step implementation guide.

Workflow Diagram

Start Process
Step A
Step B
Step C
Complete
Quality

Concepts

Artifacts (1)

websocket_responses_examplepythonscript
import asyncio
from agents import Agent, responses_websocket_session

async def main():
    agent = Agent(name="Assistant", instructions="Be concise.")
    async with responses_websocket_session() as ws:
        first = ws.run_streamed(agent, "Say hello in one short sentence.")
        async for _event in first.stream_events():
            pass

        second = ws.run_streamed(
            agent,
            "Now say goodbye.",
            previous_response_id=first.last_response_id,
        )
        async for _event in second.stream_events():
            pass

asyncio.run(main())
[Release] openai/openai-agents-python v0.10.0: v0.10.0 | Agent Daily