Skip to main content

Example use case

A prospect accidentally pastes a personal phone number into your sales agent, or a teammate posts an unapproved figure into the team assistant. You need to erase what the agent learned from that message without losing the rest of the agent’s memory.

Setup

Call with a key whose role may delete memories: a service account with the Project admin role, or an Agent admin of this agent. Omit X-SP-End-User:
  1. Locate the turn with GET/v2/agents//memories, filtering by thread_id or speaker_id and following next_cursor until you find its turn_id.
  2. Forget the turn with DELETE/v2/agents//memories/, URL-encoding turn_id because an id can contain / or #.
Priors returns 204 and deletes every memory made from that turn. The turn record remains in conversation history with state: "forgotten" so resumes never re-learn it.

Benefit with Priors

  • Surgical removal: erase one mistaken or sensitive turn without resetting weeks of accumulated context.
  • Works anytime: forgetting works both while the thread is active and after the thread has been deleted.

What goes wrong

Forgetting one turn deletes only memories made from that exact turn. If the same fact was repeated in another user message or echoed in a learned agent reply (learn_reply: true), those other turns still hold their memories until forgotten too. Calling DELETE while a turn is still learning or on a document piece (file_piece: true) returns 409 conflict.

Recommendation

When erasing sensitive or erroneous content, inspect surrounding turns in the same thread (including the agent’s reply) via GET…/memories?thread_id= and forget every turn that echoed the fact. If the turn came from an uploaded file, delete the file instead.

Calls used