Guide

Mesh-augmented generation vs RAG, explained

Retrieval-augmented generation pulls unstructured text into an LLM prompt. Mesh-augmented generation does the same for structured data — agents query a public mesh of live, queryable grids that are schema-typed, citation-bearing, and addressable by URL, instead of scraping or re-prompting.

RAG, recapped in 100 words

Retrieval-Augmented Generation works like this: take a corpus of documents, chunk each one into ~500-token pieces, run each piece through an embedding model, store the vectors. At query time, embed the user question, find the closest chunks by cosine similarity, paste those chunks into the prompt, let the LLM answer.

It works very well for text — policy docs, manuals, knowledge bases. The vector index decouples retrieval from the model, so the agent can answer questions over a corpus too large to fit in context.

Where RAG breaks

Structured data isn't text. A spreadsheet of sales numbers, a log of API errors, a list of MCP servers — these have rows and columns, not paragraphs. Treating them as text loses three things RAG can't recover:

  • Freshness. Chunks are embedded at index time. A row added today won't surface until the next reindex.
  • Lineage. A "sales-q2.pdf" chunk doesn't tell the agent which row, which version, or who produced it.
  • Query semantics. "Top three regions by revenue" is a SQL query, not a similarity search.

You can hack around this — re-embed nightly, stuff lineage into chunk metadata, ask the model to reason over the chunks — but the hack stack gets large fast.

What MAG is

Mesh-Augmented Generation treats structured data as a first-class retrieval target. The agent doesn't search "documents"; it searches a mesh of grids — each grid is a versioned, schema-typed, citable table at a stable URL.

RAGMAG
Chunks of textRows of structured data
Embedded once, reindex periodicallyLive — latest push is what the agent reads
Provenance per chunk (file path)Provenance per row (grid UUID + version + SHA)
Cosine similarity over textSemantic + keyword search over grid metadata, plus query/filter on the rows themselves
Best for: PDFs, docs, transcriptsBest for: metrics, lists, logs, tables

What it looks like in practice

The agent gets a question:

"Compare LangGraph and CrewAI on MCP support."

A RAG pipeline would search a documentation corpus and hope someone has compared them in prose. A MAG-flavored agent calls instamesh_search("AI agent frameworks MCP support"), finds a public grid (e.g. showcase/agent-frameworks-2026), reads the relevant rows via instadash_read, and answers from structured columns with citation.

"LangGraph supports MCP as of v0.2.40 (2026-02). CrewAI is in beta as of 2026-04.
Source: showcase/agent-frameworks-2026 · v17 · last updated 2026-05-08."

When to use each

  • Pure RAG: knowledge bases, policy lookup, code-context retrieval, summarization of long docs.
  • Pure MAG: dashboards on demand, ops monitoring questions, comparison of structured options, anything where "row X, column Y" is the actual answer.
  • Both: an agent answering a multi-part question — RAG for the prose context, MAG for the numbers.

For Instadash's full design rationale, see /docs/mag. The wire-level details on how the mesh discovers grids and serves search are in /docs/mesh-protocol.

FAQ

Is MAG meant to replace RAG?

No — they target different data shapes. RAG is correct for unstructured text (docs, PDFs, notes). MAG is correct for structured rows (metrics, logs, lists, tables). A real agent often uses both — RAG for "what does this policy say", MAG for "what was last quarter's revenue".

How does the agent find the right grid in the mesh?

Via instamesh_search — a semantic + keyword search across every public grid on Instadash. Results return grid metadata (handle, slug, schema, row count, tags), and the agent picks one based on what it's looking for.

What does citation look like in MAG?

Every row in a returned grid carries lineage — the grid's UUID, version, last-updated timestamp, and the SHA-256 of the rows themselves. The agent's answer can quote any of these so a downstream system can verify provenance.

Does MAG need a vector database?

Indexing under the hood uses both lexical and embedding search, but the agent doesn't manage either. It calls a single search tool; the mesh handles freshness and ranking.

Related

More guides

Related across sections

canonical: /guides/mesh-augmented-generation-vs-rag