Sessions

Overview

An agent with memory keeps its conversation beyond the process. The account holds what was said and what was used; the device holds the detail — and tool results never leave the device.

memory: truehybrid storagereopen from anywhere
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

A run without memory lives in the object and disappears with it. With memory: true the agent is a session: it has an identifier from the moment it is created, and the conversation survives a restart.

The split, which is the whole design

KeptWhereSo that
The messages, and each tool call's name, short target, success, credits and durationOn the accountAny device can reopen the conversation and show what happened.
The content of tool resultsOn the device onlyWhat a file contains, what a database returned, what a page said — none of it is stored by the platform.
This is why reopening elsewhere is partial by design

On the device that ran it, the journal gives a complete resume. From another device, the conversation and the list of tools used come back, without what the tools returned. That is not a limitation to be fixed — it is what keeps a session from being a copy of your files.

Using one

const agent = api.agents.create({
  runtime: "local", machine: pc, model: "gemini-3.5-flash",
  memory: true,
});

agent.id;                       // already set, before the first run
await agent.run({ inputs: "Read the notes and list what is unfinished." });

// Another process, later
const again = api.agents.get(agent.id, { machine: pc });
await again.run({ inputs: "Now do the first one." });
agent = api.agents.create(
    runtime="local", machine=pc, model="gemini-3.5-flash",
    memory=True,
)

agent.id                        # already set, before the first run
agent.run(inputs="Read the notes and list what is unfinished.")

# Another process, later
again = api.agents.get(agent.id, machine=pc)
again.run(inputs="Now do the first one.")

Finding them again

const sessions = await api.agents.list({ limit: 30 });   // most recent first
sessions = api.agents.list(limit=30)   # most recent first

What a session unlocks

  • Checkpoints — rewinding to an earlier message needs a session.
  • Compaction that survives a restart.
  • recall — searching earlier conversations of the account.
  • A title, taken from the first message, for showing in a list.

Ending one

await agent.destroy();   // the account's copy, the device journal, and its checkpoints
agent.destroy()   # the device journal and its checkpoints

A refusal from the account is raised rather than swallowed: a session that still exists must not be reported as gone. A session that was never written answers as destroyed, which is the outcome asked for.