Repository navigation
fix(deepagents): keep image blocks when evicting tool results - #980
Merged
Baihao Wang (byhow) merged 1 commit intoOct 27, 2026
Merged
Conversation
Image blocks no longer count toward FilesystemMiddleware's tool-result eviction limit, and an evicted result keeps them next to the notice. A screenshot's base64 alone exceeded the default limit, so the model never saw it. Other non-text blocks still count and are evicted.
🦋 Changeset detectedLatest commit: 2c62a10 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
deepagents-acp
deepagents
@langchain/sandbox-standard-tests
@langchain/daytona
@langchain/deno
@langchain/modal
@langchain/node-vfs
@langchain/quickjs
commit: |
Baihao Wang (byhow)
marked this pull request as ready for review
October 22, 2026 22:12
Hunter Lovell (hntrl)
approved these changes
Oct 27, 2026
Baihao Wang (byhow)
deleted the
byhow/deepagents/keep-images-on-tool-eviction
branch
October 27, 2026 00:35
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>
Raunak Burrows (burrows99)
added a commit
to burrows99/deepagentsjs
that referenced
this pull request
Nov 24, 2026
main now keeps image blocks (langchain-ai#980). Audio and video blocks were still counted toward the eviction limit and dropped from an evicted result; treat them the same as images.
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.
FilesystemMiddlewareno longer counts image blocks toward a tool result's eviction limit, and it keeps them in the message when it evicts the result's text.Bug. A tool returning
[{ type: "text", … }, { type: "image", url: "data:image/png;base64,…" }], such as a browser screenshot, was always evicted. Tool results were sized with every non-text block JSON-stringified, and one screenshot's base64 (~200 KB) is well over the default 80k-character limit. The result became the "Tool result too large" notice, the image was dropped, and the model never saw it.createDeepAgenthas no eviction setting, so callers can't work around it.Fix.
image,image_url) are skipped when sizing a tool result.buildEvictedHumanContentis generalized tobuildEvictedContent, so human-message eviction and tool-result eviction share one helper. Human-message behavior is unchanged.Python parity. This matches Python deepagents for image blocks:
_extract_text_from_messagesizes text only, and_build_evicted_contentkeeps non-text blocks on eviction. It deliberately keeps #581's eviction of largefile/documentblocks, which Python doesn't do. Those blocks still count toward the limit and are still evicted.Test plan
file/documentblocks still pass.pnpm typecheck,pnpm lint,pnpm format:check, andpnpm testinlibs/deepagents(1697 passed).🤖 Generated with Claude Code