UiPath Documentation
activities
latest
false
Integration Service activities

Execute Salesforce Agent

Send a prompt to a Salesforce Agentforce agent from a Maestro agentic process and use the agent's response in later process steps.

Description​

This activity sends a prompt to a Salesforce Agentforce agent and returns the agent's response, so the agent can take part in a process orchestrated by Maestro. Each call opens a conversation session with the agent and returns its session ID. To continue the same conversation in a later step, pass that session ID back to this activity. When the conversation is complete, pass it to the End Session activity.

Prerequisites​

Adding the activity to a Maestro process​

  1. Add a service task element to the canvas and open the task's Properties panel.
  2. In the Implementation section, from the Action dropdown list, select Start and wait for external agent.
  3. Select the Salesforce Agentforce & Flows connector.
  4. Select an existing connection or create a new one.
  5. From Activity, select Execute Salesforce Agent.
  6. From Agent, select the agent to call.
  7. In Prompt For Agent, enter the prompt to send to the agent.

At runtime, Maestro sends the prompt to the agent and waits for the response before moving to the next step.

Configuration​

FieldDirectionDescription
ConnectionInputThe connection established in Integration Service. Access the dropdown menu to choose, add, or manage connections.
AgentInputRequired. The Salesforce agent to call. The list shows the agents available to the connection, by developer name.
Prompt For AgentInputRequired. The text of the message sent to the agent.
Session IDInputOptional. The ID of an existing conversation session. Enter the Session ID output of an earlier Execute Salesforce Agent task to continue that conversation with the agent. Leave it empty to start a new session.
Message contentOutputThe content of the agent's response message.
Session IDOutputThe ID of the conversation session. Pass it to the End Session activity to close the session.

Using the agent's response in the process​

To let the agent's response influence the process, for example to make a decision at a gateway, assign it to a process variable.

  1. In Design mode, select the service task on the canvas.
  2. Select Properties.
  3. Under Output, select Add new.
  4. Add a variable of type String, for example agent_response.
  5. For Value, select message.message from the task's response.

The following abridged example shows the task's response. The agent's reply is in the message field, and session_id is the value to pass to a later Execute Salesforce Agent or End Session task.

{
  "messages": [
    {
      "id": "00000000-0000-4000-8000-000000000001",
      "type": "Inform",
      "message": "Hi there! How can I assist you today?",
      "isContentSafe": true
    }
  ],
  "session_id": "00000000-0000-4000-8000-000000000002"
}
{
  "messages": [
    {
      "id": "00000000-0000-4000-8000-000000000001",
      "type": "Inform",
      "message": "Hi there! How can I assist you today?",
      "isContentSafe": true
    }
  ],
  "session_id": "00000000-0000-4000-8000-000000000002"
}
Tip:

Keep detailed instructions in the agent's configuration in Salesforce, and keep the prompt sent from Maestro short. When a later step needs structured data, ask the agent to respond only with a JSON object, then parse the response in Maestro.

Was this page helpful?

Connect

Need help? Support

Want to learn? UiPath Academy

Have questions? UiPath Forum

Stay updated