---
schema_version: "1"
id: 3b4392b18300c4dab5145932627f591239c9d10fbe4c53a4957ecfcff0ba9504
title: Run Agent Element
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/flow_ref_elements_create_agent.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.flow_ref_elements_create_agent.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 088295481f6517b35bf03a6fcfb49a1333a9f28c06324ee94b3794f969ec15a0
description: Use an Agentforce agent to handle tasks dynamically in your flow. Select an existing agent or create an agent with custom instructions and actions.
products:
  - Flow Builder
  - Salesforce Platform
release: "264"
---
# Run Agent Element

Use an Agentforce agent to handle tasks dynamically in your flow. Select an existing agent or create an agent with custom instructions and actions.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;"><a href="https://help.salesforce.com/s/articleView?id=platform.flow_ref_supported_editions.htm&amp;release=264.0.0&amp;type=5" title="Learn about the editions and user interfaces that support Flow Builder. Some Flow Builder features integrate with other Salesforce products that require additional licenses.">View supported editions.</a></td></tr></tbody></table>

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/images/icon_note.png)

Note Flow Builder remembers your expand and collapse preferences for this element on the canvas. Your view is stored locally in your browser and persists between sessions on the same browser; this setting is specific to you and does not affect the view of other users. However, if you clear your browser's cookies and other site data, or switch to a different browser, your preferences reset to the default expanded view. Clearing cached images or files doesn't affect this setting.

## Permissions

To use existing agents in your flows, you need the View Setup user permission. To create agents from Flow Builder, you need the Customize Application, Einstein Copilot Builder, Einstein Agent Platform Builder, or Self-Service Copilot Builder user permission. Users with the System Administrator profile can both create and use agents.

If you don't have permissions to create agents, the Create Agent button doesn't appear in the agent selection panel. You can only select existing agents.

## Usage

Add a Run Agent element to your flow. In the Agent field, search for and select an active agent, or click **Create Agent** to build a new one.

## Select an Existing Agent

To use an existing agent, search for the agent by name in the Agent field. Only active agents appear in the list. After selecting an agent, configure the agent's inputs and outputs in the properties panel.

## View Agent Details on the Canvas

After you select an agent, expand its information panel to review the agent's assigned actions without leaving Flow Builder. The panel shows each action's name, type, description, and API name. The view reflects the state of the agent, including changes made in Agentforce Builder.

In the properties panel, select the agent, and then expand the agent's information panel to see the Subagents and Actions section.

## Create a New Agent

To create an agent, click **Create Agent**. In the New Agent window, configure the agent's basic information.

 
| Field | Description |
| --- | --- |
| **Label** | The name for the agent. |
| **API Name** | The requirement for uniqueness applies only to elements within the current flow. Two elements can have the same API name, provided they're used in different flows. An API name can include underscores and alphanumeric characters without spaces. It must begin with a letter and can’t end with an underscore. It also can’t have two consecutive underscores. |
| **Description** | A description of what the agent does. |
| **User Access** | The user record that the agent runs as. Select an existing user or have the system create a user. |
| **Instructions** | Instructions that describe what the agent does and guide its reasoning. |
| **Actions** | The actions that the agent can use. Select existing actions from the asset library or create custom actions. |

## Add Actions to the Agent

The agent requires at least one action to perform tasks. Add actions before you click **Create & Activate** or in Agentforce Builder after you activate the agent.

To select existing actions, click **Select Actions**. Search for and select one or more actions from the asset library, then click **Add to Agent**. Available actions include knowledge actions, flows configured as invocable actions, and standard actions.

To create an action, click **Create Action**. In the Create Action window, configure the action.

 
| Field | Description |
| --- | --- |
| **Agent Tool Label** | The name for the action. |
| **API Name** | The requirement for uniqueness applies only to elements within the current flow. Two elements can have the same API name, provided they're used in different flows.An API name can include underscores and alphanumeric characters without spaces. It must begin with a letter and can’t end with an underscore. It also can’t have two consecutive underscores. |
| **Description** | The name for the action. The agent uses this information to determine how and when to use this action. |
| **Reference Action Type** | The type of action, such as Flow or Apex. |
| **Reference Action Category** | The subtype of the reference action type. Not all actions have a reference action category. |
| **Reference Action** | The name of the action to reference. |

