AI Search, Features, Lakebase and Lakeflow

Four data services an agent leans on, what each is for and how to keep their copies correct and current.

BeginnerIntermediateExpert · 12 min read · Last updated:

In short

Use AI Search to find relevant text, feature tables and serving for precomputed facts about an entity, Lakebase Postgres for fast transactional state, and Lakeflow to ingest, transform and schedule the data that feeds them. Each holds a copy of something, so each needs an owner, a freshness target, permissions and a way to delete.

What you will learn: which service answers which need, preparing documents for search, hybrid retrieval, features as context, operational state and memory, pipelines, freshness and deletion, quality and cost.
Prerequisites: RAG Explained and Agentic RAG and Data Architecture for Agentic AI.

Versions used

The example runs in November 2026 with Python 3.13 and only the standard library. It simulates a change feed and an index with invented documents; it does not call Databricks. Platform facts come from Databricks documentation and announcements checked on November 28, 2026. Several features named here are beta or preview. OneSmartClick is independent of Databricks.

Beginner Which store for what

Four different needs

The agent needs toServiceExample
Find passages relevant to a questionAI SearchWhich policy covers late returns?
Count, join or total exact recordsSQL over tables, often through a function or GenieHow many returns last week?
Look up current attributes of one entity quicklyFeature table with online servingThis customer's tier and open cases
Read and write application stateLakebase PostgresDraft status and approval records
Remember across conversationsA memory storePreferred language

A common early mistake is to push every need into text search. Search returns similar passages; it does not add numbers reliably or guarantee that it found every matching record. Route exact questions to queries.

How data reaches an agent

SourceApps and files
IngestLakeflow
RefineClean tables
PublishIndex or store
UseAgent tool
Delay and error can enter at every arrow, so measure end to end.

Many teams organize refinement in raw, cleaned and business-ready layers, which Databricks documents as the medallion architecture. Agents should read the refined layers, with exceptions only for cases that truly need raw content.

Databricks AI Search, formerly Vector Search, indexes data so that queries can find related items. A common pattern builds an index from a Delta table and keeps it synchronized with changes. Documentation describes options in which the platform computes embeddings from a text column, or you supply embeddings yourself, and support for combining meaning-based and keyword matching. Choose the embedding model deliberately: changing it means computing every vector again and re-testing retrieval.

Intermediate Retrieval, features and state

Prepare the source table

Retrieval quality is mostly decided before indexing. Build a clean table in which each row is one passage with:

ColumnPurpose
Stable passage keyUpdate and delete precisely
Document identifier and versionCite and trace the source
Passage text with its headingsWhat gets searched and shown
Title, type, product, languageFilter before ranking
Effective and expiry datesExclude outdated content
Access group or classificationRestrict results
Source address and checksumDetect change and verify

Split along the document's own structure, keep tables readable and remove repeated page furniture. Ingestion and chunking gives the methods.

Retrieve well

  • Apply metadata filters first, such as product, region and current version.
  • Use hybrid search when exact codes, names or error numbers matter.
  • Rerank a larger candidate set when top results are often slightly wrong.
  • Return identifiers and dates with every passage so the answer can cite them.
  • Allow "nothing suitable found" instead of forcing the nearest passage.

Measure with questions whose correct passages you know. The managed MCP server for AI Search lets agents query an index through a standard tool interface; documentation says it requires platform-managed embeddings, and the older URL prefix from the Vector Search name still works. See hybrid search and reranking.

Permissions on retrieved text

Permission on an index grants access to what the index returns. Documents that had different readers at the source can end up in one index that anyone with access can query. Decide how to prevent this: separate indexes by audience, or filters applied by trusted code from the verified user's attributes, never from text the user or model supplies. Test it with real accounts. Retrieval security and freshness has more.

Features as agent context

A feature is a prepared value about an entity, such as orders in the last thirty days. On the platform, tables with primary keys can serve as feature tables, and values can be published to an online store for low-latency lookup. For agents, features provide compact, consistent context that is cheaper and safer than letting the model compute from raw history.

  • Give each feature a definition, owner, unit and refresh time.
  • Pass the timestamp along with the value.
  • Keep sensitive inferences out unless there is a clear, lawful purpose.
  • When evaluating on past cases, use values as they were at that time, to avoid leaking the future.

Lakebase for state

