Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

AI Agents · Const

Semantic Search

Semantic search lets a LangGraph agent retrieve memory-store items by meaning rather than exact wording. Configure semantic indexing, then provide a natural-language query to the store.

How it works

Semantic search lets an agent retrieve stored memories by meaning instead of requiring exact word matches. Configure an embedding model for the store, then pass a natural-language query to the store's search method.

Syntax

await store.search(namespace, { query: string });

Parameters

NameTypeDescription
namespacestring[]Namespace tuple identifying the memory collection to search.
optionsobjectSearch options containing the natural-language query.

Returns

An array of stored items ranked by semantic similarity.

Key points

  • Configure the graph's memory store for semantic search before querying it.
  • The store can retrieve memories based on semantic similarity rather than exact textual matches.
  • Use the store's search method with a namespace and search options.
  • The query can be written in natural language to find conceptually related stored items.

Common mistakes

  • Semantic search requires indexing settings in the graph or deployment configuration; calling search with a query alone is not sufficient.

Example: Semantic search in a memory store

const items = await store.search(["user_123", "memories"], {
  query: "I'm hungry",
});

Searches a memory namespace using a natural-language query and returns semantically similar stored items.

When to use it

Personalized agents

Retrieve user preferences or facts from long-term memory across conversations.

Meaning-based memory retrieval

Find relevant stored information when the query wording differs from the saved text.

Context-aware responses

Support agent workflows that search memory before generating a response.

  • Store
  • search
  • memory store
  • semantic similarity
  • embedding model
  • indexing settings

Source: Memory. Checked 2026-10-15.