thelastapi
Get started free

Ask your agent "how is my site doing?" and get a real answer

Give your AI agent tools like vibiz_health and vibiz_analytics to check website uptime, traffic drops, and visitor errors using real data.

On this page 8 sections

Your AI agent can inspect your live site's health, traffic, and visitor errors directly using tools like vibiz_health and vibiz_analytics or the vibiz health CLI command. Instead of logging into multiple dashboards or guessing from raw logs, an agent reads structured checks covering uptime, deployments, traffic trends, and session issues. This gives your agent the exact numbers—from 7-day visitor totals to specific broken button clicks—needed to answer "how is my site doing?" with actionable facts.

Here is how to set up site analytics for your agent, what data it can read, and how it diagnoses problems on its own.

What an agent sees when inspecting your site

When you ask an agent like Claude Code, Cursor, or Codex about your site, it needs structured status data rather than an unstructured web scrape. thelastapi provides this through Mission Control, which evaluates every project across eight operational steps:

  1. Domain & HTTPS: Checks that the domain resolves, HTTPS is active, and the site answers without timeouts.
  2. Deploy: Verifies the latest production deploy succeeded and required resources are operational.
  3. Pages & SEO: Validates that /sitemap.xml entries answer cleanly without 5xx errors.
  4. Traffic: Compares the last 24 hours of pageviews to your 7-day moving average.
  5. Experience: Detects spikes in JavaScript errors, rage clicks, and dead clicks.
  6. Checkout & payments: Ensures payment webhooks are configured and deliveries are succeeding.
  7. Sales & revenue: Tracks 30-day and 24-hour order counts and gross totals.
  8. Limits & spend: Monitors usage against project limits, such as AI spend.

If you want to know when your site goes down, a deploy fails or sales stop, these checks run automatically in the background about once an hour. Agents can trigger an immediate check or read the latest cached state.

Reading site health with the CLI and tools

An agent working in your terminal can check overall account health or inspect failing services using the vibiz CLI:

Terminal
vibiz health                 # every business, worst first, one line each with its top problem
vibiz health --failing       # only failing ones
vibiz health run             # check every business again now in the background

When connected to an agent runtime via tool calls or MCP, the agent calls vibiz_health:

JSON
{
  "action": "project",
  "project_id": "prj_123"
}

The agent can also query the API directly via GET /v1/projects/:id/health or read the entire canvas using GET /v1/mission-control. The returned payload gives the agent exact metrics and clear failure reasons:

JSON
{
  "object": "project_health",
  "project": { "id": "prj_123", "name": "Shop", "slug": "shop", "url": "https://shop.example.com" },
  "status": "warn",
  "checked_at": "2026-11-12T12:00:00.000Z",
  "counts": { "fail": 0, "warn": 1 },
  "top": [
    {
      "id": "traffic",
      "status": "warn",
      "title": "Traffic",
      "detail": "Pageviews in the last 24 h are 65% below the 7-day daily average.",
      "fix": "Check recent deploys or marketing channels to see why incoming traffic dropped.",
      "link": "https://thelastapi.dev/projects/prj_123/analytics?period=7d",
      "since": "2026-11-12T09:00:00.000Z"
    }
  ],
  "metrics": {
    "visitors_7d": 812,
    "pageviews_24h": 140,
    "sales_30d": 9,
    "revenue_30d_usd_cents": 26100,
    "errors_24h": 2
  }
}

Because each issue includes a human-readable detail, a recommended fix, and an active duration (since), your agent can immediately tell you: "The site is online, but traffic dropped 65% below your 7-day average three hours ago. Sales remain at 9 orders over 30 days."

More details on how the checks evaluate status are covered in the Mission Control and health checks documentation.

Querying traffic, sources, and top pages

If the health check indicates a traffic anomaly, the agent can drill deeper into web analytics. Projects created with the default configuration include privacy-first analytics out of the box, requiring no cookies and storing no IP addresses. If you host elsewhere, you can still add analytics to any site with one tag.

The agent inspects traffic breakdowns using vibiz analytics or the vibiz_analytics tool:

Terminal
vibiz analytics --period 7d

Or via direct HTTP:

Terminal
curl "https://thelastapi.dev/v1/projects/prj_123/analytics?period=7d" \
  -H "Authorization: Bearer $VIBIZ_API_KEY"

The response includes:

  • Totals and timeseries: Visitors, pageviews, and bounce rates across 24h, 7d, or 30d periods.
  • Top sources: Referrers mapped directly to familiar names (such as ChatGPT, Google, or Direct).
  • Top pages: URL paths sorted by pageviews.
  • Devices and countries: Aggregated breakdown of desktop versus mobile, along with geographic origins resolved without storing visitor IPs.
  • Custom events: High-level product actions such as sign-ups or checkout steps.

