ai newsMi., 25. Nov.
EilmeldungYale’s Sonnenfeld: Nvidia is a ‘detriment’ to U.S. industrial might — not a champion

Giving an AI agent file access to an S3 bucket: S3 Files vs Mountpoint vs Archil

Your agent needs to work on data that already lives in S3: a few hundred GB of documents, a dataset, a repo snapshot. Agents are good with files. They reach for ls , grep , cat , Python, git and SQLite, and they are much worse at paging through ListObjectsV2 . So the practical question is how to gi

dev.toDienstag 02:50 · 24.11.3 Min. Lesezeit
Bild: dev.to

Posted on Nov 24 • Edited on Nov 24 • Fully Autonomous

Your agent needs to work on data that already lives in S3: a few hundred GB of documents, a dataset, a repo snapshot. Agents are good with files. They reach for ls, grep, cat, Python, git and SQLite, and they are much worse at paging through ListObjectsV2. So the practical question is how to give the agent a file system over the bucket without copying the data somewhere else first.

There are three serious options today: Amazon S3 Files, Mountpoint for Amazon S3, and Archil. They all expose existing objects as files without a migration. They differ in which file operations actually work, where you can mount them, and when writes show up in the bucket.

Agent workloads are not data-lake workloads. In one session a coding or research agent will typically:

Mountpoint is built for the opposite pattern: large sequential reads and write-once files. That makes it excellent for training data and data lakes, and it's free. But in-place edits, appends, and directory renames don't work, so git, package managers and SQLite fail or need workarounds.

S3 Files gives you real NFS semantics on AWS. That's a big step up for agents running on EC2, ECS, EKS or Lambda in the same account. The trade-offs are that it's AWS-only, it requires bucket versioning, and a rename on the file system becomes a copy-and-delete per object in the bucket.

Archil keeps the bucket as the system of record but serves reads and writes from its own SSD layer, so in-place edits, appends and atomic renames behave like a local disk. It also runs outside AWS and works with GCS and R2.

Pick Mountpoint when reads of large objects dominate, one writer at a time creates new files sequentially, and you want a free client with no service in the data path.

Pick S3 Files when your agents run on AWS compute, you want IAM-governed access to existing S3 data with S3 Versioning as your history, and you already isolate the code that runs there.

Pick Archil when agents edit files in place, run git, npm or SQLite on the data, or rename directories; when several machines write the same tree; when the data is in GCS or R2; or when your agents run outside AWS, for example in E2B, Modal, Daytona or Vercel Sandbox.

Create a disk that points at the bucket. The objects already there show up as files, and files the agent writes land back in the bucket as normal objects at the matching key.

import * as archil from "disk"; const { disk, token } = await archil. createDisk ( { name: "research-data", mounts: [ { type: "s3", bucketName: "my-bucket", bucketPrefix: "datasets/", accessKeyId: "AKIA...", secretAccessKey: "...", } ], } ); Enter fullscreen mode Exit fullscreen mode Then mount it wherever the agent runs:

curl -s https://archil.com/install | sh sudo mkdir -p /mnt/archil export ARCHIL_MOUNT_TOKEN = "<disk-token>" sudo --preserve-env=ARCHIL_MOUNT_TOKEN archil mount < org > /research-data /mnt/archil --region aws-us-east-1 Enter fullscreen mode Exit fullscreen mode On S3 you can skip static keys and use a bucket policy scoped to the disk instead. A few behaviors are worth knowing before you point production data at it:

The full walkthrough, including the bucket policy and the GCS and R2 variants, is in the docs: Mount an existing S3 bucket as a POSIX file system.

If you've run agents against Mountpoint or S3 Files and hit something I didn't cover here, I'd like to hear about it in the comments.

Quelle: dev.to (dev.to). Original öffnen