React 19 TypeScript Anthropic Claude Mastra Agent Runtime Azure AI Search Entra ID (SSO) Server-Sent Events

What It Does

Ask Ricky is an AI chat interface โ€” branded "Ask Ricky, powered by FieldTune" โ€” that lets field mechanics ask equipment questions in plain language and get answers grounded in real data. Live telemetry from the compressor they're standing in front of, that unit's work order history, and a curated knowledge base built by subject matter experts.

Unlike a generic chatbot, Ask Ricky is scope-aware: it knows which unit the mechanic is asking about, pulls real-time data for that specific unit, and limits its answers to what the caller is authorized to see. It's a pure frontend SPA โ€” all intelligence lives in the AI Engine, not the client.

Ask Ricky chat interface showing a conversation about unit 1403
The Ask Ricky chat interface showing a mechanic's question about a specific compressor unit with live telemetry data in the response.

Key Features

How It Works

When a mechanic asks a question, Ask Ricky sends it (with their Entra bearer token) to the AI Engine orchestrator. The agent (Claude via Mastra) decides which tools to call based on the question and streams the response back in real time:

Mechanic asks question
โ†’
AI Engine (POST /api/agent, SSE)
โ†’
Claude decides tools
โ†’
Streamed answer

The AI Engine has access to these tools, gated by the caller's scopes:

ToolRequired ScopeWhat It Provides
Search Knowledge Base KnowledgeBase.Read Curated troubleshooting guides + general knowledge (fault codes, torque specs). Component-scoped fuzzy matching (e.g., "Cummins KTA19")
Get Unit Profile Assets.Read Equipment makeup โ€” engine, compressor, specs for the specific unit
Get Telemetry Telemetry.Read Live sensor readings from M-Link / Enbase โ€” pressures, temps, RPM
Get Alarms Telemetry.Read Active alarm and fault codes for the unit
Get Work History WorkHistory.Read Past maintenance, repairs, and corrective actions
Get Corrective Maintenance WorkHistory.Read Outstanding corrective maintenance items
Diagnose Unit Telemetry.Read Structured diagnostic bundle combining multiple data points
Find Mechanics in Region Directory.Read Available mechanics for dispatch

The Knowledge Base & Ricky Curator

The knowledge base that Ask Ricky searches is not scraped from the internet โ€” it's deliberately built and maintained by subject matter experts (SMEs) using a companion tool called Ricky Curator.

Ricky Curator interface showing failure mode editing for Ariel JGQ-2 compressor
The Ricky Curator tool where SMEs create and refine knowledge articles that power Ask Ricky's responses.

Knowledge Structure

Content is organized hierarchically: Tenant โ†’ Category (e.g., "Compressor Package") โ†’ Subject Kind (e.g., "Engine") โ†’ Subject (e.g., "Caterpillar 3306 TA") โ†’ Item (failure mode + troubleshooting guide).

The Curation Pipeline

AI Debate Engine

Ricky Curator uses a unique approach: it orchestrates a "debate" between Anthropic Claude and OpenAI GPT to generate and refine content. SMEs configure strictness levels (strict grounding vs. open reasoning) to control how closely the AI sticks to uploaded reference material.

Search Strategy

When Ask Ricky's agent searches the knowledge base, it uses hybrid search (keyword BM25 + Azure semantic reranker). Results are scoped to the exact equipment subject being discussed, and a "General Knowledge" bucket (FAQs, fault code references) is always included alongside equipment-specific results.

Field Feedback Loop

Mechanics can flag answers as inaccurate. Feedback routes back into Ricky Curator's review panel via a webhook, where SMEs can triage, update the guide, and re-publish โ€” closing the loop between field use and knowledge quality.

Ask Ricky feedback submission with thumbs-down, reason tags, and comment field
Mechanics submit feedback by tapping thumbs-down โ€” choosing a reason (Inaccurate, Missing info, Not relevant, Unsafe) and adding a comment.
Ricky Curator Agent Feedback panel showing open feedback items with conversation context
Feedback appears in Ricky Curator's Agent Feedback panel with the full conversation, letting SMEs triage and resolve.
Why This Matters

Most AI assistants pull from generic internet data. Ask Ricky's knowledge base is curated by the people who actually know this equipment โ€” capturing institutional knowledge that would otherwise exist only in the heads of senior mechanics. The debate engine and feedback loop keep it improving over time.

Authorization & Scoping

Ask Ricky uses Entra ID (Microsoft Azure AD) for single sign-on, enforced through the platform's permissions and scoping model. When a mechanic opens the app:

Administration

Ask Ricky's AI agent behavior, tool access, and integration configuration are managed through Platform Admin. The knowledge base content is managed through Ricky Curator. User scopes and group membership control what each mechanic can access.

On the Roadmap

The same AI engine and data connections that power Ask Ricky will power background proactive agents. No new integrations required โ€” just a different trigger model (scheduled instead of user-initiated).