New Project

An AI data analyst agent that explores a semantic layer in a sandbox environment to answer natural language questions with SQL.
OSS Data Analyst uses a sandboxed exploration approach: instead of hardcoding schema knowledge into prompts, the agent is given shell access to a sandbox containing your semantic layer files. It discovers the schema dynamically using cat, grep, and ls commands, then builds and executes SQL queries based on what it finds.
This architecture means the agent can:
User Questionβββββββββββββββββββββββββββββββββββββββββ Vercel Sandbox ββ βββββββββββββββββββββββββββββββ ββ β semantic/ β ββ β βββ catalog.yml β ββ β βββ entities/ β ββ β βββ companies.yml β ββ β βββ people.yml β ββ β βββ accounts.yml β ββ βββββββββββββββββββββββββββββββ ββ ββ Agent explores with: ββ β’ cat semantic/catalog.yml ββ β’ grep -r "keyword" semantic/ ββ β’ cat semantic/entities/*.yml βββββββββββββββββββββββββββββββββββββββββSQL Query β Database β Results β Narrative
git clone https://github.com/vercel-labs/oss-data-analyst.gitcd oss-data-analystpnpm install
cp env.local.example .env.local
Add your Vercel AI Gateway key to .env.local.
pnpm initDatabase
Creates a SQLite database with sample data (Companies, People, Accounts).
pnpm dev
The semantic layer lives in src/semantic/ and defines your data model:
src/semantic/βββ catalog.yml # Entity index with descriptionsβββ entities/βββ companies.yml # Company entity definitionβββ people.yml # People entity definitionβββ accounts.yml # Accounts entity definition
Each entity YAML includes:
sql_table_name - The underlying tablefields - Available columns with SQL expressionsjoins - Relationships to other entitiesThe agent reads these files at runtime to understand your schema.
Stack: Next.js, Vercel AI SDK, Vercel Sandbox, SQLite
Key Files:
src/lib/agent.ts - Agent definition and system promptsrc/lib/tools/sandbox.ts - Sandbox creation with semantic filessrc/lib/tools/shell.ts - Shell command tool for explorationsrc/lib/tools/execute-sqlite.ts - SQL execution toolsrc/semantic/entities/src/semantic/catalog.yml with the new entityNo code changes requiredβthe sandbox approach means schema changes are picked up at runtime.
Database Not Found
pnpm initDatabase
Build Errors
pnpm type-check