Loading
Agentforce and Einstein Generative AI
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          AI Agent Generative AI Usage Data Model

          AI Agent Generative AI Usage Data Model

          Use the AI Agent Generative AI Usage data model object (DMO) to analyze Agentforce and generative AI consumption patterns in Data 360.

          About AiAgentGenerativeAiUsage

          Each record represents a single generative AI interaction event processed through the AI Metering Service. The object captures the billing and metering decisions from AI services (for example, LLM Gateway and Agent Reasoner), including whether the interaction was billable, usage quantity, token counts, and identifiers for traceability and audit.

          AI Agent Generative AI Usage Fields

          The following table lists fields for the AI Agent Generative AI Usage DMO (AiAgentGenerativeAiUsage, with the developer name AiAgentGenerativeAiUsageDmo).

          Field Label Field developer Name Data Type Description
          Agent AgentIdentifier__c Text BotDefinition or agent record identifier (for example, a 0Xx ID) when the event is associated with an agent.
          Agent Developer Name AgentDeveloperName__c Text Developer name of the agent when present.
          Agent Generative AI Usage ID Id__c Text Unique identifier for the usage event record.
          Agent Type Code AgentTypeCode__c Text High-level agent or experience type (for example, EinsteinServiceAgent, AgentforceEmployeeAgent, or NOT_SET for non-agent prompt flows).
          AI Agent Interaction AiAgentInteractionId__c Text Identifier for a single interaction within a session.
          AI Agent Session AiAgentSessionId__c Text Session identifier that groups multiple interactions in one conversation.
          AI Agent Tool Identifier AiAgentToolIdentifier__c Text Identifier of the tool invoked by the agent, when applicable.
          AI Agent Tool Invocation Target Code AiAgentToolInvTargetCode__c Text Fully qualified name or target code for the base tool (for example, EmployeeCopilot__IdentifyRecordByName).
          AI Agent Tool Name AiAgentToolName__c Text Human-readable or template-style name of the tool invoked.
          Feature Descriptor Name FeatureDescriptorName__c Text Salesforce feature used for the request (for example, PromptTemplateGenerationsInvocable or CopilotForDigitalChannels).
          Generative AI Gateway Model Name GenAiGatewayModelName__c Text Model identifier in LLM Gateway (for example, sfdc_ai__DefaultOpenAIGPT4Omni).
          Generative Gateway Feature Name GenAiGatewayFeatureName__c Text Feature name as represented in Generative AI Gateway.
          Infrastructure Tenant Identifier InfraTenantIdentifier__c Text Infrastructure tenant for the org (for example, core/prod/ plus the 18-character org ID).
          Is Billable IsBillableIndicator__c Boolean Whether the event was intended to be billable for the product feature.
          Is Metered IsMeteredIndicator__c Boolean Whether the event was metered and charged (final metering decision).
          Metering Skip Reason Code MeteringSkipReasonCode__c Text When applicable, the reason usage was not metered (for example, NOT_SKIPPED or other product-specific codes).
          Model Class Type ModelClassType__c Text Model usage class (for example, STANDARD or BASIC).
          Model Provider Model Name ModelProviderModelName__c Text Provider-specific model name string.
          Model Provider Name ModelProviderName__c Text Provider of the model (for example, openai, azureopenai, or Open AI).
          Prompt Completion Token Count PromptCompletionTokenCount__c Number Count of completion tokens returned.
          Prompt Input Token Count PromptInputTokenCount__c Number Count of input tokens for the prompt.
          Prompt Template PromptTemplateIdentifier__c Text ID of the prompt design used for template-driven generations.
          Prompt Template Developer Name PromptTemplateDeveloperName__c Text Developer name of the prompt template.
          Prompt Total Token Count PromptTotalTokenCount__c Number Total prompt tokens (input plus completion) when reported in aggregate.
          Request Identifier RequestIdentifier__c Text Unique identifier for the specific gateway or runtime request.
          Telemetry Trace TelemetryTraceIdentifier__c Text Trace identifier for end-to-end log correlation (for example, a B3 trace or hex trace value).
          Telemetry Trace Span TelemetryTraceSpanId__c Text Unique identifier for the specific gateway or runtime request.
          Tier Qualifier Type TierQualifierType__c Text Tier qualifier for the event (for example, STANDARD, BASIC, scale, priority, CUSTOM, or NOT_SET).
          Timestamp Timestamp__c DateTime Time when the metering event occurred.
          Usage Type Code UsageTypeCode__c Text Digital Wallet usage type (for example, EmbeddedAI_StandardPrompts, Agentforce_StandardAction, or Agentforce_VoiceCustomAction).
          Usage Quantity UsageQuantity__c Number Quantity of business usage units recorded for the event.
          Unit Type Code UnitTypeCode__c Text Incoming unit type for metering (for example, ACTION or generations).
          User Context UserContext__c Text Context supplied for metering evaluation (for example, UT:STANDARD and feature flags).
          User ID UserId__c Text Salesforce user identifier (005 prefix) for the user associated with the event, when available.

          Query the Data Model

          You can run ad hoc queries that pull relevant information from the DMO. Data 360 offers multiple ways to query your data. See Query Data in Data 360 to learn more.

          Here are some example queries you can use.

          Billable Usage by Agent

          Use this query to identify the most expensive agents. It aggregates total usage and event counts, grouped by agent developer name and type.

          SELECT
              AgentDeveloperName__c,
              AgentTypeCode__c,
              SUM(UsageQuantity__c) AS TotalUsage,
              COUNT(*) AS EventCount
          FROM AiAgentGenerativeAiUsage_std__dlm
          WHERE IsBillableIndicator__c = true
              AND Timestamp__c >= CURRENT_DATE - 30
          GROUP BY AgentDeveloperName__c, AgentTypeCode__c
          ORDER BY TotalUsage DESC
          

          Token Consumption by Model

          Use this query to identify which models consume the most tokens. It aggregates input, completion, total tokens, and event counts by model ID, provider, and class.

          SELECT
              GenAiGatewayModelName__c,
              ModelProviderName__c,
              ModelClassType__c,
              SUM(PromptInputTokenCount__c) AS TotalInputTokens,
              SUM(PromptCompletionTokenCount__c) AS TotalCompletionTokens,
              SUM(PromptTotalTokenCount__c) AS TotalTokens,
              COUNT(*) AS EventCount
          FROM AiAgentGenerativeAiUsage_std__dlm
          WHERE Timestamp__c >= CURRENT_DATE - 30
          GROUP BY GenAiGatewayModelName__c, ModelProviderName__c, ModelClassType__c
          ORDER BY TotalTokens DESC
              

          Usage by Channel

          Use this query to compare usage across Voice and Messaging channels. It joins the generative AI usage and session tables to aggregate total usage and tokens by channel type.

          SELECT
              s.ssot__AiAgentChannelType__c         AS ChannelType,
              s.ssot__RelatedMessagingSessionId__c  AS MessagingSessionId,
              s.ssot__RelatedVoiceCallId__c         AS VoiceCallId,
              u.AgentDeveloperName__c,
              SUM(u.UsageQuantity__c)              AS TotalUsage,
              SUM(u.PromptTotalTokenCount__c)      AS TotalTokens
          FROM AiAgentGenerativeAiUsage_std__dlm u
              JOIN ssot__AiAgentSession__dlm s
                  ON u.AiAgentSessionId__c = s.ssot__Id__c
          WHERE u.Timestamp__c >= CURRENT_DATE - 30
          GROUP BY s.ssot__AiAgentChannelType__c,
              s.ssot__RelatedMessagingSessionId__c,
              s.ssot__RelatedVoiceCallId__c,
              u.AgentDeveloperName__c
          ORDER BY TotalUsage DESC
          LIMIT 20
          

          Build Data 360 Reports

          To analyze Knowledge/RAG Quality Data and Metrics, build reports in Data 360 that pull relevant information from the AiAgentGenerativeAiUsage DMO. You can use calculated insights to create metrics that can trigger alerts. To learn more, see Data 360 Reports and Dashboards.

           
          Loading
          Salesforce Help | Article