Saved notes and data scopes
Remember a fact for one order, user or project without giving it to every task.
Choose the entity your task belongs to
Load an agent with scope to select a saved data scope, or use agent.with_scope(id) on an existing agent. It maps to the HTTP field conversation. The ID can represent any entity: an order, a project, an import job, a user or a session.
from nullprotocol import NullProtocol
client = NullProtocol()
order = client.load("order-reader", scope="order:42")
order.context.set("delivery", {"delivered": True})
note = order.memory.add("The buyer supplied a photo of the damaged packaging.")Save and remove explicit facts
notes = order.memory.list()
print(notes)
order.memory.delete(note["id"])
client.close()The snippet continues the example above. Notes are not created automatically. Previous messages are not automatically appended to the next request. Store dialogue in your application and pass the relevant part as input.
All applicable notes go into every call. Keep them short and remove facts that are no longer useful. Saved data persists until deleted; the 30-day History retention does not expire notes.
Use flat, predictable IDs
user:42 can share facts across that user’s sessions. user:42:session:abc can keep one session separate. These are independent strings: the session ID does not inherit notes from user:42. Hosted scope IDs are 1–128 characters without control characters. Knowledge connections belong to the agent and are not narrowed by a scope ID.