π¬ Transform SQL research into polished video presentations automatically
While browsing LinkedIn, I came across a post from a YC funded company discussing their work on a deep researcher for BI analytics. Intrigued by the concept, I decided to explore it further. Having previously built both a calendar SQL agent and a deep researcher, I realized I could combine these two ideas into a single projectβand take it a step further by generating video presentations from the insights.
To test this agent-driven workflow, I needed a suitable dataset. After some searching, I discovered a dataset on GitHub, which contains a dump of Netflix data from their Engagement Report. This dataset serves as an excellent foundation for experimentation and development.
Deep SQL Researcher is an end-to-end pipeline that:
- Research: Uses LangGraph agents to analyze SQL databases and generate insights
- Narrative: Creates compelling story structures from data findings
- Design: Automatically designs video cards and layouts
- Render: Produces polished video presentations using Remotion
- π€ AI-Powered Research: LangGraph agents that understand your data goals
- π Structured Insights: Automatic extraction of trends, comparisons, and statistics
- π Narrative Generation: Compelling story structures for data presentation
- π¨ Dynamic Card Design: Multiple card variants (hero stats, rankings, comparisons, charts)
- π¬ Video Rendering: Professional-quality videos with animations and transitions
- π― Type-Safe Pipeline: Full TypeScript integration from database to video
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Research β β Narrative β β Video β
β Agent βββββΆβ Planning βββββΆβ Renderer β
β β β β β β
β β’ SQL Queries β β β’ Story Structureβ β β’ Card Design β
β β’ Insights β β β’ Scene Planning β β β’ Animations β
β β’ Data Analysis β β β’ Timeline Build β β β’ Video Output β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
packages/agent- LangGraph-based research agent with narrative generationpackages/shared- TypeScript types and schemas for the entire pipelineapps/renderer- Remotion-based video renderer with dynamic card components
# Clone the repository
git clone <repository-url>
cd deep-sql-research
# Install dependencies
bun install
# Build all packages
bun run build# Interactive mode (prompts for goal and database)
bun run packages/agent/src/index.ts
# Or use the complete pipeline
bun run generate-video# 1. Generate research insights and template
bun run packages/agent/src/index.ts > template.json
# 2. Render video from template
bun run apps/renderer/src/cli.ts template.json
# 3. Preview the video
cd apps/renderer && bun run dev- "Analyze Netflix content performance to understand what makes a show successful"
- "Compare viewer engagement between movies and TV series"
- "Identify trends in content release patterns and their impact on ratings"
deep-sql-research/
βββ packages/
β βββ agent/ # LangGraph research agent
β β βββ src/
β β β βββ agent/ # Graph definitions and state
β β β βββ nodes/ # Individual processing nodes
β β β βββ helpers/ # Database, LLM, and utilities
β β β βββ fixtures/ # Test research scenarios
β β β βββ tests/ # Template generation tests
β β βββ netflixdb.sqlite # Sample Netflix dataset
β βββ shared/ # Shared types and schemas
β βββ src/
β βββ types.ts # Core data structures
β βββ schemas.ts # Zod validation schemas
β βββ constants.ts # Node and type constants
βββ apps/
β βββ renderer/ # Remotion video renderer
β βββ src/
β β βββ components/ # Dynamic card components
β β βββ animations/ # Motion presets and transitions
β β βββ themes/ # Visual theming system
β β βββ cli.ts # Video rendering CLI
β β βββ VideoRoot.tsx # Main Remotion composition
βββ package.json # Workspace configuration
# Development
bun run dev # Start development servers
bun run build # Build all packages
bun run type-check # Type checking across workspace
# Agent Development
bun run studio # LangGraph studio for agent debugging
bun run test # Run agent tests with snapshots
# Video Rendering
cd apps/renderer
bun run dev # Preview server
bun run build # Render video
bun run render <template.json> # CLI video rendering# Run all tests
bun run test
# Run specific test suites
cd packages/agent && bun test src/tests/template-generation.test.tsThe renderer supports multiple card variants:
hero_stat- Large, prominent statisticsranked_list- Ordered rankings with highlightscomparison_split- Side-by-side comparisonstrend_chart- Time-based trend visualizationsdistribution_chart- Statistical distributionskey_highlight- Important insight callouts
- Cinematic slide-up - Dramatic entrance animations
- Scale pop - Bouncy, attention-grabbing effects
- Fade in - Smooth transitions
- Slide variants - Directional movement effects
- Copy
.env.exampleto.env - Configure your LLM provider (OpenAI, Anthropic, etc.)
- Set up database connections
Replace netflixdb.sqlite with your own SQLite database:
# Place your database in packages/agent/
cp your-database.sqlite packages/agent/- Input: Research goal and database path
- Research: Agent generates SQL queries and extracts insights
- Synthesis: Insights are structured into narrative outline
- Planning: Scenes are planned with layout presets
- Design: Cards are designed with variants and styling
- Timeline: Complete video timeline is constructed
- Template: Final JSON template is assembled
- Render: Video is generated from template
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run
bun run type-checkandbun run test - Submit a pull request
MIT License - see LICENSE file for details
- Netflix Dataset for the sample data
- LangGraph for the agent framework
- Remotion for video generation
- Bun for the fast JavaScript runtime