ExportXMLWordPrintableJSON

    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      TL;DR

      Let Workspace search use MongoDB Automated Embedding without a client-side embedder. MongoDB should embed the indexed file text and the search queries server-side, while existing client-side search stays unchanged.

      Context

      Mastra is a TypeScript framework for building AI agents. A Workspace gives an agent files and a sandbox, and its search lets the agent find content without reading every file. Search can run in BM25 keyword mode, vector mode, or both (hybrid).

      Vector and hybrid search currently require both a vector store and a client-side embedder, even when MongoDB can generate embeddings itself. Passing a MongoDBVector configured with autoEmbed and no embedder throws "vectorStore requires an embedder".

      BM25-only search does not need embeddings and is unchanged.

      Current documentation: Search and indexing.

      Desired User Experience

      Examples assume imports, connection settings, and the existing embedder function are configured.

      Before: client-side embedder required

      const workspace = new Workspace({
        filesystem: new LocalFilesystem({ basePath: './workspace' }),
        vectorStore: new MongoDBVector({ id: 'search', uri, dbName }),
        embedder, // required today
      });
      
      await workspace.search('how do I reset a password?');
      

      After: proposed server-side embedding configuration

      const workspace = new Workspace({
        filesystem: new LocalFilesystem({ basePath: './workspace' }),
        vectorStore: new MongoDBVector({
          id: 'search', uri, dbName, autoEmbed: { model: 'voyage-4' },
        }), // no client-side embedder
      });
      
      await workspace.search('how do I reset a password?');
      

      Vector mode, hybrid mode and the agent's search tool should all work with the proposed configuration.

      Task

      Goals

      • Enable file indexing and vector or hybrid search without a client-side embedder when the vector store embeds server-side.
      • Preserve existing search behavior, including filters, chunked files and re-indexing of changed files.

      Where: Workspace search engine and the Workspace config.

      Out of scope: the REST API and stored-workspace configuration, RAG query tools, GraphRAG, Subconscious knowledge memory.

      Acceptance Criteria

      • Workspace search works with MongoDB Automated Embedding without a client-side embedder, in vector and hybrid modes, as described in the code examples.
      • Existing workspace search tests remain passing.
      • Existing configurations that use a client-side embedder continue working unchanged.
      • Re-indexing a changed file replaces its previous text in the vector index.
      • The Workspace search documentation and the Workspace reference describe the no-embedder configuration.

            Assignee:
            Sergey Zelenov
            Reporter:
            Sergey Zelenov
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: