Skip to main content
An application that lets users chat with their data through a web UI. Built with CopilotKit for the frontend and Pydantic AI for the backend agent.

Try the live demo

Chat with your data agent screenshot

What it does

This agent provides a chat interface for querying your data in natural language. Users can:
  • Ask questions about their data in plain English
  • View query results in a formatted table
  • Have multi-turn conversations to drill down into the data
The agent translates natural language questions into SQL queries via Snow Leopard, executes them, and presents results in a user-friendly format.

Architecture

The application has two main components:

Frontend (Next.js + CopilotKit)

  • Next.js provides the web application framework
  • CopilotKit provides the chat UI components and handles communication with the backend agent
  • Data tables display query results returned from the agent

Backend (Pydantic AI + Snow Leopard)

  • Pydantic AI agent with two tools:
    • get_data: Calls Snow Leopard to convert natural language to SQL and retrieve results
    • read_get_data_response: Allows paginated reading of large result sets
  • AG-UI state management keeps the frontend in sync with query results
  • Snow Leopard handles natural language to SQL conversion

Run the example

Prerequisites

Don’t have data? This example uses northwind.db, a public sales database. You can download it from our sample datasets using this link.

Setup

Clone the repository:
git clone https://github.com/SnowLeopard-AI/snowy-examples.git
cd snowy-examples/agent_examples/copilotkit-chat-with-your-data
Install dependencies:
pnpm install
Create a .env file in the agent folder:
OPENAI_API_KEY=your-openai-key
SNOWLEOPARD_API_KEY=your-snowleopard-key
SNOWLEOPARD_DATAFILE_ID=your-datafile-id
Start the development server:
pnpm dev
This starts both the UI and agent servers. Open http://localhost:3000 to start chatting with your data.

Next steps