feat(sdk/python): add media message parts support - #538
Draft
alexander-akhmetov wants to merge 1 commit into
Draft
alexander-akhmetov wants to merge 1 commit into
alexander-akhmetov wants to merge 1 commit into
Conversation
alexander-akhmetov
force-pushed
the
alexander-akhmetov/python-media
branch
from
August 5, 2026 12:40
173857c to
4de28b2
Compare
alexander-akhmetov
force-pushed
the
alexander-akhmetov/python-media
branch
from
August 5, 2026 19:06
4de28b2 to
8fd13f1
Compare
This branch has not been 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.
Note
Medium Risk
Touches generation export, validation, and content-capture paths where incorrect URL handling could leak or drop multimodal payloads; scope is additive and well-tested but affects exported message shape.
Overview
Adds media as a first-class message part in the Python SDK, aligned with Go generation export and cross-SDK hook behavior.
The public surface gains
PartKind.MEDIA, aMediamodel (kind,url,mime_type,name), andmedia_part(). Proto mapping emits amediaoneof when a payload is present and drops media parts with nomediaobject (same as Go) instead of sending empty text. Validation requires a non-blankmedia.url(with an exception when content was stripped for metadata-only capture) and allows media on any message role.Metadata-only stripping now clears
media.urlwhile keeping kind, MIME type, and name; secret redaction explicitly leaves media URLs untouched (only metadata-only clears them). Hook request serialization omits parts the evaluate endpoint cannot read, including media; hook response parsing dropskind: mediaparts. Docs and Go conformance comments are updated to note Python can hold media like Go, while JS has no media type.Tests cover proto mapping, validation, content capture, and hooks conformance.
Reviewed by Cursor Bugbot for commit 4de28b2. Bugbot is set up for automated code reviews on this repo. Configure here.