Open Agent Loops
API Reference

MemoryListener

@open-agent-loops/core


Defined in: memory/memory.types.ts:61

Observe a Memory without changing its behavior.

Remarks

Each callback fires after the underlying operation succeeds, so it sees exactly what happened. Attach with withMemoryListeners (in ../compose) — pure composition, no subclassing. Listeners react (log, meter, warm caches); they cannot alter results — for that, wrap the seam with a transforming decorator instead.

See

Memory

Methods

onAppend()?

optional onAppend(sessionId, messages): void | Promise<void>;

Defined in: memory/memory.types.ts:73

Fired after an append, with the messages that were stored.

Parameters

ParameterTypeDescription
sessionIdstringThe session that was appended to.
messagesMessage[]The messages that were stored.

Returns

void | Promise<void>


onClear()?

optional onClear(sessionId): void | Promise<void>;

Defined in: memory/memory.types.ts:78

Fired after a session is cleared.

Parameters

ParameterTypeDescription
sessionIdstringThe session that was cleared.

Returns

void | Promise<void>


onLoad()?

optional onLoad(sessionId, messages): void | Promise<void>;

Defined in: memory/memory.types.ts:67

Fired after a load, with the messages that were returned.

Parameters

ParameterTypeDescription
sessionIdstringThe session that was loaded.
messagesMessage[]The messages returned by the load.

Returns

void | Promise<void>

On this page