Lakebase is the platform's managed Postgres database. Agent applications can use it for conversation and run state, task queues, approvals and other records that need transactions and quick single-row access. Design it like any production database: schemas and migrations in source control, constraints for important rules, idempotency keys for actions, connection pooling, backups and tested restore. In September 2026, Databricks announced Lakebase Search, a beta that adds vector and full-text search inside Lakebase. AI Search remains a separate managed retrieval service; compare them on your data and on release status.

Memory

Databricks release notes announced managed agent memory as a beta in June 2026, with memories held in Unity Catalog memory stores and isolated by scope. A managed service reduces infrastructure work but not design work. Decide what may be remembered, who can see it, how conflicts are resolved and how users inspect and delete it. Prefer a few useful, sourced facts over saving whole conversations. See agent memory and forgetting policies.

Lakeflow pipelines

The Lakeflow name covers ingestion, transformation and orchestration:

PartRoleEarlier name
Lakeflow ConnectManaged ingestion from sourcesNone listed here
Lakeflow Spark Declarative PipelinesDeclared batch and streaming transformationsDelta Live Tables
Lakeflow JobsScheduling and orchestrationDatabricks Workflows

For agent knowledge, a pipeline typically detects new or changed documents, parses them, applies quality rules, splits them into passages and writes the source table that the index follows. Make each step repeatable: running it twice must not create duplicates. Send failures to a quarantine table that someone reviews, rather than dropping them silently. Knowledge pipelines explains the pattern.

Expert Freshness, deletion and operations

Freshness is end to end

The delay a user sees is the sum of source export, ingestion, processing, index synchronization and caching. State a target for each kind of content, for example "price changes visible within an hour", and measure the difference between source change time and first successful retrieval. A synchronization mode that runs continuously costs more than a triggered one; pay for speed only where it matters.

Staleness from a sync interval

The program applies a feed of updates and deletions to an index at different intervals and counts minutes of disagreement.

"""Follow a table change feed into a search index and measure staleness."""

# (minute, operation, document id, text)
CHANGES = [
    (0, "upsert", "policy-1", "Returns accepted within 30 days"),
    (2, "upsert", "policy-2", "Free delivery over 50"),
    (7, "upsert", "policy-1", "Returns accepted within 14 days"),
    (9, "delete", "policy-2", None),
    (13, "upsert", "policy-3", "Gift cards do not expire"),
]


def sync(index, changes, upto, done):
    """Apply unapplied changes up to a minute. Returns the new position."""
    pos = done
    while pos < len(changes) and changes[pos][0] <= upto:
        _, op, doc, text = changes[pos]
        if op == "delete":
            index.pop(doc, None)
        else:
            index[doc] = text
        pos += 1
    return pos


def truth(changes, upto):
    table = {}
    sync(table, changes, upto, 0)
    return table


def stale_minutes(interval, horizon=20):
    """Count minutes when the index disagrees with the source table."""
    index, pos, bad = {}, 0, []
    for minute in range(horizon):
        if minute % interval == 0:
            pos = sync(index, CHANGES, minute, pos)
        if index != truth(CHANGES, minute):
            bad.append(minute)
    return bad


for interval in (1, 5, 10):
    bad = stale_minutes(interval)
    print(f"sync every {interval:>2} min: stale for {len(bad):>2} of 20 minutes")

index, pos = {}, 0
pos = sync(index, CHANGES, 5, pos)
print("minute 9, index still says:", index.get("policy-2"))
print("source at minute 9 has it:", "policy-2" in truth(CHANGES, 9))

Output:

sync every  1 min: stale for  0 of 20 minutes
sync every  5 min: stale for  8 of 20 minutes
sync every 10 min: stale for 15 of 20 minutes
minute 9, index still says: Free delivery over 50
source at minute 9 has it: False

With a five-minute interval the index disagreed with the source for 8 of 20 minutes, and with a ten-minute interval for 15. The final lines show the case that matters most: a deleted policy was still retrievable. These figures come from five invented changes and say nothing about any real service's speed. The lesson is to measure deletions explicitly, because an index can look healthy while serving something that was withdrawn. For urgent withdrawals, add a block list checked at query time.

Deletion everywhere

When a record must be removed, list every place that holds it: raw files, refined tables, table history, search indexes, feature stores, databases, memory, caches, traces and evaluation datasets. Each has its own mechanism and delay, and table history can keep earlier versions until maintenance removes them. Test the whole path and keep evidence. Legal retention duties may conflict with deletion requests, so involve your privacy team.

