Skip to content

machinefi/trio-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trio Examples

Example code for the Trio API - turn any YouTube Live stream into a programmable data source with AI vision.

What is Trio?

Trio monitors live video streams using vision AI and sends webhook notifications when conditions are met. Use it for:

  • Weather monitoring (rain, snow, fog detection)
  • Traffic analysis (accidents, congestion)
  • Security alerts (person detection, motion)
  • Event monitoring (crowd size, activity changes)

Quick Start

1. Get Your API Key

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

2. One-Shot Check

Check a condition on a live stream right now:

import requests

response = requests.post(
    "https://trio.machinefi.com/api/check-once",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "stream_url": "https://www.youtube.com/watch?v=jfKfPfyJRdk",
        "condition": "Is there an animated character visible?"
    }
)

result = response.json()
print(f"Triggered: {result['triggered']}")
print(f"Explanation: {result['explanation']}")

3. Continuous Monitoring

Monitor a stream and get notified when something happens:

import requests

response = requests.post(
    "https://trio.machinefi.com/api/live-monitor",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "stream_url": "https://www.youtube.com/watch?v=jfKfPfyJRdk",
        "condition": "Is there a cat visible?",
        "webhook_url": "https://your-server.com/webhook"
    }
)

job = response.json()
print(f"Job started: {job['job_id']}")

Examples

Example Description
quickstart/check_once.py Single condition check
quickstart/live_monitor.py Continuous monitoring with webhooks
quickstart/live_digest.py Stream summarization
webhook-server/ FastAPI webhook receiver
mcp/ AI agent integration (Claude, GPT)

Installation

pip install requests

For the webhook server:

cd webhook-server
pip install -r requirements.txt

API Reference

Endpoint Method Description
/api/check-once POST Single synchronous check
/api/live-monitor POST Start continuous monitoring
/api/live-digest POST Generate stream summary
/api/jobs GET List all jobs
/api/jobs/{id} DELETE Cancel a job

Full documentation: docs.machinefi.com

License

Apache 2.0

Releases

No releases published

Packages

 
 
 

Contributors

Languages