Must-readAgentforce and AI
Choosing between HXL widgets and assistant rendering for AI tool results (opens in a new tab)
You will learn when to let an AI assistant render a Salesforce tool result and when to ship a Headless Experience Layer widget, and what a widget can and cannot show.
Why read this
The piece gives a worked approval-request example and the wiring needed for each assistant.
Let the assistant render
- Answers exploratory questions
- Layout can vary each run
- Charts drawn from tool results
- No build beyond the tool
Ship an HXL widget
- Fixed field order and grouping
- Buttons send decisions back
- Built once for all assistants
- No chart component in beta
The article contrasts two ways of presenting a Salesforce action’s result to users of AI assistants. By default, the assistant reads a JSON tool result from an MCP server and decides for itself what to emphasize and how to lay it out. The Headless Experience Layer, part of the Headless Toolkit, lets you define an interface once as a structured widget that assistants such as Claude, ChatGPT and Slackbot render natively. HXL is currently in beta across Agentforce employee agents in Lightning Experience, ChatGPT, Claude and Slackbot.
The authors set out a decision rule. Where users work on a Lightning Record Page or in a console app and do not ask an assistant for results, skip HXL and use standard page components, or a Lightning Web Component when those fall short. Where users ask for results in an assistant, let the assistant render the answer for exploratory questions, but ship a widget when the placement of fields, their grouping, labels and buttons matter. Their example is a sales manager approving discounts in Slackbot: a widget keeps the requested discount beside the policy limit with Approve and Reject buttons, whereas an assistant might reorder or omit the policy limit from one reply to the next.
On cost, the article argues that one widget replaces separate builds for each surface, such as a Lightning Web Component for Agentforce and a Block Kit message for Slack, so the investment pays off as the number of assistants grows. A widget is metadata-defined, composed in JSON from 22 HXL components such as rows, tables, badges, links, callouts and buttons, and is previewed with mock data in the HXL Playground. It connects to data through custom Lightning types that map an action’s output fields to widget attributes. For Agentforce you select the type as the action’s output rendering. For Slackbot, ChatGPT and Claude you attach the widget to a tool on a custom MCP server, which currently works only for invocable actions.
The limits matter as much as the method. The beta widget set has no chart component, so charts should be left to the assistant, or drawn with a Lightning Web Component when the user works in Lightning Experience. Interactive modelling, such as adjusting a discount and watching margin change, belongs on the record page rather than in a chat.
Read the original at Salesforce Architects (opens in a new tab)