Skip to main content
This tutorial shows you how to connect your Databricks Delta table to TabPFN’s MCP server and run a churn prediction pipeline with an AI agent.

Prerequisites

  • Databricks workspace with a SQL warehouse running
  • Create a Delta table named customer_analytics
  • Get your Prior Labs API key
  • Install the required Python packages:

Overview

Here’s what happens end-to-end:
  1. Sample customer data is pulled from a Databricks Delta table using a SQL connector.
  2. The data is split into train/test sets and saved to disk locally.
  3. An agent - built with the OpenAI Agents SDK - takes over.
  4. You get a churn model evaluation summary printed to stdout.

Databricks Delta table

If you don’t have a customer_analytics table yet, you can create one from Databricks’ built-in TPC-DS sample data. Run this in a Databricks notebook or SQL editor:
query.sql

Example

The following code block contains all necessary code to run the OpenAI Agent with Databricks and the TabPFN MCP server.
example.py

Running the script

Set the required environment variables and run the script:
On success, the agent prints a churn model evaluation summary with ROC-AUC, accuracy, F1, precision, and recall for the churned class.