Data Context Definition (DCD)
Challenge
Agents perform optimally when their context consists of 3 major components:
- Instructions and Agent context
- Data
- Skills
Solution
Data Context Definition (DCD) is a structured JSON schema used to define the context and parameters for data-related operations within an application or system. It provides a standardized way to describe the data sources, formats, and processing requirements, enabling seamless integration and interaction between different components.
The Salesforce managed package includes a custom object for AIContextDefinition__c that stores DCDs and can be used to relate several objects to a DCD.
Record Centric
Most DCDs are "record centric", meaning they are designed to retrieve data related to a specific record, and related records, in Salesforce.
Rendering a Sales Quote, for example, given an Opportunity recordId context, the DCD tells the Agent to retrieve the Opportunity record, its parent Account record, and its child OpportunityLineItem records.
CRM Applications
In CRM use cases, the "context" for an Agent often includes historical data and records about the customer. Particularly in B2B Account-Based scenarios, the context includes Account information, past Cases, Opportunities, Contacts, and related records.
A well crafted DCD gives Agents highly relevant data to provide personalized experiences.
Example
The DCD below defines a record centric context for an Opportunity record, its parent Account, and its child OpportunityLineItems.
{
"version": "1.0",
"mode": "record",
"master": {
"objectApiName": "Opportunity",
"alias": "opportunity"
},
"meta": {
"definitionId": "ctx-def:{GUID}",
"revision": 3,
"sourceType": "SALESFORCE",
"sourceId": "a2Fxx0000001234AAA",
"orgId": "00Dxx0000001ABC",
"dataSourceId": "sf-prod",
"lastModifiedBy": "005xx0000017XYZ",
"lastModifiedDate": "2025-11-25T19:05:33Z"
},
"params": {
"recordIdParam": "recordId"
},
"datasets": [
{
"name": "opportunity",
"objectApiName": "Opportunity",
"cardinality": "one",
"scope": "record",
"relationship": {
"type": "master"
},
"fields": [
"Id",
"Name",
"StageName",
"Amount",
"CloseDate",
"Terms__c"
],
"filters": [],
"orderBy": [],
"exposeAsRoot": true
},
{
"name": "account",
"objectApiName": "Account",
"cardinality": "one",
"scope": "related",
"relationship": {
"type": "parent",
"dependsOn": "opportunity",
"viaFieldOnFrom": "AccountId"
},
"fields": [
"Id",
"Name",
"BillingStreet",
"BillingCity",
"BillingState",
"BillingPostalCode",
"BillingCountry"
],
"filters": [],
"orderBy": [],
"exposeAsRoot": true
},
{
"name": "lineItems",
"objectApiName": "OpportunityLineItem",
"cardinality": "many",
"scope": "related",
"relationship": {
"type": "child",
"dependsOn": "opportunity",
"viaFieldOnChild": "OpportunityId"
},
"fields": [
"Id",
"Quantity",
"UnitPrice",
"TotalPrice",
"Discount",
"Product2.Name",
"Product2.Family"
],
"filters": [
{
"field": "Quantity",
"operator": "\u003e",
"value": "0"
}
],
"orderBy": [
{
"field": "SortOrder__c",
"direction": "ASC",
"nullPlacement": "LAST"
}
],
"maxRecords": 200,
"exposeAsRoot": true
}
]
}