Reference
Remy Reference/agent/dataSources.defineDataSource
?

dataSources.defineDataSource

Declares a vector database and returns a typed handle you can safely define at module scope.
dataSources.defineDataSource(name) → DataSource

Declares a vector database and returns a typed handle that is lazy, so nothing runs until a method is awaited, which makes it safe to define at module scope and import wherever you search. The corpus is created the first time you reference it and shared across dev and prod, so a document added while building is already live in production. Names are fixed, since referencing one creates it: scope by user or tenant with metadata tags filtered at search time, not by minting a corpus per user.

Parameters
name
string
RequiredFixed lowercase slug ([a-z0-9_-], up to 64 chars). Referencing a name creates it, so never compute one per user or request.
Define and search
import { dataSources } from '@mindstudio-ai/agent';

export const Policies = dataSources.defineDataSource('policies');
const { results } = await Policies.search('what are the payment terms?', { topK: 5 });