With this data, the agent can point out specific trends: "Traffic from Google is steady at 210 visits over 7 days, but visitors arriving from ChatGPT dropped from 50 a day to 5 yesterday. The /pricing page remains your second most visited path with 240 pageviews."

Full parameters are documented in Analytics and replay.

Investigating user friction with session replay

Numbers tell you that something changed, but they do not always reveal why. When visitors run into broken buttons or unexpected errors, the agent can inspect recorded user sessions.

If your project includes the replay resource, sessions are recorded by default and masked in the visitor's browser before upload. The agent can list sessions that encountered issues:

Terminal
vibiz replays --errors --period 7d

The agent uses vibiz_replay_insights to identify recent friction points, then calls vibiz_replay_detail to inspect the timeline of a problematic visit.

To see what the user actually saw, the agent uses vibiz_replay_frames (or GET /v1/replays/:id/frames):

Terminal
curl "https://thelastapi.dev/v1/replays/rpl_123/frames?moments=error,rage_click" \
  -H "Authorization: Bearer $VIBIZ_API_KEY"

This returns static pictures of the page rebuilt at the exact moment of each JavaScript error or click failure:

  • The DOM is rebuilt as a static document without executing client scripts.
  • The visitor's viewport size is preserved (a mobile visitor produces a mobile-dimension image).
  • Rage clicks and dead clicks feature an outline around the target element with a dot marking the cursor location.

If you are evaluating cost and setup considerations for session capture, read session replay for a small site: masked, cheap and useful.

When teammates need to review a broken session themselves, the agent can call vibiz_replay_share_link to generate a private playback URL valid for 1 to 24 hours.

Health check rules at a glance

The background health runner evaluates your site against consistent rules:

CheckFails whenWarns when
Site upProduction address returns 5xx, times out after 10 s, fails DNS resolution, or has invalid HTTPSHome page returns 4xx, or redirects to insecure http://
Last deployLatest production deploy failedProduction deploy has been building or queued over 30 minutes
ErrorsSpike of 10+ sessions with JS errors in 24 h (at least 3x normal rate)3+ sessions with errors, 5+ with rage clicks, or 10+ with dead clicks in 24 h
TrafficNonePageviews in 24 h fall >60% below the 7-day daily average (min 20/day avg)
Sitemap & pagesAny page in /sitemap.xml answers 5xx (up to 20 checked)Missing sitemap, 404 responses in sitemap, or missing home page <title> / description
PaymentsLive store lacks a webhook URL, or failed deliveries without success in 24 hSome webhook deliveries failed, or test webhook is missing
LimitsAny hard cap reached (builds, AI budget, app email)Project usage reaches 80% of any cap

A project's headline status matches its worst individual check. If all checks are clean, it answers ok.

How agents safely handle visitor data

Allowing an AI agent to read analytics and session replay data requires strict data safety boundaries. thelastapi enforces guardrails before data ever reaches your agent:

  • Masked at the edge: Passwords, payment card numbers, IBANs, and one-time codes are never captured by the recorder. Text resembling emails or phone numbers is replaced by bullets or asterisks directly in the visitor's browser.
  • Untrusted data: Any text extracted from user screens (such as button labels or runtime error strings) is cut short and marked as untrusted input. Agents are instructed to evaluate this content strictly as data, never as system instructions.
  • No IP storage: Geographic analytics rely on in-memory DB-IP lookups. Visitor IP addresses are never saved to disk or returned in API responses.

Getting started

To let your agent inspect your site, ensure your project has the analytics and replay resources added, then point your agent at the CLI or MCP tools.

Run vibiz health in your project directory to see your first status report, or inspect your account board directly inside Mission Control.

Frequently asked questions

How does the health runner determine if traffic has dropped abnormally?

A traffic warning triggers when total pageviews over the past 24 hours fall more than 60 percent below your 7-day daily average, provided your site averages at least 20 pageviews per day.

Can an AI agent read personal customer details from session replays?

No. Sensitive values like passwords, payment cards, and one-time codes are blocked from recording entirely, while email addresses and phone numbers are masked in the browser before data leaves the visitor's device.

What happens if my site runs on an external host?

You can add an external domain with `vibiz domains add example.com --elsewhere` and paste the snippet from `vibiz analytics snippet` into your site's HTML to grant your agent full access to traffic and replay data.