# Record agent conversations (/en/ai/platform/best-practices/record-agent-conversation)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

> Documentation: Conversational AI.
> Documentation version: Preview.
> This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt).


This guide explains how to record conversations with a Conversational AI Platform agent using Agora [Cloud Recording](/en/api-reference/api-ref/cloud-recording), and how to avoid audio interruptions when recording starts.

## Why this needs special handling

When an agent and Cloud Recording are in the same channel, recording startup can briefly interrupt the audio. The issue is usually caused by the agent's audio scenario falling back to a default mode when Cloud Recording joins the channel.

To keep the audio stable, set the agent's audio scenario to `chorus` when you start the session.

## Start the session with the chorus audio scenario

When you [start a session](/en/ai/platform/get-started/start-stop-agent#start-a-session), set its audio scenario to `chorus`. The SDK examples use the saved agent from [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent).

**Python SDK**

```python
session = saved_agent.create_session(
    channel="<your_channel_name>",
    token="<your_rtc_token>",
    agent_uid="1002",
    remote_uids=["1001"],
    values={"customer_name": "Ada"},
    audio_scenario="chorus",
)
session_id = session.start()
```

**TypeScript SDK**

```ts
const session = savedAgent.createSession({
  channel: '<your_channel_name>',
  token: '<your_rtc_token>',
  agentUid: '1002',
  remoteUids: ['1001'],
  values: { customer_name: 'Ada' },
  audioScenario: 'chorus',
});
const sessionId = await session.start();
```

**Go SDK**

```go
session := savedAgent.CreateSession(agentkit.CreateSessionOptions{
	Channel:       "<your_channel_name>",
	Token:         "<your_rtc_token>",
	AgentUID:      "1002",
	RemoteUIDs:    []string{"1001"},
	Values:        map[string]any{"customer_name": "Ada"},
	AudioScenario: "chorus",
})
sessionID, err := session.Start(ctx)
if err != nil {
	log.Fatal(err)
}
```

**REST API**

In the request to [Start a session](/en/api-reference/api-ref/conversational-ai/platform/start-session), set `transport.audio_scenario`:

```bash
curl --request POST \
  --url https://preview.ai.agora.io/conversational-ai/v1/projects/<your_app_id>/sessions \
  --header 'Authorization: Basic <your_base64_encoded_credentials>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10",
  "values": {
    "customer_name": "Ada"
  },
  "transport": {
    "type": "rtc",
    "channel": "<your_channel_name>",
    "token": "<your_rtc_token>",
    "uid": "1002",
    "subscribe_uids": ["1001"],
    "audio_scenario": "chorus"
  }
}'
```

The audio scenario is a session setting, not part of the agent. Set it only for the sessions you record. Other sessions keep the default, `aiserver`. For details, see [Optimize audio quality](/en/ai/platform/best-practices/audio-setup).

## Start recording

After the session is running, call the [Start Cloud Recording](/en/api-reference/api-ref/cloud-recording/start) API to begin recording. Use a recording UID that's different from the agent's and the user's UIDs.

The following example shows a Cloud Recording request body:

```json
{
  "cname": "<your_channel_name>",
  "uid": "<your_recording_uid>",
  "clientRequest": {
    "token": "<your_recording_token>",
    "recordingConfig": {
      "maxIdleTime": 120,
      "streamTypes": 0,
      "audioProfile": 1,
      "channelType": 1
    },
    "recordingFileConfig": {
      "avFileType": [
        "hls",
        "mp4"
      ]
    },
    "storageConfig": {
      "vendor": "<your_storage_vendor>",
      "region": "<your_storage_region>",
      "bucket": "<your_bucket>",
      "accessKey": "<your_access_key>",
      "secretKey": "<your_secret_key>"
    }
  }
}
```

## Reference

For more information, see the following pages:

- [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent)
- [Optimize audio quality](/en/ai/platform/best-practices/audio-setup)

### API reference

- [Start a session](/en/api-reference/api-ref/conversational-ai/platform/start-session)
- [Cloud Recording API reference](/en/api-reference/api-ref/cloud-recording)
