View Golf Coach Example on GitHub
Check out the complete AI Golf Coach example in our GitHub repository
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
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:- Video capture — the user’s camera feeds video to the agent
- Pose detection — YOLO analyzes each frame and extracts body position data
- LLM processing — Gemini Realtime receives video frames at 3 FPS
- Feedback — the agent speaks coaching guidance based on
golf_coach.mdinstructions
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=10for more detail - Switch to OpenAI: replace with
openai.Realtime(fps=3)inagent.py - Edit coaching style: modify
golf_coach.mdin the example directory - Different YOLO models: use
YOLOProcessorfor 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