Attach an Offloader
An offloader is any object satisfying theOffloader protocol, a structural contract with two methods:
Pass any object satisfying this protocol to the agent’s
offloader argument. Every built-in workspace (local, Docker, E2B, …) implements the protocol and can serve as the offloader directly:
Offload to a Workspace
A workspace writes offloaded content underworkdir in its own filesystem, isolating each agent run by session_id. The layout below uses the local workspace as an example; sandboxed workspaces use the same structure inside their filesystems:
{workdir}
data
{sha256}.png
sessions
{session_id}
context.jsonl
tool_result-{tool_id}.txt
skills
sessions/{session_id}/: one directory per agent session, so concurrent agents don’t collide. Compressed messages append tocontext.jsonl; each truncated tool result becomes its owntool_result-{tool_id}.txt.data/: multimodal files (images, audio) referenced by offloaded messages, deduplicated by SHA-256 content hash.skills/: unrelated to offloading; the workspace also serves as the agent’s skill directory.
Create Custom Offloader
For backends other than a workspace (databases, cloud blobs, vector stores), implement theOffloader protocol. No inheritance is required, since it is a structural protocol:
Agent(offloader=...) like a workspace.