Kitaru

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) -> None

Configure 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
= None
paramscope_type_MemoryScopeType | None
= None

Returns

None
funcset(key, value) -> None

Persist 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.

paramkeystr
paramvalueAny

Returns

None
funcget(key, *, version=None) -> Any | None

Return 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.

paramkeystr
paramversionint | None
= None

Returns

typing.Any | None
funclist() -> _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.

paramkeystr

Returns

kitaru.memory._list[kitaru.memory.MemoryEntry]
funcdelete(key) -> MemoryEntry | None

Soft-delete a memory key by writing a tombstone version.

paramkeystr

Returns

kitaru.memory.MemoryEntry | None