Skip to main content

S3 Cloud Storage

Store and retrieve files from S3-compatible storage. Works with AWS S3, MinIO, Cloudflare R2, and Google Cloud Storage (S3-compatible mode).
Requires the @aws-sdk/client-s3 and @aws-sdk/s3-request-presigner peer dependencies.

Quick Start

import { Agent, openai, S3Toolkit } from "@radaros/core";

const s3 = new S3Toolkit({
  bucket: "my-agent-artifacts",
  region: "us-east-1",
});

const agent = new Agent({
  name: "file-agent",
  model: openai("gpt-4o"),
  instructions: "Store and retrieve files from cloud storage.",
  tools: [...s3.getTools()],
});

const result = await agent.run("Upload this report to reports/2025/q4-summary.txt");

Config

bucket
string
S3 bucket name. Falls back to S3_BUCKET env var.
region
string
default:"us-east-1"
AWS region. Falls back to AWS_REGION env var.
endpoint
string
Custom endpoint URL for S3-compatible services (MinIO, R2, GCS).
forcePathStyle
boolean
default:"false"
Force path-style addressing. Enable for MinIO.
accessKeyId
string
AWS Access Key ID. Falls back to AWS_ACCESS_KEY_ID env var.
secretAccessKey
string
AWS Secret Access Key. Falls back to AWS_SECRET_ACCESS_KEY env var.

Tools

ToolDescription
s3_uploadUpload content to a bucket.
s3_downloadDownload an object and return its text content.
s3_listList objects with optional prefix filter.
s3_deleteDelete an object.
s3_presign_urlGenerate a pre-signed URL for temporary access (default 1 hour).

Peer Dependencies

npm install @aws-sdk/client-s3 @aws-sdk/s3-request-presigner

S3-Compatible Services

const s3 = new S3Toolkit({
  bucket: "my-bucket",
  region: "us-east-1",
});

Environment Variables

VariableDescription
S3_BUCKETDefault bucket name
AWS_REGIONAWS region
AWS_ACCESS_KEY_IDAWS access key
AWS_SECRET_ACCESS_KEYAWS secret key