English | 简体中文
A minimal CLI example that connects to a Voice Agent server, prints live transcript events, and reads remote audio using the Python SDK with aiortc.
- Python 3.10+
- (Optional but recommended) a virtual environment
- A running Voice Agent server (see root README)
cd examples/python
# Create a virtual environment (recommended)
python -m venv .venv
source .venv/bin/activate # macOS/Linux
# .venv\Scripts\activate # Windows
# Install the SDK and dependencies
pip install -r requirements.txtpython main.pyThis will launch a local web server at http://127.0.0.1:7860.
It provides a rich graphical interface with a conversational chatbot view, using browser WebRTC for microphone and speaker access with native Acoustic Echo Cancellation.
python cli.py
# Or with a custom WHIP endpoint
WHIP_URL=http://your-server:8080/whip python cli.pyThis runs a lightweight script entirely within your terminal, identical in architecture to the Go and Rust examples. It prints transcripts directly to standard output as you speak.
| Variable | Default | Description |
|---|---|---|
WHIP_URL |
http://localhost:8080/whip |
WHIP signaling endpoint |
TOKEN_URL |
Token endpoint URL (e.g. http://localhost:8080/token). Required when the server has JWT auth enabled. |
|
API_KEY |
API key sent as Bearer header when fetching a token from TOKEN_URL. |
When the server has jwt_secret set, all /whip requests require a valid JWT:
TOKEN_URL=http://localhost:8080/token API_KEY=sk-streamcore-demo-key python cli.py- Connects to the Voice Agent server via WebRTC + WHIP signaling.
- Uses FastRTC behind the scenes to capture your local microphone through the browser securely.
- Uses FastRTC to stream the agent's remote audio track directly to your browser's WebRTC engine automatically.
- Benefits natively from the browser's built-in Acoustic Echo Cancellation (AEC) and hardware Noise Suppression.
- Displays connection status changes and live transcripts via a browser chatbot in
main.py(or prints them locally incli.py).
- Pass an aiortc
MediaStreamTracktoclient.connect(track)to send microphone audio - Access
client.remote_trackafter connection to process the agent's audio - Use
client.transcriptto access the full conversation history