Update a session

Updated

Changes the RTC token or the model context of a running session.

Preview documentation

You're reading the Conversational AI Platform (Preview) docs. Switch to Main.
PATCH
https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/sessions/{agent_session_id}

Use this endpoint to renew the agent's RTC token, or to replace the conversation messages or LLM parameters of a running session. Each field you pass replaces its current value as a whole, so include every LLM parameter that must stay. messages also replaces the agent's instructions, so pass the instructions as the first system message to keep them. You can't change other session or transport fields after the session starts.

Support for runtime changes depends on the provider. If the provider can't apply a change, the request fails with NotImplemented and the session doesn't change.

Path Parameters

appidstring
Required

The App ID of your project.

agent_session_idstring
Required

The ID of the session, returned in agent_session_id when you start the session.

Request Body

transportobject

Changes to the transport. Only the RTC token can change.

agentobject

Changes to the running agent.

Response Body

The session was updated.

Response Headers

Agora-Request-Idstring

A unique ID for the request. Include it when you contact Agora support.

agent_session_idstring
Required

The ID of the session.

create_tsinteger
Required

The time the session was created, as a Unix timestamp in seconds.

statusstring
Required

The status of the session:

  • IDLE: The session is idle.
  • STARTING: The session is starting.
  • RUNNING: The session is running.
  • STOPPING: The session is stopping.
  • STOPPED: The session has ended.
  • FAILED: The session failed.

Authorization

This endpoint requires authentication.

Request examples

Example Request
curl -X PATCH 'https://preview.ai.agora.io/conversational-ai/v1/projects/string/sessions/string' \  -H 'Content-Type: application/json' \  -d '{  "transport": {    "token": "<your_new_rtc_token>"  },  "agent": {    "overrides": {      "messages": [        {          "role": "system",          "content": "You are helping the customer with a billing question."        }      ],      "pipeline": {        "llm": {          "params": {            "temperature": 0.2          }        }      }    }  }}'

Response example

Example Response
{  "agent_session_id": "a42ac95tp25py49fc37hp94vm67ht52h",  "create_ts": 1737111452,  "status": "RUNNING"}