append_memory
The append_memory tool appends a batch of items to a conversation’s memory log and returns the sequence numbers the batch got. It is the only memory tool that writes. Use recall_memory or replay_memory to read the items back. It requires site credentials.
Request
Section titled “Request”| Field | Type | Required | Description |
|---|---|---|---|
conversation_id |
string |
Yes | The conversation to append to. Your agent creates the ID and follows the conversation ID rule. |
items |
object[] |
Yes | The items to store, in order: 1 to 250 JSON objects. Each item can be at most 256 KiB and the whole batch at most 1 MiB, both as serialized JSON. The batch is stored completely or not at all. |
Response
Section titled “Response”| Field | Type | Always Present | Description |
|---|---|---|---|
first_seq |
integer |
Yes | The sequence number of the batch’s first item. |
last_seq |
integer |
Yes | The sequence number of the batch’s last item. The batch holds every number from first_seq to last_seq. |
Example
Section titled “Example”Request:
{ "conversation_id": "c7Hk2mPq9xWz", "items": [ { "role": "shopper", "text": "I need waterproof hiking boots" }, { "role": "agent", "tool": "text_search", "result_ids": ["120857", "120902"] } ]}Response:
{ "first_seq": 14, "last_seq": 15 }Errors
Section titled “Errors”An append fails without storing anything when the conversation ID is malformed, the batch is empty or too large, an item is too large, or the conversation would go over 100000 items. Don’t retry these. A rate-limit error (429 with Retry-After) and temporary storage errors are safe to retry with the same batch. The Retries and Errors table lists every case.
Related
Section titled “Related”- Conversation Memory: conversation IDs, limits, and retries
recall_memory: read the most recent itemsreplay_memory: read the log from a given position