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.

Represents a storage key used for identifying and accessing data associated with an AI agent.

The generic type parameter T specifies the type of data associated with this key, ensuring type safety when storing and retrieving data in the context of an AI agent.

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()
actual constructor()
actual constructor()

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 <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(map: Map<AIAgentStorageKey<*>, Any>)

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

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(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 <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 toMap(): Map<AIAgentStorageKey<*>, Any>

Converts the storage to a map representation.

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

Converts the storage to a map representation.

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

Converts the storage to a map representation.

Link copied to clipboard