Type Alias: AgentProps

AgentProps: Omit<ComponentProps, "filters"> & object

Defines the properties for creating an AnalyticsAgent component.

The agent supports two operating modes:

  • Single-context mode: Provide contextConfig to track a single analytics asset.
  • Multi-component mode: Omit contextConfig to automatically track all embedded AnalyticsDashboard and AnalyticsMetric components on the page.

Multi-org Note: In multi-org scenarios, always specify the orgUrl property to indicate which org the agent exists in. The orgUrl must be a Lightning URL (e.g., https://yourorg.lightning.force.com).

Type declaration 

agentName? 

optional agentName: string

The custom display name for the agent. The default name is 'Analytics and Visualization'.

contextConfig? 

optional contextConfig: AgentContextConfig

Optional. The context configuration for the agent. When provided, the agent runs in single-context mode and tracks only the specified component. When omitted, the agent runs in multi-component mode and automatically tracks all embedded AnalyticsDashboard and AnalyticsMetric components on the page.

idOrApiName 

idOrApiName: string

Required. The ID of the Agentforce agent to embed.

showHeader? 

optional showHeader: boolean

A boolean value indicating whether to display the agent’s header section or not. The default value is false.

showHeaderActions? 

optional showHeaderActions: boolean

A boolean value indicating whether to display the agent’s header actions, information and restart session, or not. The default value is false.

styleTokens? 

optional styleTokens: AgentStyleTokens

The style tokens for theming the agent UI. See AgentStyleTokens for available tokens.

welcomeText? 

optional welcomeText: string

The initial welcome message displayed before the user sends a message.

Examples 

1// Single-context mode
2import { AnalyticsAgent, AgentContextType } from "@salesforce/analytics-embedding-sdk";
3import type { AgentProps } from "@salesforce/analytics-embedding-sdk";
4
5const agentProps: AgentProps = {
6  parentIdOrElement: "agent-container",
7  idOrApiName: "0Xxfib0000000xxxxx",
8  contextConfig: {
9    contextType: AgentContextType.DASHBOARD,
10    contextTypeIdOrApiName: "My_Dashboard_1",
11  },
12  showHeader: true,
13  agentName: "Sales Insights",
14  welcomeText: "Ask me anything about your sales data.",
15};
1// Multi-component mode (omit contextConfig)
2import { AnalyticsAgent } from "@salesforce/analytics-embedding-sdk";
3import type { AgentProps } from "@salesforce/analytics-embedding-sdk";
4
5const agentProps: AgentProps = {
6  parentIdOrElement: "agent-container",
7  idOrApiName: "0Xxfib0000000xxxxx",
8  showHeader: true,
9  showHeaderActions: true,
10};

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!