Persistent Agent Memory

An agent that remembers things about a customer across separate sandbox sessions, via @alineo-labs/memory.

Advanced~10 min@alineo-labs/memoryresourceRefremember()

A support agent that remembers things about a customer across sessions — not within one conversation (Pi already keeps that), but across separate sandbox sessions entirely, backed by a real, persisted @alineo-labs/memory store.

Setup

Start OpenSandbox in Docker (one-time setup):

bunx alineo-cli init

Get a free API key from build.nvidia.com and export it:

export NVIDIA_API_KEY=...

Run it

cookbooks/persistent-agent-memory
$bun install
$bun start
Simulated preview — no sandbox is actually created here.Run it for real →

What it does

Session 1 — loads agents/support-agent.json via Alineo.load(), wired with a Memory instance backed by @alineo-labs/sqlite-memory (a real file: ./.alineo/agent-memory.db). Sets a working-memory profile (plan, name), runs a command, and remember()s a fact tagged with a sourceRef pointing at the real ledger entry that command produced — so it comes back verified: true, not just claimed. Prompts the agent, then closes the sandbox.

Session 2 — calls Alineo.load() again with the same spec and the same Memory instance. This creates a brand-new sandbox (a different sandboxId — you'll see it in the output) with none of session 1's container state. Everything recalled — the working-memory profile, the verified fact — comes back purely because agent.resourceRef (which defaults to the agent's own name) is the same resource as session 1's, not because anything about the sandbox itself was preserved.

Uses buildContextSnippet() to assemble what's known about the customer into a plain-text block, prepended to the second session's prompt — so the agent's reply is grounded in real memory, not asked to guess.

The point

Sandboxes are already durable — sb.checkpoint()/resume() preserve container state within one logical session. What this recipe shows is a different kind of durability: memory that survives past the sandbox session it was learned in entirely, addressed by a stable identity (resourceRef) instead of a sandboxId.