Tutorial · Step-by-step
Intermediate
30–45 min

Build an AI Agent with Business Data

Connect customer, subscription, invoice, and usage data to a customer success agent — then build it in Cursor, Claude, ChatGPT, or Mistral.

CSV Export

business-data/
  • customers.csv
  • subscriptions.csv
  • invoices.csv
  • usage.csv

API Generated

GET/v1/apis/customers
GET/v1/apis/invoices

+ subscriptions, usage, support-tickets

Agent

Customer Success Agent

Answers business questions by calling live REST endpoints—not static files.

Why this matters

  • AI agents need real data — not hallucinated answers
  • Business knowledge already exists in spreadsheets
  • APIs make data accessible to AI systems

Step 1

See the End Result

Show the finished customer success agent. The agent can answer business questions by calling live API Butler endpoints — not by guessing from static files.

  • Which customers are on the Pro plan?
  • Which invoices are overdue?
  • Which accounts have been inactive for 30 days?
  • Which customers generated the most revenue?
Customer Success Agent
Which customers are on the Pro plan?
Found 12 Pro customers. Acme Corp and Northwind Labs are the highest revenue accounts.
Which invoices are overdue?
Ask about customers, invoices, subscriptions…
Customer Lookup
GET /v1/apis/customers
Subscription Panel
GET /v1/apis/subscriptions
Invoice Panel
GET /v1/apis/invoices
Usage Panel
GET /v1/apis/usage
  • GET /v1/apis/customersCustomer Lookup
  • GET /v1/apis/subscriptionsSubscription Insights
  • GET /v1/apis/invoicesRevenue Overview
  • GET /v1/apis/usageActivity Analysis
  • GET /v1/apis/support-ticketsSupport Context

Step 2

Design Your Datasets

Create realistic business datasets. Use shared IDs — customers.csv is the hub. Every other file joins through customer_id.

customers.csv

Central customer table — subscriptions, invoices, support tickets, and usage all join through customer_id.

subscriptions.csv joins via customer_id
invoices.csv joins via customer_id
support_tickets.csv joins via customer_id
usage.csv joins via customer_id

customers.csv

Core customer records — the hub table every other dataset joins to.

idcompany_namecontact_nameemailplancreated_at
csv
      id,company_name,contact_name,email,plan,created_at
1,Acme Corp,Sarah Chen,[email protected],pro,2024-01-10
2,Northwind Labs,James Park,[email protected],enterprise,2024-02-14
3,Blue Ridge Co,Emily Walsh,[email protected],starter,2024-03-22
4,Vertex Systems,Marcus Lee,[email protected],pro,2024-04-05
5,Coastal Analytics,Anna Rivera,[email protected],pro,2024-05-18
    

subscriptions.csv

Active and cancelled subscriptions linked to customers.

idcustomer_idplanstatusrenewal_date
csv
      id,customer_id,plan,status,renewal_date
1,1,pro,active,2026-07-01
2,2,enterprise,active,2026-12-15
3,3,starter,cancelled,2025-11-30
4,4,pro,active,2026-08-20
5,5,pro,past_due,2026-06-01
    

invoices.csv

Billing records with payment status and due dates.

idcustomer_idamountstatusdue_date
csv
      id,customer_id,amount,status,due_date
1,1,2499.00,paid,2026-05-01
2,2,8900.00,paid,2026-05-15
3,3,299.00,overdue,2026-04-01
4,4,2499.00,overdue,2026-05-10
5,5,2499.00,paid,2026-05-20
6,1,2499.00,paid,2026-04-01
    

support_tickets.csv

Customer support context for agent responses.

idcustomer_idprioritystatuscreated_at
csv
      id,customer_id,priority,status,created_at
1,1,high,open,2026-06-01T09:00:00Z
2,2,medium,resolved,2026-05-28T14:30:00Z
3,4,high,open,2026-06-03T11:15:00Z
4,5,low,open,2026-06-05T16:45:00Z
5,3,medium,closed,2026-05-15T10:00:00Z
    

usage.csv

Product usage metrics for activity and engagement analysis.

idcustomer_idactive_usersapi_requestslast_activity
csv
      id,customer_id,active_users,api_requests,last_activity
1,1,42,185000,2026-06-10
2,2,128,920000,2026-06-11
3,3,3,1200,2026-03-15
4,4,18,45000,2026-06-08
5,5,25,67000,2026-05-02
    

Step 3

Publish Your APIs

Upload datasets to API Butler and publish endpoints. Each CSV becomes a hosted GET endpoint with pagination and filtering.

  1. Export

    CSV Export

    Export each business dataset from your spreadsheet tool.

  2. 2
    Upload Current

    Upload to API Butler

    One upload per resource — customers, subscriptions, invoices, support tickets, usage.

  3. 3
    Generate

    API Generated

    Each CSV becomes a hosted GET endpoint with filtering and pagination.

  4. 4
    Connect

    Endpoints Available

    Copy URLs and wire them into your agent or AI coding tool.

CSV Export

