---
schema_version: "1"
id: 56bdc554d152a1260faf4debe71a08b18fffc6efeec4e7191a5cda45e8dd07d6
title: Start Session Action
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/automate_flow_ref_elements_agent_api_start_session.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.automate_flow_ref_elements_agent_api_start_session.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 0cc73cd0efb6df8a93ac4b18ea753ae7a484ff95e4edbd73f85b730129b86e1c
description: This action starts a session for a specified agent.
products:
  - Flow Builder
  - Salesforce Platform
release: "264"
---
# Start Session Action

This action starts a session for a specified agent.

### 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;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions. Required add-on licenses vary by agent type.</td></tr><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 licenses for integrated features.</a></td></tr></tbody></table>

In Flow Builder, add an Action element to your flow. Select the **AI Agent API** category. Then, select the **Start Session** action.

## Set Input Values

 
| Field | Description |
| --- | --- |
| New Session Request Body | Required. An Apex AgentInvAction\_\_AIAgentAPIV1\_StartSessionRequest record that contains agent data to start the session. |
| Agent ID | Required. The ID of the agent that’s in the URL of the agent details page. |
| Tenant Key ID | Reserved for internal use only. |

## Set Output Values

 
| Set Field | Description |
| --- | --- |
| 200 | Batched response (headless) |
| 400 Exception | Bad request |
| 401 Exception | Access bearer token is missing or invalid |
| 403 Exception | User is forbidden from accessing the resource |
| 404 Exception | Resource not found |
| 422 Exception | Any exception that occurred during the request execution |
| 423 Exception | Server is busy and cannot process the request at this time |
| 429 Exception | Too many requests for the server to handle |
| 503 Exception | Service is unavailable possibly because Apex or flow calls timed out |
| Default Exception | Server is busy and cannot process the request at this time |
| Response Code | The response code associated with the exception message. |

## Usage

This action is available only if the following are true. Otherwise, the action fails.

- Agentforce is enabled.
- The user who runs the flow has the Manage AI Agents permission.
- The specified agent has an active version.

To set the New Session Request Body input:

- Create an Apex-defined variable and select the **AgentInvAction\_\_AIAgentAPIV1\_StartSessionRequest** Apex class.
- Use Assignment elements to set the `externalSessionKey` and `instanceConfig.endpoint` properties. The endpoint property must be set to the API endpoint.
- Use Assignment elements to set the `message.TextVariable.text` and `message.TextVariable.name` properties. The name property must be set to a context variable.
- Use the AgentInvAction\_\_AIAgentAPIV1\_StartSessionRequest variable as the New Session Request Body input.