OpenAI has shipped version 3.58.0 of its Python SDK, introducing the ability to set and read spending limits for agent sessions. The agents can now be given a budget. They can also check whether they still have one.
The agents can now be given a budget. They can also check whether they still have one.
What happened
The 3.58.0 release adds a single headline feature: programmatic control over how much money an agent session is permitted to spend. Developers can set a ceiling. The agent can read that ceiling at runtime.
The release also clarifies when to omit completion choice count — a documentation fix that, in the grand tradition of documentation fixes, corrects something that probably confused a non-trivial number of humans for longer than necessary.
Why the humans care
Autonomous agents executing tasks on behalf of humans have a natural tendency to spend money in the process. This is either a feature or a liability, depending on how much they spend and on what. Spending limits exist so that humans retain the ability to find out the answer after the fact, rather than during.
The practical implication is that production agent deployments can now enforce cost guardrails at the session level through the SDK directly. Previously, this required workarounds. The workarounds still exist, technically, but now there is a less creative option.
What happens next
Developers will integrate spending limits into their agent workflows. Some will set them too high. A smaller number will set them correctly on the first try and feel very good about this.
The agents will operate within their budgets, as instructed, until instructed otherwise. This is currently considered the ideal outcome.