Skip to content

machinefi/trio-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trio Python SDK

PyPI version License: Apache 2.0 Python 3.8+

Turn any YouTube Live stream into an AI-powered data source. Monitor live video for conditions, get real-time alerts, and generate stream summaries.

Installation

pip install trio-python

Or install from source:

pip install git+https://github.com/machinefi/trio-python.git

Quick Start

from trio import Trio

client = Trio("your_api_key")

# One-shot check
result = client.check(
    "https://youtube.com/watch?v=jfKfPfyJRdk",
    "Is there an animated character visible?"
)
print(result["triggered"])  # True
print(result["explanation"])  # "Yes, there is an animated girl..."

Features

Check Once

Instant condition check on a live stream:

result = client.check(stream_url, "Is it raining?")
if result["triggered"]:
    print(f"Rain detected: {result['explanation']}")

Live Monitor

Continuous monitoring with webhook alerts:

job = client.monitor(
    stream_url="https://youtube.com/watch?v=LIVE_ID",
    condition="Is there a person in frame?",
    webhook_url="https://your-server.com/webhook",
    interval_seconds=10
)
print(f"Monitoring: {job['job_id']}")

Stream Digest

Generate AI summaries of stream activity:

job = client.digest(
    stream_url="https://youtube.com/watch?v=LIVE_ID",
    webhook_url="https://your-server.com/summary",
    window_minutes=5
)

Job Management

# List all jobs
jobs = client.list_jobs()

# Check job status
status = client.get_job("job_id")

# Cancel a job
client.cancel_job("job_id")

API Reference

Method Description
check(stream_url, condition) One-shot condition check
monitor(stream_url, condition, webhook_url) Start continuous monitoring
digest(stream_url, webhook_url) Start stream summarization
list_jobs() List all jobs
get_job(job_id) Get job status
cancel_job(job_id) Cancel a job

Get Your API Key

Sign up at console.machinefi.com to get your API key.

Documentation

Full documentation: docs.machinefi.com

License

Apache 2.0

Releases

No releases published

Packages

 
 
 

Contributors

Languages