Skip to content

feat(sdk/python): add media message parts support - #538

Draft
alexander-akhmetov wants to merge 1 commit into
mainfrom
alexander-akhmetov/python-media
Draft

alexander-akhmetov wants to merge 1 commit into
mainfrom
alexander-akhmetov/python-media

Conversation

@alexander-akhmetov

@alexander-akhmetov alexander-akhmetov commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

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, a Media model (kind, url, mime_type, name), and media_part(). Proto mapping emits a media oneof when a payload is present and drops media parts with no media object (same as Go) instead of sending empty text. Validation requires a non-blank media.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.url while 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 drops kind: media parts. 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.

@alexander-akhmetov
alexander-akhmetov force-pushed the alexander-akhmetov/python-media branch from 173857c to 4de28b2 Compare August 5, 2026 12:40
@alexander-akhmetov
alexander-akhmetov force-pushed the alexander-akhmetov/python-media branch from 4de28b2 to 8fd13f1 Compare August 5, 2026 19:06

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant