CLI
OpenRTC ships a console script namedopenrtc (Typer + Rich) for discovery-based
workflows. The Typer application and main() live in openrtc.cli.commands (with
helpers in openrtc.cli.livekit, openrtc.cli.dashboard, openrtc.cli.reporter,
openrtc.cli.types, and openrtc.cli.params). The lazy entrypoint and missing-extra
hints are in openrtc.cli (the package __init__ plus openrtc.cli.entry).
The programmatic entry is typer.main.get_command(app).main(...) (Click’s
Command.main), not the test-only CliRunner.
Installation
The library (AgentPool, discovery, routing) installs with:
cli:
openrtc.cli:main exits with 1 and prints
an install hint.
Typical usage
-
Set the same variables as a standard LiveKit worker:
-
Run a worker subcommand with an agents directory (plus any provider defaults
your agents need). You can pass
--agents-diror use the first positional argument onstart/dev/console. A second positional is optional and only sets--metrics-jsonlwhen you want JSONL metrics; skip it if you only need the agents directory (unless you already passed--metrics-jsonl).
--dashboard,
and no metrics files unless you pass --metrics-json-file or
--metrics-jsonl. Refresh intervals default to 1 second where applicable.
Subcommands mirror the LiveKit Agents CLI (python agent.py dev, start,
console, connect, download-files). OpenRTC adds --agents-dir for
discovery, then delegates to livekit.agents.cli.run_app. OpenRTC-only flags are
stripped from sys.argv before that handoff so LiveKit does not see options
like --agents-dir.
Connection overrides
You can overrideLIVEKIT_* per invocation:
--url--api-key--api-secret--log-level(alsoLIVEKIT_LOG_LEVEL)
--help depending on the
flag.
Commands
Across list, connect, download-files, and start / dev / console, you can often pass paths positionally instead of--agents-dir or --metrics-jsonl (see each command below). The
first non-flag token after the subcommand is rewritten before parsing; use
--agents-dir when you need a different argument order.
openrtc list
Discovers agent modules and prints each agent’s resolved settings.
- Default: Rich table (human-friendly).
--plain— Stable, line-oriented text (no ANSI/table borders); good for grep and CI.--json— Stable JSON. Top-level fields includeschema_version(bump when the shape changes) andcommand: "list". Combine with--resourcesforresource_summary.--plainand--jsontogether are rejected (non-zero exit).--resources— Footprint and memory hints (grouped under Advanced in--help).
openrtc start / openrtc dev / openrtc console
Worker subcommands. start is production-style; dev adds reload;
console is a local-only sandbox. All three accept the same option
shape (see --help per command for the full list).
Coroutine-mode runtime knobs (v0.1)
Two flags pick the worker isolation mode and the coroutine-mode backpressure threshold. They show up under the OpenRTC panel in--help and are accepted by start, dev, and console.
--isolation—coroutine(default) orprocess.coroutineruns every session as anasyncio.Taskinside one worker process and shares the prewarmed VAD / turn detector across sessions. Use this when density is the goal.processkeeps the v0.0.x behavior of one OS subprocess per session vialivekit-agents’s defaultProcPool. Use this when you need hard process isolation between sessions or per-session memory caps vialivekit-agents’job_memory_limit_mb.
--max-concurrent-sessions— Integer ≥ 1, default50. The coroutine pool reportsload >= 1.0to LiveKit dispatch once this many sessions are in flight, so the dispatcher routes new jobs elsewhere. Ignored under--isolation process(livekit-agents’ own load math applies there).
docs/concepts/architecture.md for the coroutine-mode lifecycle
and the README’s “Isolation modes” section for a side-by-side
comparison table.
openrtc connect
Connect the worker to an existing room (LiveKit connect). Requires
--room.
openrtc download-files
Download plugin assets (LiveKit download-files). Only needs the agents
directory (for a valid worker entrypoint) plus connection settings—no
--default-stt / --default-llm / --default-tts / --default-greeting.
Runtime visibility and automation
--dashboard— Live Rich summary (RSS, sessions, routing, savings estimate). Off by default.--metrics-json-file PATH— Overwrites a JSON file each tick with the latestPoolRuntimeSnapshot(good for scripts). Grouped under Advanced.--metrics-jsonl PATH— Appends versioned JSON Lines (truncates when the worker starts). Each line is one record:schema_version,kind(snapshotorevent),seq,wall_time_unix,payload. Snapshots matchPoolRuntimeSnapshot.to_dict(); events carry session lifecycle hints (session_started,session_finished,session_failed). Tail it withtail -f ./openrtc-metrics.jsonl, pipe it throughjq, or point any log shipper or script at it.--dashboard-refresh— Interval in seconds for dashboard, metrics file, and JSONL when--metrics-jsonl-intervalis not set (Advanced).--metrics-jsonl-interval— Override JSONL cadence only (Advanced).
Shared default options (discovery)
Worker commands that load agents accept optional defaults applied when a discovered agent does not override them via@agent_config(...):
--default-stt--default-llm--default-tts--default-greeting(Advanced)
livekit-agents as raw strings. For
provider-native plugin objects, configure them in Python with AgentPool
instead of through the CLI flags.
list --resources (footprint)
With --resources, list adds:
- Per-agent on-disk size of the discovered
.pymodule when the path is known (seeAgentConfig.source_pathin the API docs). - Summary — total source bytes and a best-effort process memory metric
from
openrtc.observability.metrics(Linux: current VmRSS; macOS: peakru_maxrss, not live RSS—seeresident_set.descriptionin--jsonoutput). - Savings estimate — a transparent estimate of the memory saved by one shared worker versus one worker per registered agent.
Notes
--agents-diris required for every command.listreturns a non-zero exit code when no discoverable agents are found.- Worker commands discover agents before handing off to the LiveKit CLI.
- The live dashboard,
--metrics-json-file, and--metrics-jsonlreflect the running shared worker, unlikelist --resources, which reflects the short-lived CLI discovery process.
Prove the shared-worker value locally
-
Discover your agents:
-
Start one shared worker with the dashboard and/or metrics output:
Or enable a streaming JSON Lines feed:
-
Watch the dashboard (or tail the JSONL file with
tail -f ./openrtc-metrics.jsonl, optionally piped throughjq) for worker RSS, active sessions, routing, and errors. -
Use
runtime.jsonor the JSONL stream for automation or scraping.
