When an Agent Action returns an LWC (Lightning Web Components), the component sometimes displays correctly, and other times the response contains no component output. Instead, the agent replies with text only.
LWC intermittently does not appear after the action runs
The agent occasionally asks for additional information even when enough details were already provided
The agent may delay executing the action or take multiple reasoning steps
The action runs but the final response does not include the expected component
This behavior typically occurs when:
The agent is not instructed to always include the component
Required fields are missing or inconsistently extracted, causing the action to return an empty output
Topic instructions are overly long or contain multiple conditional branches
Phrasing is ambiguous, such as “should,” “try,” “if possible,” leading to inconsistent execution
Optional flows run too early, blocking or delaying the component response
A user requests:
“Create a lead for John Doe at john@test.com.”
Expected behavior:
→ Agent executes the action and returns the LWC lead form.
Intermittent failure:
→ The action runs but produces an empty response, causing no LWC to load.
Why this happens:
Required inputs were not fully validated
Instructions were long and ambiguous
The agent was not explicitly told to always include the component
Optional questions were asked before the action finished
To ensure the LWC always loads consistently, apply the following best practices.
Use a short, simple sequence to guide the planner.
For Example:
STEP 1 — EXTRACT INFORMATION
Extract full name → split into firstName and lastName
Extract email if present
Extract phone if present
STEP 2 — VALIDATE INPUTS
Run the action only if:
firstName is present
lastName is present
email OR phone is provided
If any required field is missing:
Ask only for the missing field
Do not re-ask for information already provided
STEP 3 — EXECUTE ACTION
If validation passes, immediately run the action without additional questions.
STEP 4 — DISPLAY THE COMPONENT
After the action runs:
ALWAYS include the returned LWC component
Respond with: “The record is being created. Let me know if you need anything else!”
Do not state that the record is already created
STEP 5 — OPTIONAL FOLLOW-UP
After showing the component, you may ask if the user wants to provide additional details.
Add this to any action that returns an LWC.
For Example:
When this action runs, you MUST:
ALWAYS include the returned LWC component in your response.
Say: “The record is being created. Let me know if you need anything else!”
Never state that the record is fully created.
Include the component even if some fields are still being processed.
This ensures the assistant never omits the component, even when the action provides partial information.
Define which fields are mandatory for the action to run.
For Example:
Before executing:
firstName must not be empty
lastName must not be empty
email OR phone must be available
If something is missing, the assistant must ask only for the missing field.
This prevents the action from producing an empty response.
Instructions should not include:
Long descriptions
Multiple nested conditions
References to backend logic
Use precise terms such as:
MUST
ALWAYS
NEVER
ONLY IF
This ensures consistent and predictable planner behavior.
5. Place Optional Steps After the Component Has Been Returned
Optional flows should not be placed before the LWC is shown.
Example:
First: show the Lead Form component
Then: optionally ask if the user wants to provide additional details
This ensures the required component is displayed every time.
005232509

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.