For each input, add a description about what the input does. The agent uses the description to determine how to use the input when calling the action. Select **Require input to execute action** to make the input required.

For each output, add a description about the output returns and how to use the result in the flow. Select **Filter from agent context** to exclude the output from the agent’s reasoning. Select **Show in conversation** to include this output in the agent’s response.

Click **Create & Activate** to create and activate your agent.

## Configure the Element

After selecting or creating an agent, configure the Run Agent element in the properties panel.

 
| Field | Description |
| --- | --- |
| **Label** | The label for the action on the canvas and in Toolbox Manager. |
| **API Name** | The requirement for uniqueness applies only to elements within the current flow. Two elements can have the same API name, provided they're used in different flows.An API name can include underscores and alphanumeric characters without spaces. It must begin with a letter and can’t end with an underscore. It also can’t have two consecutive underscores. |
| **Description** | The description for the element. |

## Set Input Values

Configure the Run Agent element's inputs in the properties panel.

 
| Field | Description |
| --- | --- |
| **Agent Request** | A question or request to send to the agent for this flow run. The agent applies its instructions to this specific request to generate output. |
| **Session ID** | Optional. Use the Session ID returned by a Run Agent element that runs earlier in the flow. The agent retains its full reasoning context and memory from that conversation. If you don't provide a Session ID, the agent starts a new conversation, but you can always specify outputs from previous Run Agent elements as inputs. |

## Configure Structured Output

To configure the agent to return structured data that your flow can use, define structured output fields. Each field represents a piece of information that the agent extracts or generates.

If you configure structured output, the agent returns only structured data in the Structured Agent Response field. The Agent Response field returns `null`. If you don't configure structured output, the agent returns only unstructured text in the Agent Response field.

To configure structured output, click **Configure**. Configure the fields for each structured output field:

 
| field | Description |
| --- | --- |
| **Field Name** | Required. The unique alphanumeric name for the structured output field. The name can't contain special characters or spaces. |
| **Description** | A brief description used with the field name to increase large language model (LLM) accuracy. |
| **Data Type** | Required. The data type of the field. Valid values: String, Number, Boolean. |
| **Required** | Indicates that the LLM must generate a response for this output field. Requiring output rows can result in inaccurate or harmful responses by the LLM. |

## Store Output Values

 
| Field | Description |
| --- | --- |
| **Agent Response** | The unstructured response from the agent. Returns null if structured output is configured. |
| **Session ID** | The ID of the conversation session that the agent response is in. |
| **Structured Agent Response** | The structured output from the agent. Returns null if no structured output is configured. |

## Structured Output Usage

Before you configure structured output, confirm the generated label for the Run Agent element. Edit it manually if needed, and then save the flow. The API name populates based on the label.

When you configure structured output, define at least 1 structured output field before you save.

For each defined structured output field, two fields are created: one with the defined name and a related Boolean \_set field. For example, if you defined a structured output field named `summary`, then a Boolean field named `summary_set` is also created.

 
| Field | Description |
| --- | --- |
| True | The field was included in the structured agent response, but it had no set value. |
| False | The field wasn't included in the structured agent response. |

When a defined structured output returns `null`, use its related \_set field later in the flow to determine why the field is `null`.

## Usage Notes

- Test your flow before activating to ensure the Run Agent element functions as expected.
- You can find and edit agents created in Flow Builder in Agentforce Builder at any time.
- Starting in API version 67.0, AI Agent actions are no longer available from the Action element. Use the Run Agent element to work with agents. When you open a flow with an Action element that references an AI Agent action, it automatically appears as a Run Agent element. Your original configuration is preserved.