> 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`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://whitepaper.aitech.io/agentforge/tools/memory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
