> ## Documentation Index
> Fetch the complete documentation index at: https://visionagents.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Tencent RTC

[Tencent RTC](https://sc-rp.tencentcloud.com:8106/r/7B) (Real-Time Communication) is an edge transport plugin that replaces the default communication layer in Vision Agents. It connects your agent to Tencent's global real-time network, optimized for ultra-low latency in mainland China and across Asia.

## Why Tencent RTC

* **Low-latency in Asia** - Tencent's edge network delivers strong performance in Asia, where other transport providers may face higher latency or connectivity issues.
* **Frontend SDKs** - Tencent provides client SDKs for [Web](https://sc-rp.tencentcloud.com:8106/r/7B), iOS, and Android, so you can build end-user applications that connect to the same RTC room as your agent.
* **Drop-in replacement** - The plugin implements the same `EdgeTransport` interface. Swap `edge=tencent.Edge(...)` into your `Agent` and keep your existing LLM, STT, TTS, vision, and avatar plugins unchanged.
* **Audio and video** -- Supports both audio and video tracks for voice agents, video agents, and multimodal applications.

## Installation

```sh theme={null}
uv add vision-agents["tencent"]
```

On Linux this pulls `liteav` from PyPI. On macOS the `liteav` dependency is skipped via a platform marker, so the package installs but `tencent.Edge()` raises at runtime — use the Docker setup in **Get Started** below.

## Get Started

Talk to an agent in about five minutes. You need Docker, an `.env` at the [Vision Agents](https://github.com/GetStream/Vision-Agents) repo root with `TENCENT_SDK_APP_ID`, `TENCENT_SDK_SECRET_KEY`, `OPENAI_API_KEY`, and `ELEVEN_API_KEY`, and a working microphone in a Chromium-based browser. The example pairs Tencent TRTC with OpenAI (LLM) and ElevenLabs (STT + TTS).

<Steps>
  <Step title="Set up credentials and join from the browser" icon="key">
    Create an RTC application in the [Tencent RTC Console](https://sc-rp.tencentcloud.com:8106/r/vB) to obtain your credentials:

    | Variable                 | Description                               |
    | ------------------------ | ----------------------------------------- |
    | `TENCENT_SDK_APP_ID`     | Your RTC application's integer App ID     |
    | `TENCENT_SDK_SECRET_KEY` | Secret key for generating user signatures |

    Open Tencent's hosted [TRTC Web SDK quick demo](https://web.sdk.qcloud.com/trtc/webrtc/v5/demo/quick-demo-js/index.html):

    * Paste your `TENCENT_SDK_APP_ID` into **SDKAppID** and `TENCENT_SDK_SECRET_KEY` into **SDKSecretKey** — the page generates `UserSig` client-side.
    * Leave the auto-generated **UserID** and **RoomID(String)** as is.
    * Click **Enter Room** — the demo log should print `🟩 [user_***] enterRoom.`
    * Click **Start Local Video** — this also publishes the mic.
  </Step>

  <Step title="Launch the agent in Docker" icon="docker">
    Clone the Vision Agents repo, copy the **RoomID(String)** from the demo form, and start the example agent:

    ```sh theme={null}
    git clone https://github.com/GetStream/Vision-Agents.git
    cd Vision-Agents/plugins/tencent
    TENCENT_TEST_ROOM_ID=<paste-room-id-here> docker compose run --rm tencent-agent
    ```

    On first run this builds the image and resolves the workspace; subsequent runs are faster. When the agent joins you'll see `Tencent TRTC OnRemoteUserEnterRoom: <userId>` matching the **UserID** shown in the demo.
  </Step>

  <Step title="Talk to the agent" icon="microphone">
    The flow is `browser → Tencent → STT (ElevenLabs) → LLM (OpenAI) → TTS (ElevenLabs) → Tencent → browser`. Confirm each leg in the agent log:

    * `🎤 [Transcript Complete]: …` — STT got your speech.
    * `🤖 [LLM response final]: …` — LLM produced a reply.
    * Reply plays back in the browser.
  </Step>
</Steps>

## Usage in your own code

All Vision Agents features work out of the box with the Tencent transport. Swap in any LLM, STT, TTS, vision, or avatar plugin, use function calling, tools, and knowledge, everything works the same way as with the default transport.

```python theme={null}
import os

from vision_agents.core import Agent, Runner, User
from vision_agents.core.agents import AgentLauncher
from vision_agents.plugins import elevenlabs, openai, tencent


async def create_agent(**kwargs) -> Agent:
    agent = Agent(
        edge=tencent.Edge(
            sdk_app_id=int(os.environ["TENCENT_SDK_APP_ID"]),
            key=os.environ["TENCENT_SDK_SECRET_KEY"],
        ),
        agent_user=User(name="Tencent Voice Agent", id="tencent-voice-agent"),
        instructions="You are a helpful voice assistant. Respond concisely.",
        llm=openai.LLM(),
        tts=elevenlabs.TTS(),
        stt=elevenlabs.STT(),
    )
    return agent


async def join_call(agent: Agent, call_type: str, call_id: str, **kwargs) -> None:
    await agent.authenticate()
    # `call_id` must match the RoomID(String) from the Tencent demo so the
    # browser participant is already in the room before the agent connects.
    call = await agent.create_call(call_type, call_id)

    async with agent.join(call, participant_wait_timeout=None):
        await agent.say("Hi! How can I help you today?")
        await agent.finish()


if __name__ == "__main__":
    Runner(AgentLauncher(create_agent=create_agent, join_call=join_call)).cli()
```

<Warning>
  The underlying [`liteav`](https://pypi.org/project/liteav/) package ships only manylinux wheels — **Linux x86\_64 / aarch64 only**. On macOS and Windows, run the agent inside a Linux container (see **Get Started**). User signatures are required for room entry; either generate them with [TLSSigAPIv2](https://cloud.tencent.com/document/product/647/34399) or pass `key=` and let the plugin sign per join.
</Warning>

## Parameters

| Name         | Type  | Default | Description                                                                                                                                                                                                                        |
| ------------ | ----- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sdk_app_id` | `int` | `None`  | RTC application ID. Falls back to the `TENCENT_SDK_APP_ID` environment variable if not provided.                                                                                                                                   |
| `key`        | `str` | `None`  | Secret key for generating user signatures. Falls back to `TENCENT_SDK_SECRET_KEY` if not provided.                                                                                                                                 |
| `user_sig`   | `str` | `None`  | Pre-computed user signature. If omitted, a signature is generated automatically from `key` at join time. See the [UserSig generation guide](https://trtc.io/document/35166?product=rtcengine\&menulabel=core%20sdk\&platform=web). |
| `video_fps`  | `int` | `15`    | Frames per second for outgoing video encoding (supported range: `5`–`60`).                                                                                                                                                         |

## Environment Variables

| Variable                 | Default | Description                                                                                                                   |
| ------------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `TENCENT_SDK_APP_ID`     | --      | Fallback for `sdk_app_id` when not passed to the constructor.                                                                 |
| `TENCENT_SDK_SECRET_KEY` | --      | Fallback for `key` when not passed to the constructor.                                                                        |
| `TENCENT_TRTC_SCENE`     | `auto`  | Room scene type. One of `auto`, `videocall`, `call`, or `record`. `auto` selects the first available from videocall and call. |
| `TENCENT_TEST_ROOM_ID`   | --      | Used by the plugin's `docker-compose.yml` as the example runner's `--call-id` flag.                                           |

## Frontend SDKs

Tencent provides client SDKs for joining the same RTC room from end-user applications. Your users connect with a Tencent frontend SDK while your Vision Agent runs server-side with this plugin — both in the same room.

See the [Tencent RTC documentation](https://sc-rp.tencentcloud.com:8106/r/wB) for Web, iOS, and Android client SDK guides.

## Next Steps

<CardGroup cols={2}>
  <Card title="Deploying Agents" icon="rocket" href="/guides/deploying-overview">
    Run your agent locally, containerize it, and scale to production.
  </Card>

  <Card title="Create Your Own Plugin" icon="plug" href="/integrations/create-your-own-plugin">
    Build a custom plugin to connect additional services.
  </Card>
</CardGroup>
