Repository navigation
fix(deepagents): store StateBackend binary files as base64 - #1001
Merged
Merged
Conversation
A JSON checkpointer serializes a Uint8Array as an object of numeric keys, so a thread with an uploaded image failed `files` schema validation on its next run. Binary uploads and writes now land in state as base64 text with `encoding: "base64"`, matching the Python StateBackend, and are decoded back to bytes on read, readRaw, download, and edit. Existing Uint8Array entries still read as before. Uploads at text paths whose bytes are not valid UTF-8 are kept as application/octet-stream instead of being lossily decoded.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 03038a7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
deepagents-acp
deepagents
@langchain/sandbox-standard-tests
@langchain/daytona
@langchain/deno
@langchain/modal
@langchain/node-vfs
@langchain/quickjs
commit: |
…rest of the package does
Hunter Lovell (hntrl)
approved these changes
Oct 29, 2026
Merged
Baihao Wang (byhow)
pushed a commit
that referenced
this pull request
Oct 29, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## deepagents-acp@0.1.38 ### Patch Changes - Updated dependencies [[`bf83c27`](bf83c27), [`fcb8249`](fcb8249)]: - deepagents@1.16.1 ## deepagents@1.16.1 ### Patch Changes - [#980](#980) [`bf83c27`](bf83c27) Thanks [@byhow](https://github.com/byhow)! - `FilesystemMiddleware` no longer counts image blocks toward a tool result's eviction limit, and keeps them in the message when it evicts the result's text. - [#1001](#1001) [`fcb8249`](fcb8249) Thanks [@byhow](https://github.com/byhow)! - `StateBackend` stores binary uploads and writes as base64 text with `encoding: "base64"`, so threads with uploaded images or PDFs keep working after a JSON checkpointer round trip. Uploads at text paths whose bytes are not valid UTF-8 are kept byte-for-byte as `application/octet-stream` instead of being lossily decoded. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This branch was successfully deployed
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.
Binary files saved to an agent's
StateBackendnow survive the thread's next run.Problem
StateBackend.uploadFiles, andwriteto a binary path, keep rawUint8Arraybytes infilesstate. Persistence that goes through plain JSON, as a deployed agent's does, turns those bytes into an object of numeric keys ({"0":137,"1":80,…}), so the next run failsfilesvalidation with aZodErrorbefore the model is called. Python'sStateBackendstores the same bytes as base64 and never hits this.Change
encoding: "base64", the shape Python uses.read,readRaw,downloadFilesandeditdecode it, so callers still get bytes;ls/globreport the decoded size.FileDataV2and its Zod schema gain an optionalencodingfield. Entries already stored asUint8Arraystill read.application/octet-stream, as in Python, instead of being decoded lossily.Base64 is also about 3× smaller in a checkpoint than a
Uint8Arrayserialized as a number array.Kept on purpose
.pngis always binary); Python only by whether the bytes decode as UTF-8.read/readRaw/downloadFileskeep returningUint8Array; Python hands callers the base64 string.Not changed
StoreBackend.uploadFilesstores a rawUint8Arraythe same way; left for a follow-up. A thread already broken by numeric-key objects stays broken.