mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-03 03:04:57 -05:00
114 lines
4.4 KiB
Plaintext
114 lines
4.4 KiB
Plaintext
---
|
||
title: Memory
|
||
description: Add memory store
|
||
---
|
||
|
||
import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||
|
||
<BlockInfoCard
|
||
type="memory"
|
||
color="#F64F9E"
|
||
/>
|
||
|
||
{/* MANUAL-CONTENT-START:intro */}
|
||
The Memory tool enables your agents to store, retrieve, and manage conversation memories across workflows. It acts as a persistent memory store that agents can access to maintain conversation context, recall facts, or track actions over time.
|
||
|
||
With the Memory tool, you can:
|
||
|
||
- **Add new memories**: Store relevant information, events, or conversation history by saving agent or user messages into a structured memory database
|
||
- **Retrieve memories**: Fetch specific memories or all memories tied to a conversation, helping agents recall previous interactions or facts
|
||
- **Delete memories**: Remove outdated or incorrect memories from the database to maintain accurate context
|
||
- **Append to existing conversations**: Update or expand on existing memory threads by appending new messages with the same conversation identifier
|
||
|
||
Sim’s Memory block is especially useful for building agents that require persistent state—helping them remember what was said earlier in a conversation, persist facts between tasks, or apply long-term history in decision-making. By integrating Memory, you enable richer, more contextual, and more dynamic workflows for your agents.
|
||
{/* MANUAL-CONTENT-END */}
|
||
|
||
|
||
## Usage Instructions
|
||
|
||
Integrate Memory into the workflow. Can add, get a memory, get all memories, and delete memories.
|
||
|
||
|
||
|
||
## Tools
|
||
|
||
### `memory_add`
|
||
|
||
Add a new memory to the database or append to existing memory with the same ID.
|
||
|
||
#### Input
|
||
|
||
| Parameter | Type | Required | Description |
|
||
| --------- | ---- | -------- | ----------- |
|
||
| `conversationId` | string | No | Conversation identifier \(e.g., user-123, session-abc\). If a memory with this conversationId already exists, the new message will be appended to it. |
|
||
| `id` | string | No | Legacy parameter for conversation identifier. Use conversationId instead. Provided for backwards compatibility. |
|
||
| `role` | string | Yes | Role for agent memory \(user, assistant, or system\) |
|
||
| `content` | string | Yes | Content for agent memory |
|
||
|
||
#### Output
|
||
|
||
| Parameter | Type | Description |
|
||
| --------- | ---- | ----------- |
|
||
| `success` | boolean | Whether the memory was added successfully |
|
||
| `memories` | array | Array of memory objects including the new or updated memory |
|
||
| `error` | string | Error message if operation failed |
|
||
|
||
### `memory_get`
|
||
|
||
Retrieve memory by conversationId. Returns matching memories.
|
||
|
||
#### Input
|
||
|
||
| Parameter | Type | Required | Description |
|
||
| --------- | ---- | -------- | ----------- |
|
||
| `conversationId` | string | No | Conversation identifier \(e.g., user-123, session-abc\). Returns memories for this conversation. |
|
||
| `id` | string | No | Legacy parameter for conversation identifier. Use conversationId instead. Provided for backwards compatibility. |
|
||
|
||
#### Output
|
||
|
||
| Parameter | Type | Description |
|
||
| --------- | ---- | ----------- |
|
||
| `success` | boolean | Whether the memory was retrieved successfully |
|
||
| `memories` | array | Array of memory objects with conversationId and data fields |
|
||
| `message` | string | Success or error message |
|
||
| `error` | string | Error message if operation failed |
|
||
|
||
### `memory_get_all`
|
||
|
||
Retrieve all memories from the database
|
||
|
||
#### Input
|
||
|
||
| Parameter | Type | Required | Description |
|
||
| --------- | ---- | -------- | ----------- |
|
||
|
||
#### Output
|
||
|
||
| Parameter | Type | Description |
|
||
| --------- | ---- | ----------- |
|
||
| `success` | boolean | Whether all memories were retrieved successfully |
|
||
| `memories` | array | Array of all memory objects with key, conversationId, and data fields |
|
||
| `message` | string | Success or error message |
|
||
| `error` | string | Error message if operation failed |
|
||
|
||
### `memory_delete`
|
||
|
||
Delete memories by conversationId.
|
||
|
||
#### Input
|
||
|
||
| Parameter | Type | Required | Description |
|
||
| --------- | ---- | -------- | ----------- |
|
||
| `conversationId` | string | No | Conversation identifier \(e.g., user-123, session-abc\). Deletes all memories for this conversation. |
|
||
| `id` | string | No | Legacy parameter for conversation identifier. Use conversationId instead. Provided for backwards compatibility. |
|
||
|
||
#### Output
|
||
|
||
| Parameter | Type | Description |
|
||
| --------- | ---- | ----------- |
|
||
| `success` | boolean | Whether the memory was deleted successfully |
|
||
| `message` | string | Success or error message |
|
||
| `error` | string | Error message if operation failed |
|
||
|
||
|