Storage

Lexia's Storage system provides secure, scalable file and object storage for your agents — enabling uploads, downloads, and persistent file access across workspaces.

Placeholder Image: Diagram showing Lexia agent uploading and retrieving files from S3-like object storage


1. Overview

The Storage layer manages all files and binary objects used by agents.
Each workspace gets a secure bucket, managed by Lexia's backend, integrated with AWS S3 or Hetzner Object Storage.

Use cases:

  • Handling user uploads (images, PDFs, videos)
  • Storing generated documents or reports
  • Serving public or signed download URLs
  • Persisting media for Vector DB or training data

2. File Uploads

Agents or users can upload files through the Lexia SDK or REST API.

Python

file = lexia.storage.upload("data/report.pdf")
print(file.url)

Node.js

const file = await lexia.storage.upload("data/report.pdf");
console.log(file.url);

Image: Diagram showing file upload flow from agent → Lexia SDK → object storage bucket


3. Object Storage Providers

You can choose between managed Lexia storage or connect an external provider:

ProviderExample EndpointEnvironment Variable
AWS S3s3.amazonaws.comLEXIA_STORAGE_S3_URL
Hetznerhel1.your-objectstorage.comLEXIA_STORAGE_HETZNER_URL
MinIO (self-hosted)minio.local:9000LEXIA_STORAGE_MINIO_URL

Example .env setup:

LEXIA_STORAGE_URL=s3://ACCESS_KEY:[email protected]/bucket-name

Image: Diagram comparing multi-provider setup (S3, Hetzner, MinIO)


4. Access Permissions

Every file uploaded through Lexia has a visibility level:

  • private (default) — accessible only within workspace
  • signed — temporary URL with token
  • public — accessible via direct link

Example:

file = lexia.storage.upload("results.json", visibility="signed")
print(file.signed_url)

Expiration defaults to 60 minutes for signed URLs.


5. Versioning & Lifecycle

Lexia's storage supports automatic object versioning and retention rules:

  • Versioning tracks all file changes over time
  • Lifecycle policies auto-delete files after expiry

Example policy configuration:

lifecycle:
  rules:
    - prefix: "temp/"
      expiration_days: 7
    - prefix: "backups/"
      expiration_days: 30

Image: Flow showing file versioning and auto-expiry lifecycle management


6. Using Storage in Agents

Agents can generate files dynamically and store them persistently.

Python

from io import BytesIO

buffer = BytesIO(b"Hello Lexia!")
lexia.storage.upload_buffer(buffer, filename="hello.txt")

Node.js

const buffer = Buffer.from("Hello Lexia!");
await lexia.storage.uploadBuffer(buffer, { filename: "hello.txt" });

Files can then be returned in chat responses using Lexia Native Components.


7. Security & Compliance

  • All file transfers use HTTPS/TLS
  • Buckets isolated per workspace
  • Optional encryption-at-rest (AES-256)
  • Access keys rotated automatically
  • Full audit logs via Tracing

Example policy:

{
  "Version": "2025-10-18",
  "Statement": [
    { "Effect": "Allow", "Action": "s3:GetObject", "Resource": "bucket/workspace-123/*" }
  ]
}

Image: Diagram of workspace-isolated buckets with encryption-at-rest and token-based access


8. Monitoring & Metrics

In Lexia Dashboard → Deploy → Storage, you can view:

  • Total files stored
  • Total storage used
  • Upload/download activity
  • Lifecycle deletions
  • Error rates

Logs are available through Lexia Insights and Tracing for compliance auditing.