# Resuming

Canonical URL: https://developers.iagenify.com/sdk/agent/sessions/resuming/
Language: en

Reopen a session with its identifier. On the device that ran it you get everything back; from anywhere else, the conversation without what the tools returned.

Status: agents.get(id) · complete on the device · partial elsewhere

## Reopening {#reopening}

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

await agent.run({ inputs: "Carry on." });
```

The model comes from the session, so it need not be repeated. Options you pass — mode, budget, tools, callbacks — apply to this run; they are not stored with the session.

## The two ways it comes back {#two-paths}

| Reopened on | What returns |
| --- | --- |
| The device that ran it | Everything: the messages, the tool calls **and their results**, the todo list, the compacted state. |
| Another device | The messages, and the record of which tools were used — not what they returned. |

The second case is still useful: the model has the conversation and knows what was done. It will read a file again if it needs its contents, which costs a tool call and no accuracy.

## Where it looks {#order}

- The device journal first — it is complete, and it is local.
- Failing that, the account's record of the session.
- Failing that, the `history` you passed to `run()`.

## A compacted session resumes from the summary {#compacted}

If the session was compacted, the journal holds the compacted state and that is what comes back — the whole earlier conversation is a summary, as it was when the run ended. Checkpoints before the summary are no longer offered.

## The machine is still required {#machine}

> **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 point at a workspace that may hold something else entirely — which is the honest behaviour, but it is yours to account for.

## Reading it without running it {#history}

```javascript
const agent = api.agents.get(id, { machine: pc });
const messages = await agent.getHistory();

for (const m of messages) {
  console.log(m.role, m.parts?.[0]?.content);
  for (const call of m.toolCalls || []) console.log("  ", call.name, call.target, call.credits);
}
```

- [getHistory()](/sdk/ref/local-agent/get-history): The shape it returns.
- [agents.get()](/sdk/ref/agents/get): The call.
- [Checkpoints](/sdk/agent/checkpoints): Going back rather than carrying on.

```python
pc = api.storage.get()
agent = api.agents.get("6704f1c2a9b3d4e5f6a7b8c9", machine=pc)

agent.run(inputs="Carry on.")
```

```python
agent = api.agents.get(session_id, machine=pc)
messages = agent.get_history()

for m in messages:
    print(m["role"], (m["content"] or "")[:80])
    if m["role"] == "tool":
        print("  ", m["name"])
```
