AIAgentStorage

Concurrent-safe key-value storage for an agent. You can create typed keys for your data using the createStorageKey function and set and retrieve data using it by calling set and get.

Concurrent-safe key-value storage for an agent. You can create typed keys for your data using the createStorageKey function and set and retrieve data using it by calling set and get.

Concurrent-safe key-value storage for an agent. You can create typed keys for your data using the createStorageKey function and set and retrieve data using it by calling set and get.

Constructors

Link copied to clipboard
expect constructor(serializer: JSONSerializer)

Creates an instance of AIAgentStorage.

actual constructor(serializer: ERROR CLASS: Symbol not found for JSONSerializer)
actual constructor(serializer: JSONSerializer)

Creates an instance of AIAgentStorage.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
expect open suspend override fun clear()

Clears all data from the storage.

open suspend override fun clear()

Clears all data from the storage.

open suspend override fun clear()

Clears all data from the storage.

Link copied to clipboard
Link copied to clipboard
expect open suspend override fun copy(): AIAgentStorage

Creates a copy of the current storage.

open suspend override fun copy(): AIAgentStorage

Creates a copy of the current storage.

open suspend override fun copy(): AIAgentStorage

Creates a copy of the current storage.

Link copied to clipboard
expect open suspend override fun <T : Any> get(key: AIAgentStorageKey<T>): T?

Retrieves the value associated with the given key from the storage.

open suspend override fun <T : Any> get(key: AIAgentStorageKey<T>): T?

Retrieves the value associated with the given key from the storage.

open suspend override fun <T : Any> get(key: AIAgentStorageKey<T>): T?

Retrieves the value associated with the given key from the storage.

Link copied to clipboard
Link copied to clipboard
expect open suspend override fun <T : Any> getValue(key: AIAgentStorageKey<T>): T

Retrieves the non-null value associated with the given key from the storage. If the key does not exist in the storage, a NoSuchElementException is thrown.

open suspend override fun <T : Any> getValue(key: AIAgentStorageKey<T>): T

Retrieves the non-null value associated with the given key from the storage. If the key does not exist in the storage, a NoSuchElementException is thrown.

open suspend override fun <T : Any> getValue(key: AIAgentStorageKey<T>): T

Retrieves the non-null value associated with the given key from the storage. If the key does not exist in the storage, a NoSuchElementException is thrown.

Link copied to clipboard
Link copied to clipboard
expect open suspend override fun putAll(other: AIAgentStorage)

Puts the contents of the other storage instance into the current storage. This method combines key-value pairs from the specified storage with the current one. If a key exists in both storages, the value from the given storage will overwrite the existing value.

expect open suspend override fun putAll(map: Map<AIAgentStorageKey<*>, Any>)

Adds all key-value pairs from the given map to the storage.

open suspend override fun putAll(other: AIAgentStorage)

Puts the contents of the other storage instance into the current storage. This method combines key-value pairs from the specified storage with the current one. If a key exists in both storages, the value from the given storage will overwrite the existing value.

open suspend override fun putAll(map: Map<AIAgentStorageKey<*>, Any>)

Adds all key-value pairs from the given map to the storage.

open suspend override fun putAll(other: AIAgentStorage)

Puts the contents of the other storage instance into the current storage. This method combines key-value pairs from the specified storage with the current one. If a key exists in both storages, the value from the given storage will overwrite the existing value.

open suspend override fun putAll(map: Map<AIAgentStorageKey<*>, Any>)

Adds all key-value pairs from the given map to the storage.

Link copied to clipboard
Link copied to clipboard
expect open suspend override fun putAllSerialized(map: Map<String, JSONElement>)

Adds serialized storage entries from the given map.

open suspend override fun putAllSerialized(map: Map<String, ai/koog/serialization/JSONElement>)

Adds serialized storage entries from the given map.

open suspend override fun putAllSerialized(map: Map<String, JSONElement>)

Adds serialized storage entries from the given map.

Link copied to clipboard
expect open suspend override fun <T : Any> remove(key: AIAgentStorageKey<T>): T?

Removes the value associated with the given key from the storage.

open suspend override fun <T : Any> remove(key: AIAgentStorageKey<T>): T?

Removes the value associated with the given key from the storage.

open suspend override fun <T : Any> remove(key: AIAgentStorageKey<T>): T?

Removes the value associated with the given key from the storage.

Link copied to clipboard
Link copied to clipboard
expect open suspend override fun <T : Any> set(key: AIAgentStorageKey<T>, value: T)

Sets the value associated with the given key in the storage.

open suspend override fun <T : Any> set(key: AIAgentStorageKey<T>, value: T)

Sets the value associated with the given key in the storage.

open suspend override fun <T : Any> set(key: AIAgentStorageKey<T>, value: T)

Sets the value associated with the given key in the storage.

Link copied to clipboard
fun <T : Any> setBlocking(key: AIAgentStorageKey<T>, value: T)
Link copied to clipboard
expect open suspend override fun toSerializedMap(): Map<String, JSONElement>

Returns serialized storage entries keyed by AIAgentStorageKey.name.

open suspend override fun toSerializedMap(): Map<String, ai/koog/serialization/JSONElement>

Returns serialized storage entries keyed by AIAgentStorageKey.name.

open suspend override fun toSerializedMap(): Map<String, JSONElement>

Returns serialized storage entries keyed by AIAgentStorageKey.name.