You are here:
Start Session Action
This action starts a session for a specified agent.
Required Editions
| Available in: Lightning Experience |
| Available in: Enterprise, Performance, Unlimited, and Developer Editions. Required add-on licenses vary by agent type. |
| View licenses for integrated features. |
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
externalSessionKeyandinstanceConfig.endpointproperties. The endpoint property must be set to the API endpoint. - Use Assignment elements to set the
message.TextVariable.textandmessage.TextVariable.nameproperties. The name property must be set to a context variable. - Use the AgentInvAction__AIAgentAPIV1_StartSessionRequest variable as the New Session Request Body input.
Did this article solve your issue?
Let us know so we can improve!