Quality controls

  • Reject passages that are empty, garbled or far longer than expected.
  • Check row counts and the share of rows changed against normal ranges.
  • Detect duplicates and conflicting versions of one document.
  • Run a fixed set of retrieval questions after each significant load.
  • Stop publication when checks fail, and keep the last good version serving.

Lineage and impact

Record which sources feed which tables, indexes and agents. Release notes state that managed ingestion pipelines record source lineage in Unity Catalog. When a source owner announces a change, lineage tells you which agents to retest; when bad content is found, it tells you which copies to repair.

Failure behavior

FailureAgent should
Search unavailableSay so; do not answer from memory as if sourced
Data older than its targetShow the date, or decline for critical facts
Feature missingTreat as unknown, not zero
State write failsDo not report success; retry safely
Memory conflicts with a system of recordTrust the record and correct the memory

Cost

Indexes, online stores and databases may incur cost while idle, and continuous pipelines run all the time. Estimate storage, embedding computation, query volume and compute per environment. Remove unused development indexes, schedule where continuous sync is unnecessary and tag resources so that cost reaches an owner. See cost attribution.

Rebuild and recovery

Treat derived stores as rebuildable: keep source tables, code and configuration so that an index or feature table can be recreated, and time how long that takes. Operational databases are different, since they hold original records; they need backups and restore drills with agreed limits on data loss and downtime. High availability and recovery covers the planning.

A design example: a returns assistant

Consider an invented retailer building an assistant for service staff. The table below shows how each need maps to a store, with a freshness target agreed by the content owner. The values are illustrative.

NeedStore and toolFreshness target
Current returns policy textAI Search over published policy passagesWithin one hour; withdrawals immediately
Status of one orderFunction calling the order system or its tableLive or a few minutes
Customer's returns in the past yearFeature lookupDaily, shown with its date
Draft refund awaiting approvalLakebase tableImmediate and transactional
Staff member's preferred languageMemory with a visible settingUntil changed

Notice that the refund decision never depends on a memory or a search result alone. The assistant reads the live order, quotes the current policy with its date and writes a draft that a person approves. If the order lookup fails, it says it cannot check the order instead of reasoning from the customer's history.

Test the data layer separately

Before testing the whole agent, test what it reads. For search, check that known questions return the right passage in the first few results, that withdrawn documents never appear and that restricted documents never reach the wrong group. For features, reconcile a sample against source tables. For state, run concurrent updates and retries to confirm that one approval cannot be applied twice. For pipelines, feed deliberately broken files and confirm that they are quarantined. When an end-to-end test fails later, these checks tell you quickly whether the fault lies in the data or in the agent's reasoning.

Agree contracts with producers

Pipelines that feed agents break when someone upstream renames a field, changes a unit or starts sending a new document type. Write a short data contract for each source: fields, meaning, update frequency, quality checks, contact and notice period for changes. Check it automatically on arrival. Data contracts, access and retention provides a template.

Common mistakes

MistakeConsequenceInstead
Searching for totalsIncomplete or wrong numbersQuery tables
Indexing raw dumpsNoisy answersCurate a passage table
One index for all audiencesLeaksSeparate or filter in trusted code
Ignoring deletionsWithdrawn content resurfacesTest removal end to end
Memory as system of recordSilent disagreementKeep records authoritative
Assuming sync is instantStale answersMeasure and display dates

Checklist

  • Each question type is routed to a suitable store.
  • Passage tables carry keys, versions, dates and access data.
  • Retrieval is measured with known answers.
  • Every copy has an owner, freshness target and deletion path.
  • Pipelines are repeatable, with quarantine for failures.
  • State and memory have separate rules.
  • Rebuild and restore times are known.

Frequently asked questions

Do I need both AI Search and Lakebase?

Only if you need both large managed retrieval and transactional state, or if testing shows one cannot serve both. Check release status before consolidating on a beta feature.

Can the agent query Delta tables instead of using features?

Yes for analysis and slower tasks. Online serving helps when many fast single-entity lookups are needed with consistent definitions.

How often should an index synchronize?

As often as the content's freshness target requires. Set the target with the content owner and compare the cost of faster modes.

Is long-term memory required?

No. Many useful agents have none. Add it when remembering specific facts measurably helps and you can govern them.

References

Where to go next