Bỏ qua để đến nội dung

Choosing How the Agent Gets the Data

Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.

The question this module answers: Once you know what evidence an agent needs, how should it get each piece of it?

Module 1 started with the job and worked out the evidence. Now: how should the agent get it? It sounds like an implementation detail. It isn’t. It’s one of the most important decisions in an agent, and the one I see go wrong most often, usually the same way: everything goes into a vector index, because that’s what AI is supposed to need.

Take a decision Steve Trucking’s finance agent makes every day. A Retail Partner files a damage claim. Does it qualify, and for how much? The agent needs the delivery and when it was completed, the item and its price, the photos the crew took at delivery, any earlier claims on the same delivery, and the partner’s claim policy. All of that is grounding. But the agent shouldn’t get all of it the same way.

Don’t search for a fact you already know how to find

Section titled “Don’t search for a fact you already know how to find”

Start with the delivery. When was it completed, and by which crew? That’s on the Work Order, in Salesforce, and the claim names the delivery.

We could turn every Work Order into text, chunk it, embed it, and run a semantic search for “the delivery this claim is about.” Why would we? We know the fact, the record, the system that owns it, and how to ask. Ask the system that owns it, with a query, an action or an API call.

For a key fact a decision depends on, get the value directly from the source of record, with a query, an action or an API call, not with semantic search.

A search gives you the closest thing it found. A lookup gives you the thing.

Here’s a mistake I expect to see more and more: “We’re building an agent, so we need vector search.” Why? If the agent needs today’s open cases for a Retail Partner, that’s structured data, and we already have a very good system for finding structured Salesforce data. It’s called Salesforce.

So my default is start with the sObjects. Does the question depend on known fields, relationships and states? Then a structured query may be all you need, and it brings what you already have: a model you understand, sharing, data current to the second, and everything chapter 8 taught about indexes and scale. Don’t build architecture you don’t need.

A structured query stops being enough when the shape of the information changes. “What are Recipients saying in their damage complaints?” Now the useful information is in case descriptions, emails, maybe call transcripts, and the same idea is written a dozen different ways. That’s when I ask whether Data 360 and semantic retrieval belong in the design. Not because AI means a vector database, but because we moved from known fields and exact states to unstructured content and meaning. That’s the trigger.

And Data 360 isn’t the first answer to every retrieval problem either. Steve Trucking has it licensed; that doesn’t send every requirement there. Delivery_Reference__c = 'DLV-8472914'? Salesforce already does that. “Find complaints similar to this one, across cases, emails and transcripts”? Now Data 360 gets interesting. Use the architecture that fits the problem, not the product that happens to be on the diagram.

Now the claim policy. What does Redrock’s policy say about this kind of damage?

We know what we’re looking for, but not which section holds it, what words it uses, or whether another paragraph changes it. That’s a search problem: find the relevant knowledge. Salesforce indexes knowledge articles, documents, files and other Data 360 data and makes them available to Agentforce through search indexes and retrievers (Retrieve Data (opens in a new tab), Salesforce Help, checked 2026-11-28). The retriever finds the parts of Redrock’s policy relevant to this damage, and they go to the model as grounding. That’s RAG.

Retrieval isn’t the answer — it finds evidence for the answer

Section titled “Retrieval isn’t the answer — it finds evidence for the answer”

A retriever doesn’t answer the question. It finds information that might help. In chapter 13, the vector wasn’t the business data; it helped us find the business data. Same here: retrieval is a route to the evidence. It isn’t the evidence itself. If semantic search finds section 4 of Redrock’s policy, section 4 of that version is the evidence; the similarity score is only how we found it. In module 4, that’s the difference between “it found the right section” and “it found a section that scored well.”

Chapter 8 started in a library. If I know the author, I use the card catalog. If I know some words in the book, I search the text. AI adds a third possibility: I may not know the author, the title or the exact words, only what the book was about. And sometimes I know a little of each. That gives us four broad ways to find things. The architect’s job isn’t to pick a favorite. It’s to recognize which question is being asked.

