Skip to main content

Hello Guys, 

 

I am using accApi and trying to open an agent from LWC but facing issue as the agent is not opening only the agentforce window is opening - after that as i select the agent -conversation starts. 

 

So basically in the lwc  : 

1. i am calling   --  import { open, execute, close } from 'lightning/accApi';  

2. and after getting the agent id from my apex class i doing below :  

 

           

await open(this.resolvedBotId); // i am getting the id from apex.

            console.log('Agent panel opened successfully.');

            const utterance = "Start";

            await execute(utterance, this.resolvedBotId);

            console.log('Agent successfully invoked with utterance:', utterance);

 

But i can open the agent window but proper agent is not selecting. 

 

#Agentforce  #LWC  #AgenticAI

6 respostas
  1. 11 de set., 16:28

    @Manas Datta

     

     

    Thanks for testing that - a correct id still landing on the bare panel actually rules the id out and points to an enablement gap. open() drives the SAME native Agentforce side panel you'd get manually, and botId is only optional targeting - if that agent isn't the one wired to the panel for your running user, open() falls back to the default panel/picker no matter which id you pass. 

     

    Quick way to confirm: open the native Agentforce panel manually (the Agentforce icon, not your LWC). If it also drops you on a picker or the wrong agent, it's the setup, not your code - check the agent is Active, is the one enabled for the Agentforce panel in that org, and your running user has access to it (permission set + the agent's assigned users). Fix that and open(botId) will land on it. 

     

    If you need a specific agent guaranteed every time regardless of the panel, skip accApi and use the Agent API instead (Connect REST /einstein/ai-agent, or its Apex wrapper): you start a session against the exact agent id server-side and render the replies in your own LWC chat UI - no panel, no picker, fully deterministic.

0/9000