Skip to content

Build from Source

Building from source is ideal for scenarios where you need to develop and debug on the Server side.

  • Go 1.27+
  • PostgreSQL 17+ (with pgvector extension) — recommend using the pgvector/pgvector:pg17 image
  • Redis 7+
  • LLM API — Claude or OpenAI-compatible interface
终端窗口
git clone https://github.com/rtc-agent/server.git
cd server

Use the development Docker Compose to start PostgreSQL, Redis, etc.:

终端窗口
# Start dev dependencies (PostgreSQL:15432, Redis:16379, Jaeger, Mock OAuth2, etc.)
go run main.go dev dependencies start

Or start Docker manually:

终端窗口
docker compose -f etc/dev/docker-compose.yml up -d

Copy the config template and edit:

终端窗口
cp etc/config.example.yaml etc/config.local.yaml

Edit etc/config.local.yaml, modifying at least the following fields:

database:
dsn: "postgres://rtc_agent:rtc_agent@localhost:15432/rtc_agent?sslmode=disable"
redis:
addr: "localhost:16379"
llm:
provider: "claude" # or "openai"
api_key: "${LLM_API_KEY}" # Injected via env var — set LLM_API_KEY before starting
model: "claude-sonnet-4-20250514"

Config merging: On startup, the Server automatically loads etc/config.yaml (baseline) + etc/config.local.yaml (overrides). config.local.yaml is already in .gitignore and will not be committed. Only write the diff items.

🔐 API Key security: api_key supports ${ENV_VAR} syntax to reference environment variables, avoiding plaintext keys in config files. Set export LLM_API_KEY="your-key" before starting.

终端窗口
# Build
go build -o bin/rtc-agent .
# Database migration (first deployment)
./bin/rtc-agent migrate
# Start the service
./bin/rtc-agent serve

The service starts at http://localhost:8888.

终端窗口
curl http://localhost:8888/healthz
# {"status":"ok"}

After the Server is running, add the <rtc-agent> component to your web page:

<script type="module" src="https://cdn.example.com/rtc-agent/index.js"></script>
<rtc-agent></rtc-agent>

See Web Component API for details.