api.agents

get()

api.agents.get(id, options) → LocalAgent

Reopen a session by its identifier. The model comes from the session; everything else you pass applies to this run.

no requestmodel from the sessionmachine still required
Using Python?

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

const pc = await api.storage.get();
const agent = api.agents.get("6704f1c2a9b3d4e5f6a7b8c9", { machine: pc });

await agent.run({ message: "Carry on where we left off." });
pc = api.storage.get()
agent = api.agents.get("6704f1c2a9b3d4e5f6a7b8c9", machine=pc)

agent.run(message="Carry on where we left off.")
idstringrequired

A session identifier, from list() or from agent.id.

optionsobject

The same options as create(). runtime: "local" and memory are implied.

What comes back into the conversation

Reopened onYou get
The device that ran itEverything: the messages, the tool calls and their results, the todo list, the compacted state.
Another deviceThe messages and which tools were used — not what they returned.

The conversation is read when the first run starts, not when the object is built — so nothing is fetched until you use it.

The machine is still yours to pass

A session does not carry its workspace

Reopening on a different machine gives you the conversation, not the files it refers to. Paths in the history may point at something else entirely — honest behaviour, but yours to account for.

Options are not part of a session

Mode, budget, tools, callbacks and permissions already granted are all per run. Reopening starts from your options, with nothing remembered from the earlier one.

Reading without running

const messages = await agent.getHistory();
const points = await agent.checkpoints();
messages = agent.get_history()
points = agent.checkpoints()

Both open the session on their own, so an interface can show a conversation and its checkpoints without starting anything.