ruLog in to Senler

Run Agent Step

Use Run agent when an agent must prepare a result for the automation: text, attachments, or buttons. The automation saves the result to variables, and you decide what happens next—for example, send it to the lead with a Message step.

This step does not assign the agent to the dialog and does not send anything to the customer itself. In the conversation, an operator sees a collapsible technical event such as “Automation passed a request to agent,” including the selected agent's name. It explains why the agent started working but is not a customer message. The customer sees the result only after a Message step sends it. Use Add to agent for a persistent agent assignment.

Run agent is available only in For dialogs automations and executes for the current dialog. The selected agent must be active and agent replies must be enabled.

Add The Step And Select An Agent

  1. Add the Run agent action to the workflow and open its settings.
  2. In Agent, select a project agent.
  3. Decide whether the agent needs the current dialog history.

Pass dialog history is enabled by default. Keep it enabled when earlier messages should be considered while preparing the response. If you disable it, only the command, passed button, and attachments are used. This reduces context usage, but the run must then have at least one actual input: a command, an uploaded file, an attachment variable, or a button that has already been clicked.

Pass A Command And Attachments

In Agent command, describe the result you need. It supports the same data and variable templates as the Message step. For example, you can pass the lead name or the result of an earlier step.

Run Agent Step. Highlighted elements: 1. Agent; 2. Pass dialog history; 3. Agent command
1. Agent · 2. Pass dialog history · 3. Agent command

The paperclip lets you:

  • upload files specifically for this command;
  • use the attachment source field to select an Attachments variable from Run, Lead, Dialog, or Project, adding every file from its array to the command.

Uploaded files and attachments from the variable are merged. The combined total must not exceed 10.

After you select an attachment variable, its card immediately appears below the command. The card identifies the selected source, not the files themselves: the files are obtained when the run executes. Select the card to choose another variable, or use its cross button to remove it.

Clicked button from variable is optional. It is used when the agent runs again after a message with dynamic buttons. The variable may not exist yet on the first run, which is expected.

Save The Response To Variables

In Agent response, choose where each result should be stored. The picker shows the scope and name, for example, Run · agent_response_text:

  • Run keeps the result only in this run and makes it available as {{run.name}};
  • Lead stores the result for the current lead and keeps it available to later runs as {{lead.name}};
  • Dialog stores it for the current conversation as {{dialog.name}};
  • Project makes it a shared project value available as {{project.name}}.

Then choose which parts to store:

  • Response text: the prepared text;
  • Response attachments: files prepared by the agent;
  • Response button block: buttons for the next Message step;
  • Full response (JSON): the text, attachments, buttons, and event identifier in one object.
Run Agent Step. Highlighted elements: 1. Response text; 2. Response attachments; 3. Response button block; 4. Full response (JSON)
1. Response text · 2. Response attachments · 3. Response button block · 4. Full response (JSON)

The list shows only compatible variables: a string for text, an array for attachments and buttons, and an object or JSON variable for the full response. If a suitable lead, dialog, or project variable does not exist, create it from the picker; permission to create that type of variable is required.

Keep only the results that later steps need, and do not select the same variable for two results in one step.

Connect the Response output to the next step. The automation follows it after the agent finishes and the selected variables are populated.

Send The Result To The Lead

In most workflows, a Message step follows Run agent:

  1. Insert the reply-text variable into the message, for example {{run.agent_response_text}}.
  2. If needed, select Response attachments as the attachment source.
  3. Under Add button, create a Dynamic button block and select the Response button block variable.
  4. Connect the message's regular output to the next workflow branch.

The attachment source, dynamic-button, and clicked-button fields support Run, Lead, Dialog, and Project variables. Lead and Dialog are unavailable in a Background automation. Use the same scope for a result and the next source field so the value remains available. The pencil in a variable field lets you enter a nested path.

Continue After A Button Click

For buttons returned by the agent, the Message step creates one Button clicked output. Link buttons open their URL and do not trigger that branch.

To pass the lead's selection back to the agent:

  1. In Message, select the Run scope and a variable under Save clicked button.
  2. Connect Button clicked to a new Run agent step.
  3. In the new run, select the same variable under Clicked button from variable.

The variable stores the button identifier, text, and value. The next run uses them together with the command to prepare the next reply. If the buttons should work only once, disable repeated clicks in the Message step.

What To Check Before Publication

  • the run has a current dialog;
  • an active agent with replies enabled is selected;
  • when history is disabled, a command, attachment, or already populated clicked-button variable is passed;
  • the same variable is not selected for two agent results;
  • Response is connected to the next step;
  • Message uses only buttons and attachments supported by the selected channel.