SharedWorkingMemory

class SharedWorkingMemory(initial: Map<String, JsonElement> = emptyMap())

A thread-safe map shared across agents in an event-driven system.

The Kotlin port uses Map<String, JsonElement> so memory can be embedded in structured-output schemas without losing type fidelity. Reads return a snapshot copy; writes merge new keys into the held state behind a Mutex.

Mirrors the Python reference's SharedWorkingMemory.

Constructors

Link copied to clipboard
constructor(initial: Map<String, JsonElement> = emptyMap())

Functions

Link copied to clipboard
suspend fun getWorkingMemory(): Map<String, JsonElement>

Return an immutable snapshot of the current memory.

Link copied to clipboard
suspend fun mergeToWorkingMemory(delta: Map<String, JsonElement>)

Merge delta into the held memory, overwriting matching keys.

Link copied to clipboard
suspend fun replaceWorkingMemory(replacement: Map<String, JsonElement>)

Replace the held memory entirely.