business-data/
  • customers.csv
  • subscriptions.csv
  • invoices.csv
  • usage.csv

API Generated

GET/v1/apis/customers
GET/v1/apis/invoices

+ subscriptions, usage, support-tickets

Agent

Customer Success Agent

Answers business questions by calling live REST endpoints—not static files.

GET/v1/apis/customers

Customer records with plan filtering

GET/v1/apis/subscriptions

Subscription status and renewal dates

GET/v1/apis/invoices

Invoice amounts, status, and due dates

GET/v1/apis/support-tickets

Open tickets by priority and status

GET/v1/apis/usage

Active users, API requests, last activity

bash
      # List customers with pagination
curl "https://api.getapibutler.com/v1/apis/customers?limit=25"

# Filter by plan
curl "https://api.getapibutler.com/v1/apis/customers?filter[plan]=pro"

# Find overdue invoices
curl "https://api.getapibutler.com/v1/apis/invoices?filter[status]=overdue"

# Check inactive accounts (usage last activity)
curl "https://api.getapibutler.com/v1/apis/usage?limit=25"
    

Sample response — GET /customers?filter[plan]=pro

json
      {
  "data": [
    {
      "id": 1,
      "company_name": "Acme Corp",
      "contact_name": "Sarah Chen",
      "email": "[email protected]",
      "plan": "pro",
      "created_at": "2024-01-10"
    },
    {
      "id": 4,
      "company_name": "Vertex Systems",
      "contact_name": "Marcus Lee",
      "email": "[email protected]",
      "plan": "pro",
      "created_at": "2024-04-05"
    }
  ],
  "meta": {
    "limit": 25,
    "offset": 0,
    "count": 2,
    "total": 12
  }
}
    

Step 4

Map APIs to Your Agent

Explain which API powers which part of the UI. Readers should immediately understand API → UI relationships — so the agent knows where to fetch data for each question type.

Customer Success Agent
Which customers are on the Pro plan?
Found 12 Pro customers. Acme Corp and Northwind Labs are the highest revenue accounts.
Which invoices are overdue?
Ask about customers, invoices, subscriptions…
Customer Lookup
GET /v1/apis/customers
Subscription Panel
GET /v1/apis/subscriptions
Invoice Panel
GET /v1/apis/invoices
Usage Panel
GET /v1/apis/usage
  • GET /v1/apis/customersCustomer Lookup
  • GET /v1/apis/subscriptionsSubscription Insights
  • GET /v1/apis/invoicesRevenue Overview
  • GET /v1/apis/usageActivity Analysis
  • GET /v1/apis/support-ticketsSupport Context

Step 5

Wire Up Frontend & AI

API Butler publishes the data layer — it does not host your agent. You choose where the agent runs, then connect it to the same GET endpoints from Steps 3 and 4.

Where to build your agent

Every platform below uses the same pattern: your agent calls API Butler over HTTPS, receives structured JSON, and answers business questions from live data.

Cursor & Claude Code

Recommended for this tutorial

Where

In your IDE and codebase

How

Paste API Butler URLs into the prompts below. The AI generates a customer success dashboard with chat UI, typed hooks, and live API calls.

Cursor integration →

Claude (Anthropic)

Where

Claude.ai, Claude API, or Claude Code

How

Register API Butler endpoints as tools. When a user asks about Pro customers or overdue invoices, Claude calls GET /v1/apis/customers or /invoices and answers from structured JSON.

Claude Code integration →

ChatGPT (OpenAI)

Where

Custom GPTs or Assistants API

How

Add API Butler URLs as Actions or function tools. The GPT fetches customer, invoice, and subscription data over HTTPS before responding—no spreadsheet uploads per question.

AI agent prompts →

Mistral

Where

Le Chat, Agents API, or your own app

How

Wire API Butler GET endpoints into Mistral agent workflows. Use the same JSON responses for customer lookup, billing checks, and usage analysis.

Mistral integration →

Tool definition for Claude, ChatGPT, or Mistral agents

json
      // Example tool definition (Claude, ChatGPT, Mistral agents)
{
  "name": "lookup_customers",
  "description": "Find customers by plan, company name, or email",
  "parameters": {
    "type": "object",
    "properties": {
      "plan": {
        "type": "string",
        "description": "Filter by plan: starter, pro, enterprise"
      }
    }
  }
}

// Tool execution → call your API Butler endpoint:
// GET https://api.getapibutler.com/v1/apis/customers?filter[plan]=pro&limit=25
// Response: { "data": [...], "meta": { "total": 12 } }
    

Build the dashboard in your IDE

For a full customer success agent with chat UI and panels, use Cursor or Claude Code. Paste your endpoint URLs into the prompts below.

User Question

"Which customers are on the Pro plan?"

Agent

Interprets intent and selects the customers API with filter[plan]=pro

API Call

GET /v1/apis/customers?filter[plan]=pro&limit=25

Response

{ "data": [{ "company_name": "Acme Corp", "plan": "pro" }], "meta": { "total": 12 } }

Answer

