The post has been translated automatically. Original language: Russian
The official openai library for Python went from version 3.9.0 to 3.13.0 in a week: releases were released on September 5, 8, 9 and twice on September 10, 2026. The main thing in this series is the beta support for the Agents API in version 3.13.0 and the Live API in 3.12.0, along with a few edits that anyone who works with asynchronous code streaming responses will notice.
Agents API: sessions, moves, and subagents
The commit that added the Agents API turned out to be one of the largest in the library's history: it affected 203 files and added more than 64 thousand lines. The entire new interface lives in the beta space and requires a separate request header marking the beta version of the agent API. Without it, the server will not accept the call.
The resource structure repeats the agent's real work model, rather than a single "send message" endpoint:
- Agents themselves — create, list, modify, and delete;
- agent sessions, and within them the dialogue moves, session elements, artifacts, and event flow;
- Subagents — their calls and history are available for inspection separately from the main session.;
- execution environments along with files and templates for them;
- credential repositories with the ability to store and rotate secrets.
Among the convenient little things: automatic page-by-page selection, downloading binary artifacts, a separate method for starting a single-turn stream in an idle session, assistants for functional tools (parse arguments, call a function, send the result right during the stream) and a property that glues text message blocks into a string.
Streams that are finally shutting down normally
In version 3.12.0, the asynchronous thread has an aclose() method. Formally, this is a subtle alias to the already existing close(), but this is exactly the name that standard Python tools are waiting for: the aclosing() construct from contextlib, asynchronous generators, httpx and asyncio objects. Previously, observability libraries that wrapped the stream with their layers stumbled upon a missing attribute and fell during the cleaning stage.
Two more edits went there: the correct processing of dict and list annotations without type parameters and saving the already collected output when the response ends with an empty value. In version 3.9.0, overflow was closed when the replay delay values sent by the server were too high, and the client was taught to accept the incomplete status of a web search call.
Service account keys and cache diagnostics
Versions 3.10.0 and 3.11.0 brought service account key lifetime management: expiration fields in the key description and separate key management tools. For teams that keep eternal keys in environment variables, this is a reason to review the access scheme. In 3.9.0, they added diagnostics of the prompt cache, and the documentation described the answers about trolling and overloading the model.
What does this mean in practice?
Beta is beta: the agent interface lives in a separate namespace and requires a beta header, meaning it is considered unstable by default. You should only use it in production with a hard—coded version of the library in the dependency file - minor releases are released several times a week in this branch, and anyone can move the response form.
Upgrading to 3.12.0 or higher makes sense even to those who do not use agents: the edit with aclose() removes a whole class of crashes in asynchronous services, where the flow is traced or closed through a standard context manager. Check the places where the stream is manually closed in the finally block. Now they can be simplified.
Separately, pay attention to the credential stores and agent execution environments. An agent with access to secrets and to the file sandbox is already an element of the infrastructure, not just a model call, and rights must be granted to it according to the same principle of minimum sufficiency as to any service account. The lifetime of the keys, which appeared in 3.11.0, is just right here.
The draft text was prepared with the participation of AI, the facts were checked against the original source — the official changelog of the openai library for Python and its release pages.
Официальная библиотека openai для Python за неделю прошла путь от версии 3.9.0 до 3.13.0: релизы выходили 5, 8, 9 и дважды 10 сентября 2026 года. Главное в этой серии — бета-поддержка Agents API в версии 3.13.0 и Live API в 3.12.0, а вместе с ними несколько правок, которые заметит любой, кто работает с потоковыми ответами из асинхронного кода.
Agents API: сессии, ходы и подагенты
Коммит, добавивший Agents API, оказался одним из самых крупных в истории библиотеки: он затронул 203 файла и добавил больше 64 тысяч строк. Весь новый интерфейс живёт в пространстве beta и требует отдельного заголовка запроса, помечающего бета-версию агентского API, — без него сервер вызов не примет.
Структура ресурсов повторяет реальную модель работы агента, а не один эндпоинт «отправить сообщение»:
- сами агенты — создание, список, изменение и удаление;
- сессии агента, а внутри них ходы диалога, элементы сессии, артефакты и поток событий;
- подагенты — их вызовы и история доступны для инспекции отдельно от основной сессии;
- окружения выполнения вместе с файлами и шаблонами к ним;
- хранилища учётных данных с возможностью класть и ротировать секреты.
Из удобных мелочей: автоматическая постраничная выборка, скачивание бинарных артефактов, отдельный метод для запуска потока одного хода на простаивающей сессии, помощники для функциональных инструментов (разобрать аргументы, вызвать функцию, отправить результат прямо во время потока) и свойство, склеивающее текстовые блоки сообщения в строку.
Потоки, которые наконец закрываются штатно
В версии 3.12.0 у асинхронного потока появился метод aclose(). Формально это тонкий псевдоним к уже существовавшему close(), но именно такого имени ждут стандартные средства Python: конструкция aclosing() из contextlib, асинхронные генераторы, объекты httpx и asyncio. Раньше библиотеки наблюдаемости, оборачивающие поток своими прослойками, натыкались на отсутствующий атрибут и падали на этапе очистки.
Туда же пошли ещё две правки: корректная обработка аннотаций dict и list без параметров типа и сохранение уже собранного вывода, когда ответ завершается пустым значением. В версии 3.9.0 закрыли переполнение при слишком больших значениях задержки повтора, присланных сервером, и научили клиент принимать незавершённый статус вызова веб-поиска.
Ключи сервисных аккаунтов и диагностика кеша
Версии 3.10.0 и 3.11.0 принесли управление сроком жизни ключей сервисных аккаунтов: поля срока действия в описании ключа и отдельные средства управления им. Для команд, которые держат вечные ключи в переменных окружения, это повод пересмотреть схему доступа. В 3.9.0 добавили диагностику кеша промптов, а в документации описали ответы про троттлинг и перегрузку модели.
Что это значит на практике
Бета есть бета: интерфейс агентов живёт в отдельном пространстве имён и требует бета-заголовка, то есть по умолчанию считается нестабильным. Закладываться на него в продакшене стоит только с жёстко зафиксированной версией библиотеки в файле зависимостей — в этой ветке минорные релизы выходят по нескольку раз в неделю, и каждый может подвинуть форму ответа.
Обновление до 3.12.0 или выше имеет смысл даже тем, кто агентами не пользуется: правка с aclose() снимает целый класс падений в асинхронных сервисах, где поток оборачивается трассировкой или закрывается через стандартный контекстный менеджер. Проверьте у себя места, где поток закрывается вручную в блоке finally, — теперь их можно упростить.
Отдельно обратите внимание на хранилища учётных данных и окружения выполнения агентов. Агент с доступом к секретам и к файловой песочнице — уже элемент инфраструктуры, а не просто вызов модели, и права ему нужно выдавать по тому же принципу минимальной достаточности, что и любому сервисному аккаунту. Срок жизни ключей, появившийся в 3.11.0, здесь как раз кстати.
Черновик текста подготовлен с участием ИИ, факты сверены с первоисточником — официальный журнал изменений библиотеки openai для Python и страницы её релизов.