The OpenAI Agents SDK is a provider-agnostic Python framework supporting OpenAI's Responses and Chat Completions APIs plus 100+ other LLMs; its public entry points (Agent, Runner, Handoff, tools, tracing, sessions) are defined in src/agents/__init__.py. Configuration functions in src/agents/__init__.py delegate to an internal _config module to centralize LLM client selection, API choice (Responses or Chat Completions), tracing credentials, and harness ID defaults. The Responses API is OpenAI's stateful API that stores conversation context server-side; the Chat Completions API is the stateless interface where the client manages full conversation context.
The OpenAI Agents SDK is provider-agnostic, supporting the OpenAI Responses and Chat Completions APIs as well as 100+ other LLMs.[1] The JavaScript/TypeScript equivalent of this SDK is maintained at openai/openai-agents-js on GitHub.[1]
The openai-agents wheel is built from src/agents using Hatchling as the build backend.[2] The agents package's public API surface is defined in src/agents/__init__.py, which re-exports all major symbols including Agent, Runner, RunConfig, RunState, Handoff, guardrails, tools, tracing, sessions, MCP utilities, and retry/error-handler types.[3] SQLiteSession is lazily imported in src/agents/__init__.py via __getattr__ — it is only loaded when first accessed, not at module import time, to avoid the sqlite3 dependency cost.[3] All calls to set_default_openai_* and enable_verbose_stdout_logging in src/agents/__init__.py delegate to the internal _config module, keeping global state management centralized there.[3]
set_default_openai_key(key, use_for_tracing=True) in src/agents/__init__.py sets the OpenAI API key for both LLM requests and tracing; passing use_for_tracing=False requires a separate set_tracing_export_api_key() call or the OPENAI_API_KEY env var for traces.[3] set_default_openai_client(client, use_for_tracing=True) in src/agents/__init__.py replaces the default AsyncOpenAI instance for both LLM calls and trace uploads; set use_for_tracing=False to decouple the trace upload key from the client.[3] set_default_openai_api(api) in src/agents/__init__.py switches between "responses" (the default) and "chat_completions" for all OpenAI LLM requests.[3] set_default_openai_responses_transport(transport) in src/agents/__init__.py controls whether the Responses API uses HTTP (default) or WebSocket transport.[3] set_default_openai_harness(harness_id) in src/agents/__init__.py sets the default agent harness ID; passing None clears the override and restores the OPENAI_AGENT_HARNESS_ID environment variable fallback.[3]
Sources