PAIPAI

createInMemoryThreadStore()

Ephemeral ThreadStore for tests and the first app.

All state lives in a Map for the lifetime of the process. createPai uses this by default. Not for production.

import { createInMemoryThreadStore } from "@pai/storage-inmemory";

createPai({
  agents: { main: assistantAgent },
  scopeKey: (identity) => identity.workspaceId,
  storage: createInMemoryThreadStore(),
});

Import

import { createInMemoryThreadStore } from "@pai/storage-inmemory";

Signature

function createInMemoryThreadStore(options?: {
  now?: () => Date;
  newThreadInstanceId?: () => string;
}): ThreadStore;

Parameters

options?: InMemoryThreadStoreOptions

now?: () => Date

newThreadInstanceId?: () => string

Returns

A ThreadStore.

Pass as createPai({ storage }).

Learn more

On this page