Data Architecture for Agentic AI
Agents ask questions at machine speed. The data behind them has to be organized, current, permitted and traceable.
A data architecture for agents decides where each kind of information lives, how it moves from source systems into forms an agent can query, and which rules apply on the way. Keep original data, validate it before use, serve it in the shape each question needs, enforce the caller's permissions at the point of access, and record where every answer came from. Reuse your existing data platform wherever you can.
What you will learn: the kinds of data agents use, layered pipelines, how the lakehouse pattern fits, choosing serving stores, freshness and permissions, and how to handle data that agents create.
Prerequisites: RAG Explained and Agentic RAG helps. Basic familiarity with tables and files is enough.
Why agents change the requirements
A dashboard is built by a person who knows which table is trustworthy and which column is misleading. An agent knows only what you tell it and what it can reach. It may run dozens of queries for one request, combine sources nobody combined before, and present the result with confidence. Weaknesses that people quietly work around become wrong answers or wrong actions.
Four properties matter more than before:
- Meaning. Names, units and definitions must be written down where the agent can read them.
- Freshness. The agent should be able to tell how old a fact is.
- Permission. Access must follow the person or process the agent acts for.
- Provenance. Every value should be traceable to a source.
Structured, semi-structured and unstructured data
| Kind | Examples | How agents usually reach it | Typical risk |
|---|---|---|---|
| Structured | Tables of orders, accounts, inventory | Parameterized queries, approved metrics, APIs | Wrong join or wrong definition gives a plausible wrong number |
| Semi-structured | JSON events, logs, emails with headers, forms | Filters on known fields plus text search | Fields change without notice |
| Unstructured | Contracts, manuals, tickets, images, recordings | Search over extracted text, then read passages | Extraction errors and outdated copies |
| Relationships | Ownership, dependencies, organization charts | Graph traversal or recursive queries | Missing links read as "no link" |
| Event streams | Status changes, sensor readings, clicks | Materialized current state or windowed features | Late or repeated events |
The common mistake is to flatten everything into text chunks. A question such as "how many orders over 400 are on hold?" needs a query with exact filtering, not the five passages most similar to the question. The opposite mistake is forcing documents into rigid tables and losing the wording that matters.
The layers of an agent data architecture
The middle three layers resemble what many data teams call a medallion design, often labeled bronze, silver and gold. The labels matter less than the promises: raw data can always be reprocessed, validated data meets stated rules, and served data is shaped for a known use.
Keep the original, validate a copy
This small program takes five order rows, keeps them untouched, accepts the valid ones and quarantines the rest with a reason.
"""Raw -> validated -> served: keep the original, quarantine bad rows."""
raw = [
{"id": "o1", "customer": "acme", "amount": "120.50", "day": "2026-03-01"},
{"id": "o2", "customer": "acme", "amount": "oops", "day": "2026-03-01"},
{"id": "o3", "customer": "", "amount": "75.00", "day": "2026-03-02"},
{"id": "o4", "customer": "globex", "amount": "210.00", "day": "2026-03-02"},
{"id": "o4", "customer": "globex", "amount": "210.00", "day": "2026-03-02"},
]
def validate(row, seen):
if row["id"] in seen:
return None, "duplicate id"
if not row["customer"]:
return None, "missing customer"
try:
cents = round(float(row["amount"]) * 100)
except ValueError:
return None, "amount is not a number"
return {**row, "amount": cents}, None
clean, rejected, seen = [], [], set()
for position, row in enumerate(raw): # raw is never modified
good, reason = validate(row, seen)
if good:
clean.append(good)
seen.add(row["id"])
else:
rejected.append((position, row["id"], reason))
served = {} # shaped for the question asked
for row in clean:
served[row["customer"]] = served.get(row["customer"], 0) + row["amount"]
print(f"raw={len(raw)} validated={len(clean)} quarantined={len(rejected)}")
for item in rejected:
print(" quarantine row %d (%s): %s" % item)
for customer, cents in sorted(served.items()):
print(f" revenue {customer}: {cents / 100:.2f}")
Output:
raw=5 validated=2 quarantined=3
quarantine row 1 (o2): amount is not a number
quarantine row 2 (o3): missing customer
quarantine row 4 (o4): duplicate id
revenue acme: 120.50
revenue globex: 210.00
Only two of five rows reach the serving step. If the agent had read the raw rows, one customer's revenue would have been counted twice and another row would have caused an error or been silently skipped. Quarantine is as important as rejection: someone must see the rejected rows, fix the source and replay them. A quarantine that nobody reads is slow data loss.
Money is converted to whole cents here to avoid rounding surprises. Make such decisions once, in the pipeline, rather than hoping each query or prompt gets them right.
Where the lakehouse fits
A lakehouse stores data in open file formats on low-cost object storage and adds table features such as transactions, schema enforcement and time travel through a table format, for example Delta Lake or Apache Iceberg. One platform can then hold raw files, validated tables and documents, with one catalog for permissions and lineage.
| Feature | Why it helps agents |
|---|---|
| Transactions | An agent never reads a half-written table |
| Schema enforcement | Tool contracts do not break silently |
| Table history | You can reproduce what the agent saw last Tuesday, within the retention window |
| Central catalog | One place for descriptions, ownership and grants |
| Files and tables together | Documents and records share governance |
A lakehouse is one good option, not a requirement. A single relational database with full-text search and a vector extension can serve a team's assistant well. Choose the smallest arrangement that meets your freshness, scale and governance needs, and see Lineage, Governance, Lakehouse and Streaming Agents for the agent-facing side.
Table history keeps old versions on purpose. If personal data must be erased, deleting the current row is not enough: old files remain until they are cleaned up according to the platform's retention settings. Plan this with Data Contracts, Access and Retention.
Serve each question from the right store
| The agent needs | Serve it from | Interface to give the agent |
|---|---|---|
| One record by identifier | Operational database or its replica | A narrow lookup tool |
| Totals and comparisons | Warehouse or lakehouse tables | Approved metrics, see Semantic Layers and Business Metrics for AI |
| Supporting passages | Search and vector index | A search tool that returns sources |
| Chains of dependency | Graph store or recursive query | A bounded traversal tool |
| What changed minutes ago | Event stream or live API | A status tool with timestamps |
| What this user prefers | Memory store | See Memory Storage: Vector, SQL or Knowledge Graph |
The next example routes questions to a table, a document collection and a recent event list, applying the caller's region to each.
"""Send each question to the store built for it, with the caller's rights."""
import sqlite3
db = sqlite3.connect(":memory:")
db.execute("CREATE TABLE orders(id TEXT, region TEXT, status TEXT, total INT)")
db.executemany("INSERT INTO orders VALUES (?,?,?,?)", [
("o1", "east", "shipped", 120), ("o2", "east", "held", 480),
("o3", "west", "shipped", 260)])
documents = [
{"title": "Holds policy", "region": "all",
"text": "orders over 400 are held for a manual credit check"},
{"title": "West returns", "region": "west",
"text": "returns in the west region need a depot code"},
]
events = [("o2", "hold released")] # newer than the table
def order_status(order_id, user):
row = db.execute(
"SELECT status, total FROM orders WHERE id=? AND region=?",
(order_id, user["region"])).fetchone()
if row is None:
return "not found for this user"
recent = [what for key, what in events if key == order_id]
return {"table": row[0], "total": row[1], "recent_events": recent}
def search_policy(words, user):
allowed = [d for d in documents if d["region"] in ("all", user["region"])]
scored = [(sum(w in d["text"].split() for w in words), d) for d in allowed]
return [d["title"] for score, d in sorted(
scored, key=lambda pair: -pair[0]) if score > 0]
east = {"name": "dana", "region": "east"}
print("status o2:", order_status("o2", east))
print("status o3:", order_status("o3", east))
print("why held:", search_policy(["held", "credit"], east))
print("returns:", search_policy(["returns", "depot"], east))
Output:
status o2: {'table': 'held', 'total': 480, 'recent_events': ['hold released']}
status o3: not found for this user
why held: ['Holds policy']
returns: []
Three things are worth noticing. The status answer combines a table value with a newer event, so the agent can say that the order was held and that the hold has since been released, instead of repeating the stale value. The west-region order is reported as not found rather than forbidden, which avoids confirming that it exists. The last search returns nothing because the only matching document belongs to another region. The permission filter ran before ranking, so restricted text never had a chance to reach the model.
Design freshness on purpose
Write a freshness target for each served dataset, based on the decision it supports. "As fresh as possible" is not a target and tends to be expensive.
| Target | Typical method | What the agent should show |
|---|---|---|
| Live | Call the system of record | The time of the call |
| Minutes | Change data capture into a serving store | Time of the latest applied change |
| Hours | Frequent batch refresh | Time of the last successful run |
| Days | Scheduled batch | Date of the snapshot |
Return the timestamp with the data. An agent that receives only a number cannot warn anyone that it is a week old. Knowledge Ingestion and Real-Time Pipelines covers the mechanics.
Put enforcement in the data path
Prompts are not access control. An instruction such as "only discuss the user's region" can be overlooked or overridden by injected text. Enforce rules where data is read: database row and column policies, filters applied by the search service, and tool code that derives the user's identity from the authenticated session and never from model output.
If the agent connects with one powerful account, every user effectively has that account's rights. Pass the user's identity through to the data layer, or compute the intersection of the user's and the agent's rights in trusted code. See Agent Identity, Authorization and Secrets.
Data that agents create
Agents produce summaries, classifications, extracted fields, memories and notes. Treat these as a new source with lower trust than the originals.
- Store them in separate tables or fields, labeled as generated, with the model, prompt version and inputs.
- Never overwrite a system of record with generated values without validation and, for consequential fields, approval.
- Keep generated text out of the material the same agent later retrieves as evidence, or mark it clearly. Otherwise an early mistake gets cited as proof of itself.
- Give generated data a retention period and include it in deletion workflows.
Protect source systems
An agent loop can issue many queries quickly. Point heavy reads at replicas or serving copies, set timeouts and row limits, cap queries per task, and cache results that are safe to share within one permission scope. Monitor which tools generate the most load. A retry loop against an operational database can disturb people who have never heard of your agent.
Descriptions are part of the architecture
An agent chooses tables and documents by their descriptions. For each served dataset record: what one row represents, the units, allowed values, the owner, the freshness target, sensitivity and known gaps. Two sentences written by the owner usually beat a generated paragraph. Keep the descriptions next to the data, in a catalog or in the tool definition, and update them when the data changes.
A short design review
A support team starts with three tools: look up a ticket, search help articles and read account status. Ticket and status calls go to a read replica with the agent's user identity. Articles pass through a nightly pipeline that rejects any without an owner and audience. Later, managers ask for weekly totals, so the team adds approved metrics from the warehouse instead of letting the agent write queries against raw ticket tables.
Growing the architecture in steps
| Stage | What you add | Trigger to move on |
|---|---|---|
| Prototype | A copy of a few datasets and a document folder | Real users or real data are involved |
| First production use | Pipelines, checks, owners, permission filters | A second team wants the same data |
| Shared platform | Catalog, contracts, reusable serving APIs, lineage | Several agents depend on the same definitions |
| Scale | Streaming where justified, cost allocation, service levels | Measured limits, not anticipated ones |
At each stage, ask what would break if the busiest dataset doubled, changed its schema or had to forget a person. The answers show where to invest next.
How to tell whether the data layer works
Judge the architecture by evidence from real agent requests, not by how complete the diagram looks. A handful of measures covers most of it, and each can be computed from tool logs and pipeline records.
| Measure | Question it answers | Warning sign |
|---|---|---|
| Requests answered from approved stores | Do agents have what they need? | Frequent fallback to guessing or to unreviewed files |
| Data age at the time of use | Are freshness targets met? | Averages look fine while the worst cases are days old |
| Quarantine size and age | Is rejected data being repaired? | A backlog that only grows |
| Denied access attempts | Are permissions correct and are tools well scoped? | Sudden spikes, or never a single denial in testing |
| Answers with a traceable source | Could you defend a result later? | Values that cannot be tied to a dataset version |
| Cost per answered request | Is the serving design affordable? | A few question types dominating the bill |
Review these with the data owners, not only the agent team. Many problems first noticed as "the assistant is wrong" turn out to be a late feed, an undocumented column or a permission rule that was never written. Fixing them in the data layer helps every consumer, including people.
Common mistakes
- Embedding database exports as text and expecting exact answers.
- Giving the agent broad query access to operational systems.
- Filtering by permission after retrieval, or only in the prompt.
- No quarantine owner, so bad rows disappear.
- Returning values without timestamps or sources.
- Mixing generated content with authoritative records.
- Building streaming infrastructure for questions that a daily refresh answers.
Checklist
- Real questions are mapped to datasets and owners.
- Raw data is kept and can be reprocessed.
- Validation rules and a quarantine process exist.
- Each question type has a suitable serving store.
- Permissions are enforced at read time from authenticated identity.
- Results carry source and timestamp.
- Generated data is labeled, separated and deletable.
- Source systems are protected by limits and replicas.
Frequently asked questions
Do I need a new data platform for agents?
Usually not. Start with the platform you already govern and add serving pieces, such as a search index, only where real questions require them.
Should the agent query the production database?
Prefer narrow tools over open query access, and read from a replica or serving copy when load or isolation matters. Live calls make sense for single, current records.
Where should documents live?
Keep originals in governed file or object storage. The search index is a derived copy that you can rebuild, with each entry pointing back to its original.
What is the most important first step?
List the questions and actions, then confirm that someone owns each dataset behind them. Unowned data causes most of the later trouble.
References and further reading
- Armbrust et al.: Lakehouse, a new generation of open platforms (CIDR 2021)
- Databricks: medallion lakehouse architecture
- Apache Iceberg table specification
- Delta Lake documentation
- PostgreSQL: row security policies
Next steps
Knowledge Ingestion and Real-Time Pipelines
Move and refresh data reliably.
Metadata, Indexing, Quality and Lineage
Check, describe and trace it.
Semantic Layers and Business Metrics for AI
Give numbers one agreed meaning.