If I know…ApproachSteve Trucking asks…On Salesforce
The structure: object, fields, conditionsStructured query“Where is delivery DLV-8472914?”SOQL on sObjects (chapter 8, modules 2 to 4)
The wordsKeyword search“Find the case where the Recipient wrote refrigerator door crushed.”SOSL and Salesforce search (chapter 8, module 5)
The meaningSemantic retrieval“Have other Recipients complained about damage like this?”Vector search in Data 360 (chapter 13)
Meaning plus structureHybrid retrieval“Similar damage complaints from Redrock’s Recipients, Arizona deliveries, the last 30 days.”Hybrid search in Data 360, with filters

A structured query is strongest when the answer has to be exact. “How many Redrock deliveries are scheduled today?” isn’t answered by “here are some deliveries that seem related to Redrock and today.” I want exactly the records that meet the conditions, every time.

Keyword search is for when you know the words but not the object or the field. The question isn’t WHERE Description = …; it’s where does this text appear? That’s why search has its own index, with its own freshness, scope and limits.

Semantic retrieval is for meaning. “Find Recipients who are frustrated because deliveries keep arriving late.” One case says “the driver came after we closed,” another “third time we’ve had to reschedule,” another “still waiting two days later.” All relevant; not one shared keyword. Semantic retrieval compares meaning, and that’s where vector search comes in. Semantic retrieval isn’t a smarter SOQL query. It’s a different approach to a different question.

Hybrid retrieval combines them. “Frustrated” is about meaning; “Redrock,” “Arizona” and “the last 30 days” are structure. Why throw away good structured information because part of the question needs meaning? In Salesforce’s words, hybrid search combines the semantic awareness of vector search with the precision of keyword search: vector search knows that “how do I log in?” and “how can I sign on?” mean the same thing but lacks domain vocabulary, and keyword search is precise on words but blind to meaning (Hybrid Search (opens in a new tab), Salesforce Help, checked 2026-11-28).

Four ways to find things Four ways to find things, one Steve Trucking domain, four lanes. Structured query, when you know the fields and conditions: "Where is delivery DLV-8472914?", answered by SOQL on the Work Order, one exact record. Keyword search, when you know the words: the case where the Recipient wrote "refrigerator door crushed", found with SOSL and Salesforce search, where the text appears. Semantic retrieval, when you know the meaning: other damage complaints like this one, found with vector search in Data 360, different words with the same meaning. Hybrid retrieval, meaning plus structure: complaints like this one from Redrock's Recipients, Arizona deliveries, the last 30 days, found with hybrid search and filters; filter what you know, search what you don't. Underneath: choose the retrieval from the question, not from the product. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.59.0", "built": "2026-11-22", "id": "DGM-DA-GR-21", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "comparison 0.5.0", "theme": "stevetecharc 1.4.0"} Structured query you know the fields "Where is delivery DLV-8472914?" SOQL on the Work Order One exact record Keyword search you know the words The case that says "refrigerator door crushed" SOSL and Salesforce search Where the text appears Semantic retrieval you know the meaning "Other damage complaints like this?" Vector search in Data 360 Different words, same meaning Hybrid retrieval meaning plus structure Like this, from Redrock, Arizona, last 30 days Hybrid search with filters Filter what you know, search what you don't Choose the retrieval from the question, not from the product. © 2026 Twinshark LLC · stevetecharc.com
Click to enlarge

Choose the retrieval from the question.

So the question is never “is vector search better?” It’s what way of finding returns the right evidence for this job? And keep the identifiers and metadata on the content: they’re what let retrieval tell two similar things apart.

Metadata can narrow the search before meaning does

Section titled “Metadata can narrow the search before meaning does”

