Creates a new in-memory storage adapter.
No configuration needed since everything is in memory.
const storage = new InMemoryStorageAdapter();
Creates a new conversation.
Conversation to create
The created conversation
If conversation with same ID already exists
Retrieves a conversation by ID.
Conversation ID
The conversation or null
Updates a conversation.
Conversation to update
Fields to update
Updated conversation
If conversation doesn't exist
Lists conversations for a user.
User whose conversations to list
Optional options: { Query options
Optional limit?: numberOptional offset?: numberOptional agentArray of conversations
Stores a message.
Message to store
The stored message
If conversation doesn't exist
Retrieves a message by ID.
Message ID
The message or null
Retrieves messages for a conversation with filtering.
Conversation ID
Optional options: IMessageQueryOptionsQuery options
Array of messages
Calculates total token usage for a conversation.
Conversation to analyze
Aggregated token usage
In-memory storage adapter for AgentOS.
Provides a complete implementation of IStorageAdapter without any persistence. All data is stored in JavaScript Map and Array structures.
Use Cases:
Characteristics:
InMemoryStorageAdapter
Implements
Example