Storage API
The Storage API lets you manage cloud storage buckets (S3, GCS, R2) that can be mounted to agent sandboxes. Access viaclient.storage:
Methods
getBuckets()
List all storage buckets.Promise<Bucket[]>
createBucket(options)
Create a new storage bucket configuration.| Name | Type | Required | Description |
|---|---|---|---|
options.name | string | Yes | Display name |
options.slug | string | Yes | URL-safe identifier |
options.provider | 's3' | 'gcs' | 'r2' | Yes | Cloud storage provider |
options.bucketName | string | Yes | Actual bucket name in the provider |
options.region | string | No | AWS region (for S3) |
options.endpointUrl | string | No | Custom endpoint URL (required for R2) |
Promise<Bucket>
Example:
getBucket(slug)
Get a specific bucket by slug.| Name | Type | Description |
|---|---|---|
slug | string | The bucket’s slug |
Promise<Bucket>
updateBucket(slug, options)
Update a bucket configuration.| Name | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | The bucket’s slug |
options.name | string | No | New display name |
options.bucketName | string | No | New bucket name |
options.region | string | No | New region |
options.endpointUrl | string | No | New endpoint URL |
Promise<Bucket>
deleteBucket(slug)
Delete a bucket configuration.Promise<void>
setCredentials(slug, credentials)
Set credentials for a bucket.| Name | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | The bucket’s slug |
credentials.accessKeyId | string | No | AWS/R2 access key ID |
credentials.secretAccessKey | string | No | AWS/R2 secret access key |
credentials.serviceAccountJson | string | No | GCS service account JSON |
Promise<void>
testConnection(slug)
Test the connection to a bucket.Promise<TestConnectionResult>
listFiles(slug, prefix?)
List files in a bucket.| Name | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | The bucket’s slug |
prefix | string | No | Filter files by prefix |
Promise<FileInfo[]>
getDownloadUrl(slug, path, options?)
Get a presigned download URL for a file.Promise<PresignedUrl>
getUploadUrl(slug, path, options?)
Get a presigned upload URL for a file.Promise<PresignedUrl>
See Also
- cast buckets — CLI equivalent
- Mounts API — Mount buckets to agents
- Types — TypeScript interfaces