Steve Trucking holds claim policies from three Retail Partners, each revised over the years, all saying similar things about damage in similar words. Keystone’s policy might be the closest match to the question, and it’s the wrong policy for a Redrock claim. But we know things: the partner is Redrock, the version is the one in force at delivery, the document is a claim policy. Those are exact constraints, applied before or during the semantic search (Retriever Filters Reference (opens in a new tab), Salesforce Help, checked 2026-11-28).

Filter what you know. Search what you don’t.

Structure sets the boundary; meaning finds the passage inside it. The crew assistant works the same way: filter the install guides to the model on this Work Order, WASHER-27-G, and the current version, then search for the drain-line steps. Chapter 13 showed what happens without the filter: the WASHER-27-W guide is nearly identical, scores beautifully, and is wrong.

And none of this works unless the metadata is on the content in the first place. Partner, version, effective dates, model, classification: that’s a data design decision you make when content is indexed, not when the agent is already answering.

Chunking determines what the agent can retrieve

Section titled “Chunking determines what the agent can retrieve”

Documents are split into smaller pieces we can retrieve, called chunks. Too large, and they bring back a lot that doesn’t apply. Too small, and they separate things that have to be read together.

You’ve already seen the second failure. In module 1, Redrock’s policy said damage reported within 30 days is credited, and two paragraphs later it excluded haul-away items. If those two paragraphs land in different chunks, retrieval can return the first again and again without the second. The model didn’t hallucinate. The retrieval design handed it incomplete evidence, and it filled the gap.

So chunking isn’t only an indexing setting. Chunking can change the meaning of the evidence the agent sees. That makes it a data architecture decision, and the content tells you how to make it:

  • Keep qualifiers with what they qualify. “Except,” “does not apply,” “unless”: an exception belongs in the same chunk as its rule, or the chunk carries a reference to it.
  • Keep tables whole. A row of a remedy table without its column headings is a number with no meaning.
  • Keep who said it. In a call transcript, a sentence without its speaker can turn a Recipient’s complaint into a crew member’s admission.
  • Keep sensitivity boundaries. Chapter 13’s depot-security section shouldn’t share a chunk with the Internal procedures around it.

How big? Salesforce’s own starting point, quoted in chapter 13, is 250 to 750 words per chunk, validated against the questions the agent actually gets. The same guidance warns against retrieving far more chunks than the agent uses (Resource and Cost Optimization: Agentic Patterns (opens in a new tab), Salesforce Architects, checked 2026-11-28). Treat the range as where you start, then measure with real questions.

Salesforce gives us multiple grounding paths

Section titled “Salesforce gives us multiple grounding paths”

On Salesforce there isn’t one “ground the agent” switch. A real agent uses several paths.

Salesforce data. Records, through queries and actions, with the platform’s sharing: the Work Order and its line items, the Service Appointment, the Case.

Data 360. Data from many sources, harmonized or federated, available across Salesforce. Chapter 15 covers when it’s the right home.

Agentforce Data Library. A managed way to make supported knowledge available for grounding. In Data 360’s current search-index terms, the indexes it creates are documented as Agentic Data Library (ADL) indexes (Search Index Types in Data 360 (opens in a new tab), Salesforce Help, checked 2026-11-28).

Search indexes and retrievers. The index prepares content for searching; the retriever decides how relevant content is found and returned. Today’s Data 360 retrievers support vector and hybrid search, filters, a choice of fields and number of results, and standard or custom citations (Create an Individual Retriever (opens in a new tab), Salesforce Help, checked 2026-11-28). Each is a control for narrowing what becomes evidence.

Actions and APIs. Authoritative data from Salesforce or an external system, read at the moment the agent needs it.

The job isn’t to choose one of these for the whole agent. It’s to choose the right path for each piece of evidence.

One decision can use multiple grounding patterns

Section titled “One decision can use multiple grounding patterns”

So let’s ground the finance agent’s claim decision, piece by piece.

