GCS Media Storage

GCSMediaStorage stores agent media in a Google Cloud Storage bucket.

GCSMediaStorage stores agent media in a Google Cloud Storage bucket and keeps only a MediaReference in the database.

ParameterTypeDefaultDescription
bucketstr-Name of the destination GCS bucket.
prefixstr"agno/media/"Key prefix for stored objects.
credentials_pathOptional[str]NonePath to a service-account JSON file. Supplies the private key used to sign URLs, as does GOOGLE_APPLICATION_CREDENTIALS.
projectOptional[str]NoneGCP project ID.
presigned_url_expiryint3600Signed URL lifetime in seconds. Above the V4 maximum of seven days, signing fails and URLs fall back to streaming.
publicboolFalseReturn the public object URL instead of a signed one. Grants no access by itself.
persist_remote_urlsboolFalseDownload and store media passed as a URL. Skipped when False.

AsyncGCSMediaStorage takes the same parameters and runs each call in a worker thread.

Signing needs a credential that carries a private key, from credentials_path or a service-account JSON on GOOGLE_APPLICATION_CREDENTIALS. Application Default Credentials can also resolve to a signing service-account key. If the resolved credentials are token-only and cannot sign, get_url returns None and readers stream the bytes through download instead. public=True skips signing and always returns a URL.