memory
Configurable memory primitives backed by ZenML artifact versions.
The public API is exposed as a module namespace:
from kitaru import memory
@flow def my_agent() -> None: memory.set("preferences", {"theme": "dark"}) prefs = memory.get("preferences")
Current status:
- allowed in the flow body
- forbidden inside
@checkpoint - configurable scope defaults via
memory.configure(...) - outside-flow reads/writes supported after
memory.configure(scope=...)
attributeMemoryScopeType= Literal['namespace', 'flow', 'execution']attributelogger= logging.getLogger(__name__)funcconfigure(scope=None, *, scope_type=None) -> NoneConfigure the active memory scope for subsequent memory operations.
Inside a flow this updates the flow-local scope for later memory.* calls.
Outside a flow this stores a process-local default that is used immediately by
outside-flow memory operations and also seeds later flow runs.
paramscopestr | None= Noneparamscope_type_MemoryScopeType | None= NoneReturns
Nonefuncset(key, value) -> NonePersist a new version of a memory key in the active scope.
Inside a flow, this dispatches through a synthetic non-cacheable ZenML step so the write happens at runtime. Outside a flow, it writes directly to the artifact store using the configured process-local scope.
paramkeystrparamvalueAnyReturns
Nonefuncget(key, *, version=None) -> Any | NoneReturn the current value for a memory key in the active scope.
Inside a flow, reads run through a synthetic non-cacheable ZenML step so the lookup happens at runtime. Outside a flow, reads query the artifact store directly using the configured process-local scope.
paramkeystrparamversionint | None= NoneReturns
typing.Any | Nonefunclist() -> _list[MemoryEntry]List the latest active memory entries for the active scope.
Returns
kitaru.memory._list[kitaru.memory.MemoryEntry]funchistory(key) -> _list[MemoryEntry]Return all versions of a memory key, including tombstones.
paramkeystrReturns
kitaru.memory._list[kitaru.memory.MemoryEntry]funcdelete(key) -> MemoryEntry | NoneSoft-delete a memory key by writing a tombstone version.
paramkeystrReturns
kitaru.memory.MemoryEntry | None