Skip to main content

View Golf Coach Example on GitHub

Check out the complete AI Golf Coach example in our GitHub repository
Build a real-time golf coach that watches your swing via camera and gives spoken feedback. It combines Ultralytics YOLO pose detection to analyze body position with Gemini Live for real-time coaching — all running on Stream’s low-latency edge network. This pattern applies to any video coaching use case: sports training, physical therapy, workout guidance, or drone monitoring.
Complete the Quickstart first. This example adds a video processor on top of a Realtime LLM.

What You Will Build

  • Analyze golf swings in real time using YOLO pose detection
  • Process video at configurable FPS with Gemini Live or OpenAI Realtime
  • Deliver spoken coaching feedback based on body position and movement
  • Hot-swap between AI providers with a one-line config change

Prerequisites

If using OpenAI instead of Gemini, also add OPENAI_API_KEY.

Run the example

Clone and install

Clone the repo and install dependencies from the root:

Configure environment

Create a .env file at the repo root with your Stream and Gemini API keys.

Run the agent

From the example directory:
The CLI opens a browser demo with your camera. Position yourself so the camera can see your full body, then perform a golf swing. The agent analyzes your form and gives spoken feedback.

How it works

The agent combines a Realtime LLM with a YOLO pose processor:
  1. Video capture — the user’s camera feeds video to the agent
  2. Pose detection — YOLO analyzes each frame and extracts body position data
  3. LLM processing — Gemini Realtime receives video frames at 3 FPS
  4. Feedback — the agent speaks coaching guidance based on golf_coach.md instructions
The fps=3 parameter controls how many frames per second are sent to the model. Higher FPS gives more detail but uses more tokens.

Customize

  • Change FPS: gemini.Realtime(fps=5) for lower cost, fps=10 for more detail
  • Switch to OpenAI: replace with openai.Realtime(fps=3) in agent.py
  • Edit coaching style: modify golf_coach.md in the example directory
  • Different YOLO models: use YOLOProcessor for object detection instead of pose estimation

Next Steps

Video Agents

VLMs, processors, and realtime video patterns

Video Processors

Build custom detection and analysis pipelines

Live Sports Commentator

Use Roboflow object detection for multi-object tracking

Ultralytics Integration

Explore YOLO model options and configuration