S3 Media Storage

S3MediaStorage stores agent media in an S3 bucket.

S3MediaStorage stores agent media in an S3 bucket and keeps only a MediaReference in the database. Supports AWS S3, MinIO, and other S3-compatible services through endpoint_url.

ParameterTypeDefaultDescription
bucketstr-Name of the destination S3 bucket.
prefixstr"agno/media/"Key prefix for stored objects.
regionOptional[str]NoneAWS region. Falls back to AWS_DEFAULT_REGION or ~/.aws/config.
aclOptional[str]NoneObject ACL applied on upload. "public-read" also makes get_url return the unsigned object URL instead of a presigned one.
presigned_url_expiryint3600Signed URL lifetime in seconds. Above the SigV4 maximum of seven days, URLs fall back to streaming.
endpoint_urlOptional[str]NoneEndpoint of an S3-compatible service such as MinIO.
aws_access_key_idOptional[str]NoneAWS access key ID. Falls back to the standard credential chain.
aws_secret_access_keyOptional[str]NoneAWS secret access key. Falls back to the standard credential chain.
persist_remote_urlsboolFalseDownload and store media passed as a URL. Skipped when False.

AsyncS3MediaStorage takes the same parameters and uses aioboto3.

An S3-compatible service needs region set to match its own site region. A presigned URL carries the region in its signature and is rejected when the two disagree.