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

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

This guide explains how to configure Agora [Cloud Recording](/en/api-reference/api-ref/cloud-recording) for Voice Agent conversations and avoid audio-scene conflicts when recording starts.

## Why this needs special handling [#why-this-needs-special-handling]

When you run a Voice Agent and Cloud Recording in the same channel, recording startup can briefly interrupt audio. The issue is usually caused by the agent audio scene falling back to a default mode when Cloud Recording joins the channel.

To keep audio stable, set the agent `audio_scenario` to `"chorus"` when you start the agent.

## Configure the agent [#configure-the-agent]

Set the agent's RTC audio scenario to `chorus` when you configure the agent:

<Tabs defaultValue="python" groupId="ai-sdk-language">
  <TabsList>
    <TabsTrigger value="python">
      Python SDK
    </TabsTrigger>

    <TabsTrigger value="typescript">
      TypeScript SDK
    </TabsTrigger>

    <TabsTrigger value="go">
      Go SDK
    </TabsTrigger>

    <TabsTrigger value="rest-api">
      REST API
    </TabsTrigger>
  </TabsList>

  <TabsContent value="python">
    ```python
    from agora_agent import Agent

    # client is your configured Agora client
    agent = (
        Agent(client)
        .with_stt(...)  # configure your STT vendor
        .with_llm(...)  # configure your LLM vendor
        .with_tts(...)  # configure your TTS vendor
        .with_audio_scenario('chorus')
    )
    ```
  </TabsContent>

  <TabsContent value="typescript">
    ```typescript
    import { Agent } from 'agora-agents';

    // client is your configured Agora client
    const agent = new Agent({ client })
      .withStt(/* configure your STT vendor */)
      .withLlm(/* configure your LLM vendor */)
      .withTts(/* configure your TTS vendor */)
      .withAudioScenario('chorus');
    ```
  </TabsContent>

  <TabsContent value="go">
    ```go
    import "github.com/AgoraIO/agora-agents-go/v2/agentkit"

    // client is your configured *agentkit.AgoraClient
    agent := agentkit.NewAgent(client).
        WithStt(/* configure your STT vendor */).
        WithLlm(/* configure your LLM vendor */).
        WithTts(/* configure your TTS vendor */).
        WithAudioScenario(agentkit.AudioScenarioChorus)
    ```
  </TabsContent>

  <TabsContent value="rest-api">
    Add or modify the `audio_scenario` field in the agent startup parameters:

    ```json
    {
      "properties": {
        "parameters": {
          "audio_scenario": "chorus"
        }
      }
    }
    ```
  </TabsContent>
</Tabs>

## Complete example [#complete-example]

The following example shows an agent launch request with the recommended recording-safe configuration:

```json
{
  "name": "TestConvoAgent",
  "properties": {
    "channel": "{{AccessChannel}}",
    "token": "{{token}}",
    "agent_rtc_uid": "0",
    "remote_rtc_uids": [
      "*"
    ],
    "idle_timeout": 30,
    "advanced_features": {
      "enable_bhvs": true
    },
    "llm": {
      "url": "https://api.openai.com/v1/chat/completions",
      "api_key": "<your_llm_api_key>",
      "system_messages": [
        {
          "role": "system",
          "content": "You are a helpful chatbot."
        }
      ],
      "greeting_message": "Hello, how can I help you?",
      "failure_message": "Sorry, I don't know how to answer this question.",
      "max_history": 10,
      "params": {
        "model": "gpt-4o-mini"
      }
    },
    "tts": {
      "vendor": "microsoft",
      "params": {
        "key": "<your_tts_api_key>",
        "region": "eastus",
        "voice_name": "en-US-AndrewMultilingualNeural"
      }
    },
    "turn_detection": {
      "silence_duration_ms": 640
    },
    "parameters": {
      "enable_dump": true,
      "enable_error_message": true,
      "audio_scenario": "chorus",
      "enable_delay": true
    }
  }
}
```

## Start recording [#start-recording]

After the agent is running, call the [Start Cloud Recording API](/en/api-reference/api-ref/cloud-recording/start) to begin recording.

Example Cloud Recording request body:

```json
{
  "cname": "{{AccessChannel}}",
  "uid": "{{RecordingUID}}",
  "clientRequest": {
    "token": "{{token}}",
    "recordingConfig": {
      "maxIdleTime": 120,
      "streamTypes": 0,
      "audioProfile": 1,
      "channelType": 1
    },
    "recordingFileConfig": {
      "avFileType": [
        "hls",
        "mp4"
      ]
    },
    "storageConfig": {
      "vendor": "{{Vendor}}",
      "region": "{{Region}}",
      "bucket": "{{Bucket}}",
      "accessKey": "{{AccessKey}}",
      "secretKey": "{{SecretKey}}"
    }
  }
}
```

## Related pages [#related-pages]

* [Start and stop an agent](../build/start-stop-agent)
* [Cloud Recording API reference](/en/api-reference/api-ref/cloud-recording)
