Skip to main content

Docker container setup

This guide shows you how to develop TEN Agent using VSCode inside a Docker container.

Understand the tech

Using VSCode inside a Docker container provides the following advantages:

  • Full access to all environment dependencies and build tools
  • Direct integration with container-specific headers and libraries
  • Automatic path resolution for all project configurations
  • Consistent development environment across all team members
  • Isolated workspace that matches production settings

VSCode's Docker and Dev Containers extensions enable seamless development by running your editor inside the container environment, ensuring complete access to all dependencies and build tools.

Prerequisites

Install the following VSCode extensions:

Container setup

Start the development container

  1. Navigate to your TEN Agent project directory

  2. Start containers in detached mode:


    _1
    docker compose up -d

  3. Open VSCode and switch to the Docker extension tab

  4. Verify the ten_agent_dev container is running

    Docker Containers

Connect VSCode to the container

  1. In the Docker extension, locate ten_agent_dev

  2. Right-click and select Attach Visual Studio Code to connect to the container

  3. A new VSCode window opens, connected to the container

    The container environment starts fresh without your local VSCode extensions or settings.

  4. Install required extensions inside the container:

    1. Click Extensions in the left sidebar
    2. Search for extensions you need to develop in Python, Go, or C++
    3. Configure any additional settings
    4. Click Install in Container for each extension and follow any additional prompts to complete installation
    5. Configure extension settings as needed for your project

Debugging

Configure debugging

Set breakpoints to debug your code:

  1. Click the left margin next to any line number

  2. A red dot appears, indicating an active breakpoint

    Setting Breakpoint

    info

    If your breakpoints don't work, install the appropriate language extension (Python, Go, or C++) in the container environment.

Start debugging:

  1. Open the Run and Debug panel in the sidebar

  2. Select your debug configuration such as debug python

  3. Click the green play button to start

    Debug Configuration

Configuration notes

When debugging, VSCode starts the agent directly without the Go web server. This affects:

  • Graph selection - must be configured manually
  • RTC token generation - requires manual setup

This section guides you through resolving these issues.

Graph selection

Without the web server, you must manually configure the graph to run:

  1. Open property.json
  2. Set auto_start: true for your desired graph
  3. Ensure only one graph has auto_start enabled

RTC properties

The web server normally generates RTC tokens automatically. In development mode:

  1. Run the playground or demo first to generate tokens

  2. Check logs for the temporary property file location:


    _1
    PropertyJsonFile:/tmp/astra/property-agora_74np6e-20241123_083855_000.json

  3. Copy RTC tokens and channel names from the temporary file

  4. Update your main property.json with these values