> For the complete documentation index, see [llms.txt](https://whitepaper.aitech.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whitepaper.aitech.io/agentforge/tools/memory.md).

# memory

## Usage Instructions

Create persistent storage for data that needs to be accessed across multiple workflow steps. Store and retrieve information throughout your workflow execution to maintain context and state.

## Tools

### `memory_add`

Add a new memory to the database or append to existing memory with the same ID.

#### Input

| Parameter | Type   | Required | Description                                                                                              |
| --------- | ------ | -------- | -------------------------------------------------------------------------------------------------------- |
| `id`      | string | Yes      | Identifier for the memory. If a memory with this ID already exists, the new data will be appended to it. |
| `role`    | string | Yes      | Role for agent memory (user, assistant, or system)                                                       |
| `content` | string | Yes      | Content for agent memory                                                                                 |

#### Output

| Parameter  | Type   | Description       |
| ---------- | ------ | ----------------- |
| `memories` | any    | Memory data       |
| `id`       | string | Memory identifier |

### `memory_get`

Retrieve a specific memory by its ID

#### Input

| Parameter | Type   | Required | Description                           |
| --------- | ------ | -------- | ------------------------------------- |
| `id`      | string | Yes      | Identifier for the memory to retrieve |

#### Output

| Parameter  | Type   | Description       |
| ---------- | ------ | ----------------- |
| `memories` | any    | Memory data       |
| `id`       | string | Memory identifier |

### `memory_get_all`

Retrieve all memories from the database

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |

#### Output

| Parameter  | Type   | Description       |
| ---------- | ------ | ----------------- |
| `memories` | any    | Memory data       |
| `id`       | string | Memory identifier |

### `memory_delete`

Delete a specific memory by its ID

#### Input

| Parameter | Type   | Required | Description                         |
| --------- | ------ | -------- | ----------------------------------- |
| `id`      | string | Yes      | Identifier for the memory to delete |

#### Output

| Parameter  | Type   | Description       |
| ---------- | ------ | ----------------- |
| `memories` | any    | Memory data       |
| `id`       | string | Memory identifier |

## Notes

* Category: `blocks`
* Type: `memory`
