Flow Designer AI Agent Action Failing with "Invalid agent ID" Error

vanandnaidu
Tera Contributor

I am facing an issue while calling an AI Agent from a Flow Designer flow.
Errors 

[plugin: com.glide.utilities.flow_designer_genai_extensions name: AIAgentInstructionExecutor]
[plugin: com.glide.utilities.flow_designer_genai_extensions name: AIAgentInstructionExecutor]
Invalid agent ID

Scenario

  • Using Flow Designer.
  • Calling an AI Agent through the AI Agent action/activity.
  • The flow execution fails with the above error.
  • The AI Agent is expected to process the instruction and return a response.

    What I Have Checked

    • Verified that the AI Agent exists in the instance.
    • Confirmed the Agent ID configured in the flow.
    • I was able to get the output when AI agent tested directly.
    • I am using domain separation in the instance (both flow designer and Ai agent are in same scope).


1 REPLY 1

KPNow
Kilo Guru

Hi @vanandnaidu :

 

This issue probably relates to a disconnect between how ServiceNow evaluates your developer session versus how Flow Designer executes at runtime under domain separation. When you test the AI Agent directly, the platform uses your active user session, domain scope, and permissions, allowing it to easily resolve the agent record. However, Flow Designer generally runs under a distinct context determined by its Run As setting (either System User or the user who triggered the flow). If that execution context doesn't sit above or within the exact domain where the AI Agent record is stored, or if domain visibility rules restrict the background engine, the AIAgentInstructionExecutor plugin won't be able to fetch the record, throwing the "Invalid agent ID" error.

To get this working, I would suggest you start by opening the flow properties and checking the Run As setting switching it to System User often resolves background domain visibility issues. Next, verify that the flow action is receiving the AI Agent’s exact 32-character sys_id rather than a display name, as dynamic lookup scripts can strip scope context during flow execution. Finally, make sure the AI Agent record is fully published and active; direct testing often works on draft or checked-out states that Flow Designer’s runtime engine intentionally blocks.