EvidenceWhere it livesHow the agent gets it
The delivery: completed when, by which crewWork Order, SalesforceStructured lookup, by the delivery on the claim
The item and its priceWork Order Line Item, from the partner’s manifestStructured lookup
The photos taken at deliveryOff-core photo storage, indexed on the Work OrderAn action that returns this delivery’s photos
Earlier claims on this deliveryCase, SalesforceStructured query
Redrock’s claim policyPartner policy documentsRetrieval, filtered to Redrock and the version in force at delivery
One claim, five pieces of evidence One damage claim and its five pieces of evidence. In the middle, highlighted, the finance agent deciding whether a damage claim qualifies, and for how much. On the left, in Salesforce: the delivery, the Work Order, with when it was completed and by which crew, reached by a lookup by key; the item and its price, a Work Order Line Item from the partner's manifest, by a lookup; and earlier claims, Cases on the same delivery, by a query. On the right, outside Salesforce: the photos taken at delivery, in photo storage and indexed on the Work Order, returned by an action for this delivery; and Redrock's claim policy, documents chunked and indexed by version, the one piece found by retrieval, filtered to Redrock and the version in force at delivery. Underneath: look up the facts you know, retrieve the knowledge you have to find, and put together what the decision needs. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.59.0", "built": "2026-11-22", "id": "DGM-DA-GR-23", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "cells 0.5.0", "theme": "stevetecharc 1.4.0"} IN SALESFORCE THE DECISION OUTSIDE SALESFORCE The delivery Work Order: completed when, by which crew The item and its price Work Order Line Item, from the partner's manifest Earlier claims Cases on the same delivery The finance agent A damage claim: does it qualify, and for how much? The photos taken at delivery, in photo storage, indexed on the Work Order Redrock's claim policy documents, chunked and indexed, by version lookup by key lookup query an action: this delivery's photos retrieval: Redrock, in force at delivery Look up the facts you know, retrieve the knowledge you have to find, and put together what the decision needs. HOW TO READ IT the one piece the agent has to find, not look up © 2026 Twinshark LLC · stevetecharc.com
Click to enlarge

One decision, three ways to get its evidence.

Five pieces of evidence, three paths. Forcing them into one would make the design worse: either the facts get searched for, or the policy gets forced into fields it was never written as.

That’s composed grounding:

Look up the facts you know you need, retrieve the knowledge you have to find, and put together the evidence the decision requires.

It’s much closer to how the business actually works. A claims person at Steve Trucking does exactly this: opens the delivery, looks at the photos, checks for an earlier claim, then reads the policy.

Don’t duplicate data without an architectural reason

Section titled “Don’t duplicate data without an architectural reason”

Underneath grounding sits a question you’ve been answering all course: does the data actually need to be copied?

Take the truck’s position. FleetLink sends about 200,000 GPS readings a day. Copy every one into Salesforce so the Recipient’s agent can say where the truck is? No: that’s latency, sync work, storage and stale values. Steve Trucking keeps the latest position on the record, all the agent needs, and leaves the history in the telematics platform and the warehouse. Calling FleetLink live on every question isn’t free either: not when the source can’t take the load, the wait is too long, you need history or several sources, or the source isn’t reliably there when the decision is made.

These are the copy, reference, federate or retrieve decisions from chapter 14. AI doesn’t remove those trade-offs. It gives them another consumer.

Think of an agent as a tireless research assistant in our giant library. It never gets tired, which is good. It will walk to the shelves as many times as you ask, which is dangerous. A person runs a bad search once, gets frustrated and stops. An agent runs the same inefficient retrieval again and again, hundreds or thousands of times. AI doesn’t only change what we retrieve. It changes how often we retrieve it.

Steve Trucking gets about 180,000 cases a year, 60% of them “where’s my delivery?”, and those are only the people who bothered to call. What if every Recipient asks the agent four times on delivery day? That’s why the Recipient’s action reads one Work Order by the key in its token. A lookup by key stays cheap at any volume.

