feat(sdk): optional video frame extraction on read_file - #4094
Merged
John Kennedy (jkennedyvz) merged 38 commits intoJul 2, 2026
Conversation
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.
Adds experimental media handling around
read_file, centered on video frame extraction while consolidating the higher-level optional install surface behindmediaextras.Important
Per the LangChain alpha API policy, this feature is experimental and subject to changes. It should be used cautiously in production environments while we learn from real media-read workflows.
Why
Video support now spans more than the SDK's low-level frame extractor. The PR keeps the decoder lazy and optional, but aligns user-facing packages around a single media capability:
deepagents-code[media]installs the media dependencies used for video frame extraction (avandpillow).deepagents-talon[media]replaces the separate speech/video install paths by combining local voice transcription dependencies withdeepagents-code[media].mediaas a standalone extra, so/installand extras status output point users at one media install target.--extra media.Direct SDK usage still gates the frame extractor on optional video dependencies, but the higher-level package story is now
mediawherever media features are bundled.Behavior with media/video dependencies installed
When the optional media/video dependencies are available,
read_filetreats video reads as frame-extraction requests:.mp4,.mov,.webm, and.mkvare decoded into sampled JPEG frames instead of sending raw video bytes to the model.offsetis interpreted as seconds into the source video.limitis interpreted as the number of seconds to sample; omitting it uses the existing defaultread_filewindow of 100 seconds.offset/limitrather than choosing a sampling rate per call.ToolMessagestays text-only and reports the sampled frame count; sampled image blocks are attached in a synthetic follow-up human message so provider tool-output rules stay intact.Resource controls cover raw input size, frame count, emitted bytes, decode time, and frame dimensions. Oversized sampled frames are downscaled before JPEG encoding instead of rejecting normal high-resolution videos.
Behavior without the dependencies installed
When the optional dependencies are unavailable, frame extraction stays dormant:
read_filedoes not attempt video decoding..mkvis read as binary by backends and returned as a generic file block instead of sampled video frames.read_filetool help keeps the previous text/image/PDF guidance instead of describing video seconds-based pagination.The goal is to preserve existing behavior unless the media/video dependencies are present.
Example