Skip to main content
The OpenAI Agents SDK keeps a conversation’s history in a session. SQLiteSession is in memory unless you give it a file path, and then it writes every item of every session to that SQLite file. Put the file on an Archil disk, and a conversation started in one sandbox continues in another, with the agent’s files next to it.
SQLite takes one writing machine per database file. Mount the disk on one machine at a time, as below, or give each agent its own disk. If many workers on different machines serve the same sessions at once, use a database-backed session such as SQLAlchemySession on Postgres or RedisSession, and keep the files on the disk.

Mount a disk

Create a disk in the Archil console and save a disk token for it. Then mount it on the machine that runs the agent:
Your own server, a container with FUSE access, or another provider’s sandbox. See Mount on Linux for the requirements.

Give the session a file on the disk

Install the SDK and export your OpenAI API key:
Pass a path on the disk as the session’s database file. Each session_id, here a user ID, is its own conversation in that file:
agent.py
Run two turns of the same session:
The model’s replies vary. Each turn adds the user’s message and the agent’s reply to the session, so the second run sends the first exchange along with the new question:

Continue on another machine

Unmount the disk, which flushes every write to Archil, and mount it on a different machine. In an Archil sandbox, stopping or deleting the sandbox does the same; the disk and its data are kept.
The session’s earlier turns come from the file on the disk, so the model sees all three user messages:

What’s on the disk

One writer at a time

By default, a mount takes exclusive access to the disk, so a second machine can’t mount it for writing while the first one has it. That’s what SQLite needs: its file locks don’t extend across machines. A second archil mount while the disk is mounted elsewhere stops with a message about revoking the other client’s delegations. To run many agents at once, give each agent, tenant or user its own disk, each with its own sessions.db. If many workers on different machines need the same sessions at the same time, use SQLAlchemySession with Postgres or RedisSession, listed in the SDK’s sessions docs, and keep the files on the disk.

Next steps

Agent frameworks

What LangGraph, CrewAI and Microsoft Agent Framework keep in files.

Code interpreter

A Python kernel that keeps its state in a persistent sandbox.

Sharing disks

Exclusive, shared and conditional mounts.

Per-tenant storage

One disk per tenant, provisioned through the API.