Python SDK for shout.run — programmatic terminal broadcasting
Project description
shout-run-sdk
Python SDK for shout.run — programmatic terminal broadcasting.
Let AI agents and scripts broadcast live terminal sessions that anyone can watch.
Install
pip install shout-run-sdk
Quick Start
from shout_sdk import ShoutSession
session = ShoutSession(api_key='shout_sk_...')
info = session.start(title='My Agent Session')
print(f"Live at: {info['url']}")
session.write('Hello, world!\r\n')
# ... do work ...
session.end()
Context Manager
from shout_sdk import ShoutSession
with ShoutSession(api_key='shout_sk_...') as session:
info = session.start(title='My Agent')
session.write('Working...\r\n')
# session.end() called automatically
Getting an API Key
- Log in to shout.run with GitHub
- Create an API key:
curl -X POST https://api.shout.run/api/keys \
-H "Authorization: Bearer <your-jwt>" \
-H "Content-Type: application/json" \
-d '{"name": "My Agent"}'
The response includes your key — save it securely, it's shown only once.
API Reference
ShoutSession(api_key, **kwargs)
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key |
str |
required | API key (starts with shout_sk_) |
title |
str |
'SDK Session' |
Session title shown to viewers |
visibility |
str |
'public' |
'public', 'followers', or 'private' |
cols |
int |
80 |
Terminal columns |
rows |
int |
24 |
Terminal rows |
api_url |
str |
'https://api.shout.run' |
API base URL |
Methods
start()— Creates the session and connects WebSocket. Returns{'session_id', 'url', 'ws_url'}.write(data)— Sends terminal output (strorbytes). Automatically buffered, rate-limited, and chunked.resize(cols, rows)— Updates terminal dimensions.end()— Flushes buffer, sends end frame, closes session.
Properties
state— Current state:SessionState.IDLE,.CONNECTING,.LIVE,.ENDING,.ENDEDviewers— Current viewer countsession_id— Session ID (Nonebefore start)
Events
session.on('connected', lambda: print('Connected!'))
session.on('disconnected', lambda code, reason: print(f'Disconnected: {code}'))
session.on('reconnecting', lambda attempt: print(f'Reconnecting #{attempt}'))
session.on('viewers', lambda count: print(f'Viewers: {count}'))
session.on('error', lambda err: print(f'Error: {err}'))
session.on('state_change', lambda state: print(f'State: {state}'))
Piping Subprocess Output
import subprocess
from shout_sdk import ShoutSession
session = ShoutSession(api_key='shout_sk_...')
info = session.start(title='Running tests')
proc = subprocess.Popen(
['pytest', '-v'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
for line in proc.stdout:
session.write(line)
proc.wait()
session.end()
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
shout_run_sdk-0.1.0.tar.gz
(7.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shout_run_sdk-0.1.0.tar.gz.
File metadata
- Download URL: shout_run_sdk-0.1.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5933880caa32252f77db307534a7051ac3a6f9a830b257517ded099f1d17cba
|
|
| MD5 |
5618e17c67bf2682fa1eeca08b04a6cd
|
|
| BLAKE2b-256 |
91e94051e26fce010e7c90b4476f38e274d2242a0629d9ce3b778f8a919ef261
|
File details
Details for the file shout_run_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: shout_run_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03bc9cc611dc19034d1872713a1b7ab02b8523a0aa636ca38a0186126a7ddb0f
|
|
| MD5 |
7aec333293ce6642b1e840be2c6d84a9
|
|
| BLAKE2b-256 |
6ba3824dfbf596fb29980b95ec5c96473c145ca37dfc09d6b47a6af4d5c42d0c
|