UiPath Documentation
maestro
latest
false
Maestro user guide

Build a chat agent workflow

Build a real-time, AI-powered chat experience in Maestro Flow, including capabilities like output-based routing and agent handoff.

What you'll build: A conversational flow demonstrating how the core chat nodes can be used to orchestrate flexible chat experiences.

This walkthrough builds a chat experience consisting of a general helpdesk agent that decides when to hand a conversation off to an account specialist agent.

What you'll need

  • A UiPath Automation Cloud account with access to Maestro Flow.
  • An available LLM model for the agent to use.

Nodes used

  • Conversation Trigger: marks the Flow as conversational and starts it when a user initiates a chat.
  • Wait for Message: suspends until the user sends a message and returns the latest conversation context.
  • Conversational Agent: single-prompt conversational AI node that runs a turn of responses and tool-calls given the conversation context.
  • Decision: routes on an agent's structured output.
  • Send Message: send a deterministic (non-LLM) notice to the chat.

Steps

1. Create the Flow and add a Conversation Trigger

  1. From Studio Web, choose Create New, and and select Maestro Flow.
  2. Select the default trigger (labeled Manual Trigger) and choose Change trigger.
  3. In the trigger picker, select Conversation trigger.

2. Wait for the user's first message

Wait for Message should be the first node after the conversation trigger:

  1. Drag a Wait for Message node from the Conversational tools palette onto the canvas and connect it to the Conversation Trigger.
  2. In the properties panel, set Conversation ID to $vars.conversationTrigger1.output.conversationId.

The node outputs conversationContext — the recent chat history, user profile data, and other turn information — for the downstream chat nodes to consume.

3. Add a conversational agent node

The first conversational agent node we'll add is a general helpdesk agent for handling everyday IT questions itself, and decides — via a structured output — when to hand off to a specialist.

  1. Drag a Conversational Agent node onto the canvas and connect it to the Wait for Message.

  2. Rename it General Helpdesk Agent, and rename its ID in the agent's Advanced panel to generalHelpdeskAgent for easier tracking.

  3. In the agent's properties panel, set the System prompt:

    You are the internal IT helpdesk assistant.
    Answer everyday questions about our tools, wifi, printers,
    meeting rooms, and where to find internal docs.
    
    When the employee is having an account problem — 
    a forgotten password, a locked account, an MFA issue, 
    or a missing permission — tell the user that they will
    be handed off to an account specialist agent.
    You are the internal IT helpdesk assistant.
    Answer everyday questions about our tools, wifi, printers,
    meeting rooms, and where to find internal docs.
    
    When the employee is having an account problem — 
    a forgotten password, a locked account, an MFA issue, 
    or a missing permission — tell the user that they will
    be handed off to an account specialist agent.
    
  4. Under Conversational Agent Settings, bind Conversation context to $vars.waitForMessage1.output.conversationContext.

  5. Under Outputs, add an output variable:

    • Name: needsAccountSpecialist
    • Data type: Boolean
    • Default: false
    • Description: Set to true when the employee has an account problem — a forgotten password, a locked account, an MFA issue, or a missing permission. Otherwise false.

The Description on the output variable is necessary — the agent uses the description in addition to the system-prompt to generate the structured outputs after its turn in the conversation.

4. Branch on the router's decision

Follow the agent with a Decision node that routes on the structured output.

  1. Drag a Decision node onto the canvas and connect it to the General helpdesk agent.
  2. Set the condition: $vars.generalHelpdeskAgent.output.needsAccountSpecialist.
  3. Wire the False branch back to the original Wait for Message (Step 2). The general helpdesk agent keeps the conversation — it may hand off later, or never.

Leave the True branch open for now; you'll build it out in the next steps.

5. Announce the handoff

Tell the employee what's happening and ask them for next steps before the specialist takes over.

  1. On the True branch of the Decision, add a Send Message node. Configure:
    • Conversation ID: $vars.conversationTrigger1.output.conversationId
    • Exchange ID: $vars.waitForMessage1.output.conversationContext.latestExchangeId
    • Content: "You've been connected to the account specialist, which can help with password resets, unlocking your account, and permission or group membership questions. Please explain your issue."

6. Add a second Wait for Message loop with the account specialist

  1. After the Send Message, add another Wait for Message node.

  2. Set Conversation ID to $vars.conversationTrigger1.output.conversationId.

  3. Drag a Conversational Agent node and connect it to this second Wait for Message.

  4. Optionally rename it Account Specialist Agent.

  5. Set the System prompt:

    You are the account specialist. The user has been handed off 
    to you from a general helpdesk assistant.
    
    Help only with account problems — password resets, unlocking
    accounts, MFA re-enrollment, and permission or group membership
    questions.
    You are the account specialist. The user has been handed off 
    to you from a general helpdesk assistant.
    
    Help only with account problems — password resets, unlocking
    accounts, MFA re-enrollment, and permission or group membership
    questions.
    
  6. Under Conversational Agent Settings, bind Conversation context to $vars.waitForMessage2.output.conversationContext.

  7. Connect the Account specialist's output back to waitForMessage2 to close the specialist's loop.

Tip:

When you have multiple Wait for Message nodes, you might accidentally configure a downstream node to reference a stale conversation context from a Wait for Message node that executed earlier.

For easier tracking, create a Flow-level variable (for example, $vars.globalConversationContext), and update it from each Wait for Message node's Update Variable section. Downstream nodes can then reference that single source of truth instead of needing to pick the last-executed Wait for Message node's output.

7. Debug the Flow

Select Debug in the top toolbar. A chat panel opens next to the canvas.

  • Ask "How do I connect to my office VPN?" — the general helpdesk agent should answer directly and loop back for another turn.
  • Ask "I'm having issues logging in." — the general helpdesk agent should set needsAccountSpecialist: true, the Decision routes to the True branch, the handoff notice appears, and the account specialist takes over.

Inspect the execution trace to see which agent ran on each turn and what structured output the general helpdesk agent produced.

Result

Once published and deployed, your conversational Flow surfaces to end-users as a Conversational Agent on the chat deployment channels. Monitor its performance, metrics, and user feedback through chat agent observability.

Extend this Flow

  • Give the agents context and tools: connect a context resource to the agent's Context handle so it answers from an indexed knowledge source instead of the model alone. Connect tool resources to the agent's Tools handle so it can act during its conversational turns, not just respond.
  • Add parallel execution branches: In addition to routing back to Wait for Message, add parallel branches to perform behind-the-scenes actions without blocking the conversation. For example, a branch can launch a Human Task for a manager's approval, then proceed with other actions.
  • End the chat when the issue is resolved: add a resolved: true output on the agent(s) that routes to a branch that ends the execution. The conversation ends gracefully and users will see that the conversation has ended.

For example, extending the walkthrough's Flow with the above capabilities may result in a complete chat experience like this:

Was this page helpful?

Connect

Need help? Support

Want to learn? UiPath Academy

Have questions? UiPath Forum

Stay updated