UiPath Documentation
maestro-automate
latest
false
Maestro Automate user guide

Build a chat agent workflow

Build a real-time, AI-powered chat experience on the canvas, with output-based routing and agent handoff.

What you build​

A conversational workflow that shows how the core chat nodes build 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.

Before you start​

  • A large language model (LLM) that the agents can use.

Nodes used​

  • Conversation Trigger: marks the workflow 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: sends a deterministic (non-LLM) notice to the chat.

Steps​

Tip:

With a coding agent set up, you can skip the manual steps. Ask it:

Build a Maestro Automate chat workflow: a Conversation trigger, a Wait for message node, a general helpdesk Conversational agent that answers IT questions and hands account questions to an account specialist agent, and Send message nodes that reply, looping back to Wait for message.
Build a Maestro Automate chat workflow: a Conversation trigger, a Wait for message node, a general helpdesk Conversational agent that answers IT questions and hands account questions to an account specialist agent, and Send message nodes that reply, looping back to Wait for message.

Then open the workflow on the canvas, check it against the steps below, and test it. Set up your coding agent describes the setup.

1. Create the workflow and add a Conversation Trigger​

  1. Create a project, as Your first workflow describes.
  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. Select the + on the output handle of the Conversation Trigger, search for Wait for Message, and select it.
  2. In the properties panel, set Conversation ID to $vars.conversationTrigger1.output.conversationId.

The node outputs conversationContext, which holds the recent chat history, user profile data, and other turn information, for the chat nodes after it to consume.

3. Add a conversational agent node​

The first conversational agent node is a general helpdesk agent that handles everyday IT questions itself and decides, through a structured output, when to hand off to a specialist.

  1. Select the + on the output handle of the Wait for Message node, search for Conversational Agent, and select it.

  2. Rename it General Helpdesk Agent, and rename its ID on the Advanced tab 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 value: 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, because 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. Select the + on the output handle of the agent node, search for Decision, and select it.
  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 and may hand off later, or never.

The True branch stays open until 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. Select the + on the output handle of the second Wait for Message node, search for Conversational Agent, and select it.

  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:

With multiple Wait for Message nodes, a downstream node might reference a stale conversation context from a Wait for Message node that executed earlier.

For easier tracking, create a workflow-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 workflow​

Select Run Debug (▶) in the bottom toolbar of the canvas. A chat panel opens next to the canvas.

  • Ask "How do I connect to my office virtual private network (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 deployed, the conversational workflow appears to users as a Conversational Agent on the chat deployment channels. Monitor its performance, metrics, and user feedback through chat agent observability.

Extend this workflow​

  • 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 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 Quick Form node 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 run. The conversation ends gracefully and users see that the conversation has ended.

The workflow can be extended with the above capabilities into a complete chat experience.

Next steps​

Was this page helpful?

Connect

Need help? Support(opens in new window)

Want to learn? UiPath Academy(opens in new window)

Have questions? UiPath Forum(opens in new window)

Stay updated