> ## Documentation Index
> Fetch the complete documentation index at: https://docs.snowleopard.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Vercel

> Integrate Snow Leopard with Vercel AI SDK for live and accurate data retrieval.

This guide shows you how to add Snow Leopard data retrieval to a [Vercel](https://vercel.com/) [AI SDK](https://sdk.vercel.ai/) agent.

## Prerequisites

* Node.js v18+
* OpenAI API key (or another [supported model provider](https://sdk.vercel.ai/providers/ai-sdk-providers))
* [Snow Leopard Cloud API key](/cloud/getting-started#api-keys)
* A [Snow Leopard Cloud](/cloud/getting-started) instance with at least one [data source](/cloud/getting-started#adding-a-data-source) connected
* Your instance ID, from the instance's [Connection Info](/cloud/getting-started#connection-info) tab

<Note>
  Don't have data? Load the [sample Northwind dataset](https://github.com/SnowLeopard-AI/northwind_psql) into a PostgreSQL database that Snow Leopard Cloud can reach, such as a hosted [Neon](https://neon.com) or [Supabase](https://supabase.com) database. Run the dataset's `northwind.sql` script against your database, then [add the database as a data source](/cloud/getting-started#adding-a-data-source) in your instance.
</Note>

## Start from scratch

Clone and run the [complete working example](https://github.com/SnowLeopard-AI/snowy-examples/tree/main/quickstart/vercel-ai):

```bash theme={null}
git clone https://github.com/SnowLeopard-AI/snowy-examples.git
cd snowy-examples/quickstart/vercel-ai
```

Install dependencies:

```bash theme={null}
npm install
```

Set your environment variables:

```bash theme={null}
export OPENAI_API_KEY=your-openai-key
export SNOWLEOPARD_API_KEY=your-snowleopard-key
export SNOWLEOPARD_INSTANCE_ID=your-instance-id
```

Run the example:

```bash theme={null}
npm run snowy
```

You now have an interactive REPL where you can ask questions about your data.

## Bring your own agent

Already have a Vercel AI agent? Add Snow Leopard data retrieval with these steps.

### 1. Install dependencies

```bash theme={null}
npm install @snowleopard-ai/client
```

### 2. Create the Snow Leopard tool

Create a tool that calls Snow Leopard to retrieve data:

```javascript theme={null}
const { tool } = require('ai');
const { z } = require('zod');
const { SnowLeopardClient } = require('@snowleopard-ai/client');

const snowy = new SnowLeopardClient({ apiKey: '{your-snowleopard-api-key}' });

const getData = tool({
  description: 'Retrieve data from the database. ' +
               'Describe your data here - this becomes part of the tool description.',
  inputSchema: z.object({
    userQuestion: z.string().describe('the natural language query to answer'),
  }),
  execute: async ({ userQuestion }) => {
    return await snowy.retrieve({
      userQuery: userQuestion,
      instanceId: '{your-instance-id}'
    });
  }
});
```

### 3. Customize the tool description

The tool's description tells the agent when and how to use it. Update it to describe your specific data:

```javascript theme={null}
const getData = tool({
  description: 'Retrieve customer order data. ' +
               'Contains order history, products, and customer information. ' +
               'Use this to answer questions about sales, orders, and customers.',
  // ...
});
```

## Next steps

* View the [full example on GitHub](https://github.com/SnowLeopard-AI/snowy-examples/tree/main/quickstart/vercel-ai)
* See our full [API documentation](https://docs.snowleopard.ai/) to learn about the [Retrieve](/cloud/endpoints/retrieve) and [Response](/cloud/endpoints/response) endpoints
* Improve accuracy by giving Snow Leopard [feedback](/cloud/endpoints/feedback) about your business logic and terminology
* Explore [Recipes](/recipes) for production-ready agent examples


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.