Skip to main content

Python SDK for shout.run — programmatic terminal broadcasting

Project description

shout.run

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

  1. Log in to shout.run with GitHub
  2. 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 (str or bytes). 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, .ENDED
  • viewers — Current viewer count
  • session_id — Session ID (None before 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.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shout_run_sdk-0.1.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file shout_run_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: shout_run_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for shout_run_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fa7c1f202a6eef1d2e6d70c77f7da53eded540fe8abeaaa6aa7051c534b0822c
MD5 cf44e9e4acc6668ad001e5716a037438
BLAKE2b-256 904ef7a6fb3b3c5456920b9e0dda238d0bcb821144b2d445e7848b5267a3564a

See more details on using hashes here.

File details

Details for the file shout_run_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: shout_run_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for shout_run_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1968291fbc4fbffb93c99f279747a80fdd65051608a2a5aab65719e1e49cd297
MD5 a6ed292d9a946cb21b393de6ad1d89f4
BLAKE2b-256 1dfe3b056f144592e71faf666bf7dcffcd12e70e292dffaa63ecf441a37066af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page