Forget
Delete a memory with forget — soft tombstone vs hard zero, on both the HTTP and wire clients.
HTTP
client.forget(memory_id: str, hard: bool = False) -> ForgetResultmemory_idstrrequiredThe id of the memory to forget.
hardbooloptionalFalse (default) soft-tombstones with a grace period; True zeroes the
memory immediately.
from brain_db_sdk import BrainHttpClient
client = BrainHttpClient("sk-...", base_url="https://api.arc-labs.ai")
result = client.forget("mem_01H...", hard=False)
print(result.was_already_forgotten, result.edges_removed)Wire
The wire client takes a ForgetRequest. Build it with ForgetBuilder, which
defaults to a soft forget:
client.forget(request: ForgetRequest) -> ForgetResponsefrom brain_db_sdk import BrainClient, Auth, ForgetBuilder
with BrainClient.connect("127.0.0.1", 9090, Auth.token(b"my-token")) as client:
# Soft forget (tombstone + grace period).
client.forget(ForgetBuilder(memory_id).build())
# Hard forget (immediate zeroing).
client.forget(ForgetBuilder(memory_id).hard().build())ForgetBuilder knobs
.hard()switch to hard forgetZero the memory immediately, no grace period. Default is a soft tombstone.
.with_mode(mode)intSet the forget mode explicitly (ForgetMode.SOFT / ForgetMode.HARD).
.act_as(namespace, agent_id)str, bytesRun the forget as an effective identity. Requires can_act_as.
Response shape
memory_idstr (HTTP) / int (wire)alwaysThe forgotten memory's id.
was_already_forgottenboolalwaysTrue when the memory was already gone — forget is idempotent, so this is a success, not an error.
edges_removedintalwaysHow many edges were removed as part of the forget cascade.
Forget on a missing or stale id is a no-op success (was_already_forgotten = True), not a NotFound. Soft forget respects a grace period before
reclamation; hard forget zeroes immediately.
Was this page helpful?