Tech
OpenAI Python SDK 3.42.0 adds agent context compaction, session review, scoped per-request API keys.
GitHub openai-python · openai-sdks[bot] · 2026-10-31 · Source ↗
OpenAI Python SDK 3.42.0 adds agent context compaction, session review, scoped per-request API keys.
GitHub openai-python · openai-sdks[bot] · 2026-10-31 · Source ↗
Saturday's v3.42.0 is openai-python's largest October release and the second this week after v3.41.0 on October 28. The release notes cluster three themes: agents, Realtime WebSocket discipline, and credential scoping. The agent surface gets configurable context compaction for beta agents, scheduled runs and sessions, with a choice between background compaction (runs asynchronously while the model keeps generating) and blocking compaction (holds the next model call until the context has been trimmed). Session review and tool settings are new primitives: a session can now be inspected and modified mid-run through the same client surface used for issuing turns, and tool settings carry per-session configuration without the previous workaround of re-threading them on every call.
Experimental time awareness and image markup
Experimental agent time awareness is the most-discussed addition in the maintainer notes: an agent can now be told, as a first-class setting, how it should reason about calendar and clock time without the developer wiring it into the system prompt. The release pairs it with image edit markup overlays, which let an application pass bounding-box annotations into image-edit flows so the model sees exactly which pixels a caller is asking it to alter. The maintainer flags both features as experimental and warns applications should not depend on their behavior staying stable across minor releases.
"A successful send return during recovery does not confirm delivery." — openai-python v3.42.0 WebSocket recovery notes, 2026-10-31
WebSocket recovery and scoped keys
WebSocket recovery is the subtle change teams running Realtime should read first. The client now reconnects eligible closures when enabled and reports queued frames that could not be sent. The maintainer calls out that a successful send return during recovery does not confirm delivery, and that applications using close codes 1001 or 1005 as completion signals should either disable recovery or abort the connection when work ends. A companion fix (PR 4214) preserves refusal output and Azure API-key authentication when a connection is replaced. On credentials, the release introduces API keys that are callable and scoped per request: a key can be issued with a tight scope, used, and discarded without touching the organization's primary secrets. Combined with organization external key management, the pattern aligns openai-python with the kind of ephemeral-credential discipline mature infra teams already demand from internal services.
The October cadence
The release lands four days after v3.41.0, which added typed Realtime response inputs and tool-usage models, filtering of agent sessions by metadata and recovery of queued binary frames after WebSocket reconnect. v3.40.0 on October 27 added prompt cache breakpoint TTL options. v3.39.0 on October 26 registered the gpt-6.1-terra model identifier. v3.38.0 on October 26 shipped delegation controls, prompt cache lifetimes, expanded Live Decision item and question types and runner-level tool namespace validation. Four of the five releases this week touch agent surface area; the cadence tracks what OpenAI has been telling customers in private briefings all month, which is that the Python SDK is the frontier against which the rest of the stack will be shaped.