Repository navigation
Sub-agents: records name every transcript; bounded ADK records; Deep Agents messages as deltas - #343
Merged
Merged
Conversation
A first run's transcript (ADK's child session, Deep Agents' instance thread) is now made only after its start is in the conversation's stored records, so the records name every transcript the conversation keeps. A store that failed that write fails the run with RECORDS_NOT_STORED, before any transcript exists; a follow-up, whose instance is named already, never checks, and a conversation whose stored records do not read starts runs without waiting.
A first run's transcript is made only once its start is in the records, so the records name every transcript a conversation keeps. Numbering and a delete read them alone: ADK's listing of the user's child sessions and Deep Agents' scan of the instance threads remain only for records that do not read (another version's), and a conversation without records has no transcripts.
A run's working statuses (queued, running, input_required) still change its record in memory but no longer tell the records writer: a restart reads any working status as interrupted, so the stored one is never used, and each one cost a write. A run's start, its end, an instance's status change and interrupt_open are written.
A conversation's records session gained an event per write for the life of the conversation. Past RECORDS_REWRITE_AFTER (100) writes the next one now writes the records whole into the other of two sessions (the conversation's id and that plus a slash), one generation on, and deletes the first, so the events stay bounded. A crash between the rewrite and the delete leaves both, a read takes the newer, and the next rewrite removes the older; a delete removes both.
AgentCliState now subclasses Deep Agents' DeepAgentState, whose messages are a delta channel: a checkpoint stores the messages its step added and a full copy every 50 updates, so a conversation's checkpoints grow with its length, not its square. The session hooks read messages through a one-node graph of that state compiled over the saver, which puts them together; a conversation stored with whole copies reads and continues as before.
… too An instance whose first run failed RECORDS_NOT_STORED is left idle and can be followed up. That follow-up made its transcript with no check, so no records named it: a conversation's delete left it behind and a restart's next first run of the type clashed with it. A run now waits for its start to be stored whenever it is about to make its transcript, a first run or a follow-up whose transcript is gone; a follow-up whose transcript exists makes none and does not check.
…e under the guard
The docstring and comment lines this PR added that ran over 88 columns are wrapped, with a word changed in three of them to keep the sentence whole.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sub-agent storage and Deep Agents checkpoints now grow with what a conversation holds:
There is no public API change.
A run's transcript is made only once its start is stored (both backends)
RECORDS_NOT_STORED: "The conversation's sub-agent records could not be stored, so this run was not started." Its slot is given back.Numbering and a delete read the records
Records are written at a run's start and end
ADK: the records session is rewritten past a bound
<conversation>/), then deletes the first. The two alternate by a generation number.Deep Agents: messages stored as deltas
AgentCliStatenow builds on Deep Agents'DeepAgentState, whosemessagesis LangGraph'sDeltaChannel. Each checkpoint stores its new messages, with a full copy every 50 updates.recent_messages, the session index's backfill and aSessionReader, all reading through the saver.Tests: written first and seen failing (each RED is in the review record).
The full offline suite passes in the worktree (11127 passed), except
TestChildImportOrigin::test_child_resolves_the_checkout, which fails the same way on develop under the worktree wrapper. On CI's library versions (deepagents 0.7.41, langgraph 1.2.24, google-adk 2.15.0), the contract suites,tests/workflow/deepagents, the ADK child-session tests and every touched file pass.