12 Pro customers found. Acme Corp and Northwind Labs lead by revenue.

Prompt for Cursor

prompt
      Build an AI customer success dashboard that consumes these API Butler REST endpoints.

Endpoints (paste your URLs):
- Customers: [PASTE_CUSTOMERS_ENDPOINT]
- Subscriptions: [PASTE_SUBSCRIPTIONS_ENDPOINT]
- Invoices: [PASTE_INVOICES_ENDPOINT]
- Support Tickets: [PASTE_SUPPORT_TICKETS_ENDPOINT]
- Usage: [PASTE_USAGE_ENDPOINT]

Each endpoint returns { data: [], meta: { limit, offset, count, total } }.

Requirements:
1. AI customer success dashboard with overview metrics — Pro customers, overdue invoices, inactive accounts, top revenue
2. Chat interface — user asks business questions, agent calls the right API and returns structured answers
3. Customer search — lookup by company name or email with pagination
4. Invoice lookup — filter by status (paid, overdue) and sort by amount
5. Subscription lookup — show plan, status, and renewal date per customer
6. Usage analytics — active users, API requests, last activity with inactive account highlighting
7. Reusable API hooks/composables with loading, empty, and error states for each endpoint
8. Responsive layout — chat and panels stack on mobile
9. Reuse existing project conventions; do not add new state libraries unless already present
10. Never hardcode mock rows once endpoints are provided
    

Prompt for Claude Code

prompt
      Generate a customer success agent dashboard from these API Butler GET endpoints.

Endpoints (paste your URLs):
- Customers: [PASTE_CUSTOMERS_ENDPOINT]
- Subscriptions: [PASTE_SUBSCRIPTIONS_ENDPOINT]
- Invoices: [PASTE_INVOICES_ENDPOINT]
- Support Tickets: [PASTE_SUPPORT_TICKETS_ENDPOINT]
- Usage: [PASTE_USAGE_ENDPOINT]

Phase 1 — Do not write code yet.
Ask me exactly 2–3 focused questions:
- Framework and routing conventions (React, Vue, file structure)
- Which customer fields matter for search, filtering, and agent responses
- How the chat interface should call APIs (direct fetch vs. tool-calling pattern)

Stop and wait for my answers.

Phase 2 — After I answer:
- Generate TypeScript types from API response shapes
- Create a typed API client with reusable fetch utilities for all five endpoints
- Build hooks/composables with loading, error, and empty states
- Implement customer search, invoice lookup, subscription lookup, and usage analytics
- Build the agent chat UI with customer insights panel
- Responsive dashboard shell with navigation
- Keep API keys in env only—never commit secrets
- Do not use placeholder JSON once real endpoints are provided
    

Step 6

Compare & Ship

API Butler gives you real business data with production-like APIs — not fake placeholder JSON that every developer shares.

JSONPlaceholder

  • Fake generic data
  • Unrealistic business structures
  • No customer–invoice–subscription relationships
  • Same placeholder for every developer

API Butler

  • Real business data from your CSVs
  • Realistic customer success workflows
  • Production-like APIs with filtering and pagination
  • Domain-specific schemas agents can query

Next Steps

FAQ

AI agent tutorial questions

Where do I build the AI agent?

API Butler provides the data layer — not the agent itself. Build in Cursor or Claude Code for a full dashboard with chat UI (recommended in Step 5). Use Claude API, ChatGPT Custom GPTs/Actions, or Mistral Agents with the same API Butler endpoints registered as tools. All platforms call your GET URLs over HTTPS and answer from structured JSON.

How does an AI agent access API Butler APIs?

Agents call the same REST endpoints your frontend uses. Upload CSV files to API Butler, copy the GET URLs, and pass them to Cursor or Claude Code. The agent fetches structured JSON with predictable fields—customers, invoices, subscriptions—instead of parsing raw spreadsheet files.

Do I need a vector database?

Not for this tutorial. Structured business data—customers, invoices, usage metrics—works best through REST APIs with filtering and pagination. Vector databases help with unstructured documents. For account lookups, revenue questions, and subscription status, API Butler endpoints are the right layer.

Can I use Google Sheets instead of CSV?

Yes. Export your spreadsheet as CSV and upload to API Butler. Google Sheets, Excel, and Airtable exports all work. The tutorial uses CSV files because they are portable, version-controllable, and easy to share with AI coding tools.

Can Cursor generate the frontend automatically?

Yes. Paste your API Butler endpoint URLs into the Cursor or Claude Code prompts in Step 5. For ChatGPT, Claude, or Mistral chat agents, register the same URLs as tools or Actions — the agent fetches live data before answering.

When should I use APIs instead of uploading files directly?

Use APIs when your agent or app needs structured queries—filter by plan, find overdue invoices, check inactive accounts. File uploads work for one-off analysis. APIs give agents repeatable, filterable access to business data without re-parsing spreadsheets on every request.

Ready to build

Upload CSV. Get API. Build your agent.

Start with your five business datasets and have agent-ready endpoints in minutes.