Vectors & Search
Vector Embeddings for AI Agents, Explained
Every semantic search and memory system depends on turning text into numbers. Here's what vector embeddings actually are.
Updated · 5 min read

A computer can't compare the meaning of two sentences directly, it can only compare numbers. Vector embeddings are the bridge: a model converts a piece of text into a fixed-length list of numbers, positioned in a high-dimensional space so that texts with similar meaning end up close together and unrelated texts end up far apart.
That simple idea, meaning as geometric distance, is what makes semantic search, recommendation systems, and most AI agent memory retrieval possible. This guide covers how vector embeddings actually work, how similarity gets measured, and where they fit into a real retrieval pipeline.
It's worth understanding this well even if you never write an embedding pipeline yourself, because so much of modern AI infrastructure is built on top of it. Semantic search, recommendation engines, deduplication, clustering, and most retrieval-augmented generation systems all reduce, underneath their product-facing features, to the same core operation: embed the input, then find the nearby vectors.
What are vector embeddings?
A vector embedding is the output of an embedding model given a piece of input, usually a few hundred to a few thousand numbers, each one a coordinate in a high-dimensional space. The model is trained so that inputs with similar meaning produce vectors that are close together in that space, and inputs with different meaning produce vectors that are far apart.
This idea traces back to earlier word embedding techniques that mapped individual words to vectors based on the contexts they appeared in. Modern embedding models extend the same principle to full sentences and paragraphs, capturing meaning at the level most retrieval systems actually need.
How similarity between embeddings is measured
Once text is a vector, comparing meaning becomes comparing geometry. The most common measure is cosine similarity: the angle between two vectors, regardless of their length, where a smaller angle means more similar meaning. Two sentences with nearly the same meaning will produce vectors with a small angle between them, even if the exact wording is completely different.
That's the property that makes vector search useful for retrieval: a query like "how do I reset a password" and a stored memory saying "password reset requires the account email" will land close together in vector space even though they don't share many exact words, something keyword search alone would miss entirely.
Choosing an embedding model
Embedding models vary in dimensionality, cost, and what kind of content they were trained to represent well. General-purpose models, like OpenAI's embedding models, work well across most text and are the common default. Domain-specific models can outperform general ones on narrow content, code, legal text, but that gain rarely justifies the added complexity for most teams.
Whatever model you choose, consistency matters more than the specific choice: every vector in an index has to come from the same model, or the geometry breaks and similarity scores stop being meaningful. Switching embedding models later means re-embedding everything, not just the new content.
Vector embeddings vs a vector database
The two terms sit at different layers and it's worth being precise about which is which. Vector embeddings are the numeric representations themselves, the list of numbers an embedding model produces for a given piece of text. A vector database is the storage and indexing system built to hold a large collection of those embeddings and answer nearest-neighbor queries against them quickly, at scales where comparing a query vector against every stored vector one by one would be far too slow.
You need both to build a working retrieval system: embeddings without an index don't scale past a small, in-memory collection, and an index without embeddings has nothing to search. Most teams don't think about this distinction until they're debugging a slow query, at which point it usually becomes clear whether the problem is the embeddings themselves, the wrong model, poorly chunked input, or the index sitting underneath them. Knowing which layer is at fault, before you start tuning, saves a lot of wasted effort chasing the wrong fix.
How embedding dimensionality affects cost and accuracy
Higher-dimensional vector embeddings can capture more nuance, but that nuance isn't free. Every dimension adds to storage cost, memory footprint, and the time a similarity search takes, since more dimensions mean more arithmetic per comparison. A model producing 3,072-dimension vectors will cost noticeably more to store and query at scale than one producing 768-dimension vectors, even if the accuracy gain between them is modest for a given use case.
Some embedding models let you truncate their output to a shorter vector with a small, predictable accuracy tradeoff, which is a reasonable way to cut storage and query cost once you've measured that the shorter vector still meets your recall bar on real queries. The right dimensionality is an empirical question, not a default to accept unquestioned, and it's worth testing on your own content rather than assuming the largest available model is automatically the best choice.
The same logic applies to the model itself, not just its output size. A newer, larger embedding model usually scores better on public benchmarks, but benchmark gains don't always translate into a measurable improvement on your specific content and queries. Running a small, controlled comparison, same documents, same queries, different models, before committing to one at scale is cheap insurance against a costly re-embedding project later if the choice turns out to be a poor fit.
What embeddings get wrong
Vector embeddings capture semantic similarity, not factual precision. They're good at finding text about the same topic and bad at finding an exact match, an ID, a specific number, a precise date, since those don't reliably embed in a way that distinguishes them from nearby-but-wrong values. A query for order number 48213 can return content about order numbers in general without ever finding the specific one.
This is the core reason retrieval systems built on embeddings alone tend to plateau: they're excellent at fuzzy, topical recall and weak at exact and relational lookups. Most production systems pair vector search with keyword and graph-based retrieval specifically to cover that gap, an approach usually called hybrid retrieval.
There's a second, subtler limit worth knowing about: embeddings drift with context length. A vector produced for a single sentence and a vector produced for a ten-paragraph chunk containing that sentence won't be equally useful for the same query, since the longer chunk's embedding represents an average of everything in it, diluting any one specific fact. That's part of why chunking strategy matters as much as model choice: an embedding can only be as precise as the span of text it was computed over.
How stored uses vector embeddings
Every memory written to stored is embedded automatically as part of the write, so it's immediately searchable by semantic similarity, no separate embedding pipeline to build or maintain. stored also supports bringing your own OpenAI key, encrypted at rest, so embedding costs stay on your own account rather than being marked up.
Because embeddings are only one leg of stored's hybrid retrieval, a query that needs an exact fact or a relationship still gets answered correctly, the graph and keyword indexes cover what vector similarity alone would miss, all merged into a single ranked result.
Frequently asked questions
What is a vector embedding in simple terms?
A vector embedding is a list of numbers that represents the meaning of a piece of text, positioned so that texts with similar meaning produce numerically close vectors, which lets a computer compare meaning as a distance calculation.
What's the difference between vector embeddings and keyword search?
Keyword search matches exact words. Vector embeddings match meaning, so a query and a relevant result can share very few exact words and still be found, which is why embeddings handle paraphrased queries far better than keyword matching.
Can I mix embeddings from different models in one index?
No, not reliably. Every vector in an index needs to come from the same embedding model, since different models produce vectors in different, incompatible spaces where distances aren't comparable to each other.
Are vector embeddings good at finding exact facts?
Not especially. Embeddings excel at semantic, topical similarity but often miss exact IDs, numbers, or precise terms, which is why they're usually combined with keyword and graph-based retrieval in production systems.
Related reading

Vector Database: What It Is and How to Choose One
Every RAG and agent-memory pipeline needs somewhere to store embeddings. Here's what a vector database actually does and how to pick one.

Semantic Search: How It Works and Where It Falls Short
Semantic search finds what you meant, not just what you typed. Here's how it works and when it still isn't enough.

Chunking Strategies RAG: A Practical Guide
Bad chunking quietly ruins good retrieval. Here's how to actually split documents for RAG and agent memory.
See what your agents remember.
Connect an agent and stored starts building the live memory graph this post describes, free to try.
No credit card required · Free plan available · Bring your own OpenAI key