Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

1 Commit

Repository files navigation

Trio Python SDK

PyPI versionLicense: Apache 2.0Python 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

fromtrioimportTrioclient=Trio("your_api_key")
# One-shot checkresult=client.check(
"https://youtube.com/watch?v=jfKfPfyJRdk",
"Is there an animated character visible?"
)
print(result["triggered"]) # Trueprint(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?")
ifresult["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 jobsjobs=client.list_jobs()
# Check job statusstatus=client.get_job("job_id")
# Cancel a jobclient.cancel_job("job_id")

API Reference

MethodDescription
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

Packages

Contributors

Languages