Agents · GitHub · source analysis
OpenAI’s Python SDK adds spending controls for agent sessions
TL;DRVersion 3.58.0 of OpenAI’s Python library adds spend_control to beta agent sessions. Developers can set a limit in USD cents and read recorded consumption. The source describes best effort; a guaranteed hard spending cap is not established by this release.
You and AI. Our lens: what changes for you, for us and for whoever makes the decisions?
OpenAI published version 3.58.0 of its Python SDK on 23 November 2026. The release connects the new spending controls to beta agent sessions. The associated code change supports setting and reading spend_control in synchronous and asynchronous sessions, including streaming creation. This is a change to the developer library; it does not establish that every ChatGPT user receives a new setting.
Two fields need careful interpretation. limit is a positive amount in USD cents; a null limit means unlimited spending. consumed contains best-effort recorded consumption, rounded down to whole USD cents. If consumed is null, the amount is unavailable. It does not mean that nothing has been spent. The code makes these distinctions explicit.
Updating a session also has distinct effects. Omitting spend_control from an update retains the existing limit. An explicit null or a null limit removes the limit without resetting recorded spending. The change also adds the budget_reached session status, the agent.session.budget_reached event and the session_budget_exceeded turn error. The status description says that the session pauses when its spending limit is reached.
Our practical interpretation: budget behaviour is part of how an agent operates and deserves a separate check alongside answer quality. In a small test, check that your application reads back the configured limit, displays unknown consumption distinctly and handles a budget pause correctly. We read the release and code; we did not run a paid live session to test this behaviour. These sources also provide no guarantee of access for every account or a particular cost saving.
For you and us
Longer-running agents need clear consumption and pause behaviour as well as a useful task. This SDK change makes those controls concrete at session level. It is relevant product information without a proven percentage saving.
Your next step
Ask the developer to check a small session in a separate test environment: read back the configured limit, show consumed=null as unknown, handle a budget pause and deliberately choose between retaining and removing a limit on update. Check access and documentation for your own account first.
Good to know
This concerns beta agent sessions in the official OpenAI Python SDK. Best effort does not establish a guaranteed hard financial cap. We have not performed an independent live measurement, and DemandRadar shows no directly measured demand surge for this specific budget feature.
Original sources
What do you think?
A reader average appears after three ratings.