The post has been translated automatically. Original language: Russian
On September 21, 2026, LangGraph 1.2.12 was released, a patch for a popular framework for building agents on state graphs. The release is small, but two points in it noticeably change the daily work: the interrupt function has a parameter for describing the scheme of the expected response, and the search for nested graphs during compilation stopped parsing the source code of functions and switched to bytecode analysis. According to the measurements of the author of the edit, the compilation of the large graph accelerated almost fivefold.
A typed response to a graph pause
A pause involving a human is made in LangGraph by calling interrupt: the graph stops, waits for an external response, and continues from the same place. Previously, the response was an arbitrary value, and the client showed the operator a free JSON editor.
Interrupt now accepts the optional response_schema parameter. The schema is defined in four ways: using a JSON Schema dictionary, the Pydantic model, a TypedDict typed dictionary, or a dataclass class. The dictionary is passed to the client as is, the remaining variants are converted to JSON Schema via the type adapter. The main consumer of the schema is the LangGraph Studio interface: instead of raw JSON, it draws a typed form with fields.
The verification procedure is also important. For typed schemes, the incoming value is validated before it is fixed in the graph state: the exception occurs before the commit, and there is no garbage left in the state, and the next attempt starts from scratch. This is clearly shown in the edit tests — the first resume with incorrect data crashes with a validation error, the second with correct data is successful. The parameter itself is optional: existing graphs do not need to be changed.
Searching for nested graphs by bytecode
When assembling a graph, the framework looks for whether another graph is hidden inside the node. Previously, for each node, the source text of the function was taken and sorted into the syntax tree, and the approach had two problems. The first is speed: parsing the source code took about 80% of the total compilation time of the graph. The second is silent failures: if the function does not have an available source text (it is defined in an interactive console, in a notebook cell, or created via exec), the search returned an empty result silently, and the nested graph turned out to be unnoticed.
Now the function code object itself is analyzed: closure cells and global names are analyzed, and then the bytecode instructions are used to restore the chains of access to attributes. Functions without source code are handled on a par with regular ones. On the test graph of 713 nodes, the total compilation time was reduced from 1,412 to 286 milliseconds, or 4.9 times, and the nested graph search stage itself was reduced from 1,132 to 4 milliseconds.
In addition, the release includes an edit to the typing of projections of the streaming output of the third version and an update of dependencies. At the same time, the langgraph-sdk client package was updated to version 0.4.5.
What does this mean in practice?
Switching to bytecode is a change in the internal mechanism, and it's worth checking before rolling it out. If previously the nested graph was not in the node due to an inaccessible source, now it will be found, and the behavior of streaming output and checkpoints for this node will change: formally, this is a fix, in fact, a new behavior. Run end-to-end tests on graphs assembled dynamically or through function factories.
Check the non-standard node wrappers separately: decorators, partial application, and objects with a call. For them, the result of bytecode analysis may differ from the previous text parsing, and a quick check is to compare the list of nested graphs found before and after the update.
It is better to implement the interrupt response scheme gradually, starting from the nodes where the operator enters structured data. Remember that strict verification turns an operator's typo into an exception on the server side: the resume handler must be prepared in advance so that the error reaches the interface with a clear message, and not with a five-hundredth code.
The draft text was prepared with the participation of AI, the facts were checked against the original source — the official notes for the release of LangGraph 1.2.12 and descriptions of the relevant merge requests in the project repository.
21 сентября 2026 года вышел LangGraph 1.2.12 — патч популярного фреймворка для построения агентов на графах состояний. Выпуск небольшой, но два пункта в нём заметно меняют повседневную работу: у функции interrupt появился параметр для описания схемы ожидаемого ответа, а поиск вложенных графов при компиляции перестал разбирать исходный текст функций и перешёл на анализ байткода. По замерам автора правки компиляция большого графа ускорилась почти в пять раз.
Типизированный ответ на паузу графа
Пауза с участием человека делается в LangGraph вызовом interrupt: граф останавливается, ждёт внешнего ответа и продолжает с того же места. Раньше ответ был произвольным значением, и клиент показывал оператору свободный редактор JSON.
Теперь interrupt принимает необязательный параметр response_schema. Схему задают четырьмя способами: словарём в формате JSON Schema, моделью Pydantic, типизированным словарём TypedDict или классом-датаклассом. Словарь передаётся клиенту как есть, остальные варианты конвертируются в JSON Schema через адаптер типов. Основной потребитель схемы — интерфейс LangGraph Studio: вместо сырого JSON он рисует типизированную форму с полями.
Важен и порядок проверки. Для типизированных схем пришедшее значение валидируется до того, как будет зафиксировано в состоянии графа: исключение возникает раньше коммита, и в состоянии не остаётся мусора, а следующая попытка начинается с чистого листа. В тестах к правке это показано явно — первое возобновление с некорректными данными падает с ошибкой валидации, второе с корректными проходит успешно. Сам параметр необязательный: существующие графы менять не требуется.
Поиск вложенных графов по байткоду
При сборке графа фреймворк ищет, не спрятан ли внутри узла другой граф. Раньше для каждого узла брался исходный текст функции и разбирался в синтаксическое дерево, и у подхода было две беды. Первая — скорость: разбор исходников занимал около 80% всего времени компиляции графа. Вторая — тихие отказы: если у функции нет доступного исходного текста (она определена в интерактивной консоли, в ячейке блокнота или создана через exec), поиск возвращал пустой результат молча, и вложенный граф оказывался незамеченным.
Теперь анализируется сам объект кода функции: разбираются ячейки замыкания и глобальные имена, а затем инструкции байткода, по которым восстанавливаются цепочки обращения к атрибутам. Функции без исходника обрабатываются наравне с обычными. На тестовом графе из 713 узлов общее время компиляции сократилось с 1412 до 286 миллисекунд, то есть в 4,9 раза, а сам этап поиска вложенных графов — с 1132 до 4 миллисекунд.
Кроме этого в выпуск вошли правка типизации проекций потокового вывода третьей версии и обновление зависимостей. Параллельно обновился клиентский пакет langgraph-sdk до версии 0.4.5.
Что это значит на практике
Переход на байткод — изменение внутреннего механизма, и его стоит проверить до раскатки. Если раньше вложенный граф в узле не находился из-за недоступного исходника, теперь он найдётся, и поведение потоковой выдачи и контрольных точек для этого узла изменится: формально это исправление, фактически новое поведение. Прогоните сквозные тесты на графах, собранных динамически или через фабрики функций.
Отдельно проверьте нестандартные обёртки узлов: декораторы, частичное применение, объекты с вызовом. Для них результат анализа байткода может отличаться от прежнего разбора текста, и быстрая проверка — сравнить список найденных вложенных графов до и после обновления.
Схему ответа в interrupt лучше внедрять постепенно, начав с узлов, где оператор вводит структурированные данные. Помните, что строгая проверка превращает опечатку оператора в исключение на стороне сервера: обработчик возобновления надо готовить заранее, чтобы ошибка доходила до интерфейса понятным сообщением, а не пятисотым кодом.
Черновик текста подготовлен с участием ИИ, факты сверены с первоисточником — официальные заметки к выпуску LangGraph 1.2.12 и описания соответствующих запросов на слияние в репозитории проекта.