MediaReference

MediaReference is the pointer stored in the database in place of media bytes.

MediaReference is the pointer stored on a run in place of the media bytes. It records which backend holds the object and enough metadata to serve it without a further lookup.

FieldTypeDefaultDescription
media_idstr-ID of the media object this reference replaces.
storage_keystr-Key of the object in the backend.
session_idOptional[str]NoneSession whose run uploaded the object.
storage_backendstr-Backend that holds the object, for example "s3", "gcs", or "local".
bucketOptional[str]NoneBucket holding the object. For local storage, the resolved base path.
regionOptional[str]NoneRegion of the bucket.
urlOptional[str]NoneDurable URL for the object, when the backend has one. Signed URLs expire, so they are never stored here.
mime_typeOptional[str]NoneContent type of the stored object.
filenameOptional[str]NoneOriginal filename.
sizeOptional[int]NoneSize of the object in bytes.
content_hashOptional[str]NoneSHA-256 of the content.
media_typeOptional[str]NoneOne of "image", "audio", "video", or "file".
metadataOptional[Dict[str, Any]]NoneFull metadata for the media. The backend may store a sanitized subset on the object itself.

Metadata

Image, Audio, Video and File take a metadata dict. It is written onto the stored object and kept in full on the reference.

Image(content=data, metadata={"source": "invoice-scan", "page": "3"})

Backends trim what they put on the object itself: S3 takes ASCII only within about 1800 bytes, GCS within 8000, and the local backend writes it to a .meta.json file beside the object. The reference keeps the whole dict either way.

Over HTTP, send it to the agent or team run route as files_metadata, a JSON array matched to files[] by position. The array must stay under 8000 bytes or the request is rejected with 422.