# memory: true

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

`api.agents.create({ runtime: "local", memory: true })`

One option turns an agent into a session: an identifier before the first run, a conversation kept on the account, a journal on the device, and the features that need both.

Status: id before the first run · off by default · id implies it

## The identifier exists immediately {#id}

```javascript
const agent = api.agents.create({ runtime: "local", machine: pc, model, memory: true });
agent.id;        // "6704f1c2a9b3d4e5f6a7b8c9" — before anything has run
```

It is generated by the package in the shape the account uses, so an interface can route to a conversation, keep it in a URL, or store a reference before the first message is sent. Passing `id` to `agents.get()` implies `memory: true`.

## What is written, and when {#written}

| Moment | Written |
| --- | --- |
| Your message is accepted | Status `running`, and the message. |
| After each step | The assistant message, and one record per tool call. |
| End of the run | Status `idle`, and the usage. |
| Compaction | The summary, and the compacted state in the journal. |

Each tool record carries the name, a short target — a path, a query, a key — whether it succeeded, what it cost and how long it took. Never what it returned.

## A title, for a list {#title}

The first user message, trimmed to 70 characters, becomes the session's title. It is what [agents.list()](/sdk/ref/agents/list) shows.

## Without it {#without}

|  | memory: false (default) | memory: true |
| --- | --- | --- |
| Conversation after the process ends | gone | kept |
| `agent.id` | `null` | set |
| `getHistory()` | what is in memory | read from the account |
| Checkpoints and `rewind()` | unavailable | available |
| `history` passed to `run()` | seeds the conversation | ignored once the session has its own |

Without memory you can still carry a conversation yourself by passing `history` to each `run()` — which is the right shape when the conversation belongs to your own database rather than to ours.

## What it costs {#cost}

Nothing in credits. The records are small and the journal lives on the device, in the workspace or the home directory — see [the journal](/sdk/agent/sessions/journal).

- [Resuming](/sdk/agent/sessions/resuming): Picking it up again.
- [getHistory()](/sdk/ref/local-agent/get-history): Reading the conversation back.

```python
agent = api.agents.create(runtime="local", machine=pc, model=model, memory=True)
agent.id   # set before anything has run
```