Deterministic access doesn’t escape chapter 8. When an agent asks Salesforce for a known fact, it asks the same engine, with the same indexes, the same selectivity and the same limits. Salesforce says so itself, in the instructions it writes for its own agent tools.

Salesforce’s hosted MCP server gives AI agents a soqlQuery tool. Its description, written for the agent to read, begins: “Always include a WHERE clause to filter results and a LIMIT clause to control result size.” Then it tells the agent to filter large objects on indexed fields, such as the record ID, the name, foreign keys and External IDs, to avoid timeouts, and it caps a transaction at 50,000 records across all its queries. Its find tool “Returns a maximum of 2,000 records total,” and when the agent needs related records after a search, it should “follow up with a soql_query using the returned IDs” (SObject All (opens in a new tab), Hosted MCP Servers, checked 2026-11-28). Search to discover, query to operate: chapter 8, written as instructions for a machine.

Agentforce’s standard Query Records action has its own considerations (Agentforce Platform | Query Records (opens in a new tab), Salesforce Help, checked 2026-11-28). Four of them are data architecture decisions:

  • What it can reach. It “works with any searchable and queryable standard objects supported by the User Interface API and any searchable custom objects.” The searchability decision from chapter 8 now decides what an agent can find.
  • How much it returns. “The maximum number of results displayed is 50, even if more than 50 matching results are found.”
  • How values are stored. “Field normalization isn’t available, so retrieving records based on field values is format-dependent”: a phone number saved as 415-123-4567 isn’t found as (415) 123 4567. If one system writes DLV-8472914 and another writes dlv 8472914, the agent finds one of them. Consistent formats are now an agent requirement.
  • Who defines the business terms. “Queries with ambiguous filter or sort criteria are determined by the LLM. No specific business rules are used.” Ask for the “worst” DC this week, and the model decides whether that means the most claims, the most late deliveries or the lowest on-time rate. If a word has a business meaning, put it in the data model, a field description or a defined action. Don’t leave it to the model.

Salesforce’s Well-Architected guidance names the trap directly: “Unbounded data retrieval affects agents more severely.” Agents retrieving context for accounts “with more than 10,000 opportunities” hit the same skew as batch jobs, and “agent reasoning can request ‘all history’ unpredictably.” The advice is to design agent actions with hard limits, “a cap on the order of 200 children per parent”, and to “Pair it with selective, indexed filters so the query itself stays cheap,” because “an unindexed filter or aggregate on a skewed parent scans the full child set before the cap applies” (Reliability for the Agentic Enterprise (opens in a new tab), Salesforce Architects, checked 2026-11-28).

You’ve met that skewed parent. Checkpoint 3’s review counted about 150,000 Work Orders under each DC account at year three. An agent asked for “the damage history at Redrock’s Phoenix DC” will happily try to read all of them. A LIMIT decides what the agent receives, not what the database reads. That’s chapter 8’s selectivity, applied again.

The same page warns that “data volume directly affects agent performance,” so tests in a sandbox with a fraction of the data give misleading results. And the cost guidance gives the check: “Keep actions fast through selective SOQL on indexed fields, bulkification, and cached reference data,” and “Validate action queries with the Query Plan tool to identify full table scans” (Resource and Cost Optimization for the Agentic Enterprise (opens in a new tab), Salesforce Architects, checked 2026-11-28).

Return only what the agent uses, too. From the same page: “a response that carries all 50 fields of a record when the task needs 8 spends context budget better allocated to conversation or grounding.”

Finding something isn’t permission to use it

Section titled “Finding something isn’t permission to use it”

Retrieval and authorization are separate decisions. On Salesforce’s MCP servers, “Every MCP tool call runs with the same permissions as the user who authorized the connection,” and “There are no service accounts, no machine-to-machine flows, and no autonomous operation outside of user context.” To narrow an agent further, Salesforce offers a read-only server and Named Queries: “Administrators can define specific SOQL queries as reusable APIs, providing controlled data access without exposing the full query surface” (Security Best Practices (opens in a new tab), Hosted MCP Servers, checked 2026-11-28). A Named Query is also a query you can check once with the Query Plan, instead of one the model writes fresh every time. Module 3 goes deeper on what evidence an agent is permitted to have.

The more dangerous failure is the one where retrieval works. The search returned something, the answer sounds convincing, and the evidence was wrong for the situation:

  • Keystone’s claim policy, retrieved for a Redrock claim;
  • last year’s version of Redrock’s policy;
  • the WASHER-27-W install guide for a WASHER-27-G;
  • one DC’s local procedure, applied at another DC.

Every one of those searches found something relevant. But relevant isn’t the same as authoritative, current or applicable. The question isn’t “did it return a result?” but “did it return the right evidence for this decision?” That’s module 3.

When you decide how an agent gets its evidence, ask four questions, for each piece of it.

  1. Do I know the specific fact I need? Then look it up in the source that owns it. Known fact → direct lookup.
  2. Do I have to find relevant knowledge? Then design the retrieval: the way of finding, the filters, the chunks. Relevant knowledge → retrieval.
  3. Does the decision need both? It often does. Decision → compose the grounding.
  4. How often will the agent ask, and is that path selective? The assistant is tireless. Check every path at the volume an agent will use it, not the volume a person would. Every path → selective, limited, and checked with the Query Plan.
Which way of finding? The decision for one piece of evidence, top to bottom, for example Redrock's claim policy for this damage. Do I know the exact fields and conditions? If yes: a structured query; look it up in the system that owns it. If not: is it about meaning, with constraints I already know? If yes: hybrid retrieval; filter on the partner, the version or the model, then search. If not: do the exact words matter? If yes: keyword search, where the text appears. If not: semantic retrieval, finding it by meaning. Underneath, for every path: current enough for this decision, permitted for this agent's job, and selective at the volume an agent will ask. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.59.0", "built": "2026-11-22", "id": "DGM-DA-GR-22", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "flow/decision 0.1.0", "theme": "stevetecharc 1.4.0"} One piece of evidence the agent needs for example, Redrock's claim policy for this damage Do I know the exact fields and conditions? Structured query look it up in the system that owns it Meaning, plus constraints I know? Hybrid retrieval filter the partner, version or model, then search Do the exact words matter? Keyword search where the text appears Semantic retrieval find it by meaning yes no yes no yes no Every path: current enough, permitted for this job, and selective at the volume an agent asks. HOW TO READ IT a step a question an answer yes goes right to an answer; no goes down to the next question © 2026 Twinshark LLC · stevetecharc.com
Click to enlarge

One piece of evidence at a time.

Stop asking “how do I put all my data into RAG?” and start asking “what evidence does this agent need, and what’s the most reliable way to get each piece of it?” Next, the harder question: once the agent has it, is it trustworthy enough to use?

  • For each piece of evidence, whether it’s a known fact to look up or knowledge to find.
  • Whether the sObjects already answer it, before anything is indexed.
  • Which way of finding fits each question: structured, keyword, semantic or hybrid.
  • What metadata goes on content when it’s indexed, so retrieval can filter before it searches.
  • How content is chunked so its meaning survives: qualifiers, tables, speakers, sensitivity.
  • Whether data is copied, referenced, federated or retrieved for the agent.
  • How every path behaves at agent volume: selective, capped, checked with the Query Plan, returning only what’s used.

Beyond the exam: what AI changes. A person who searches badly gives up. An agent searches badly at scale, all day, and never complains. Most of what keeps an agent fast, cheap and right here isn’t new: keys, indexes, selective filters, consistent formats, and knowing which system owns which fact. AI just makes the cost of skipping them show up sooner.