Building a Secure AI Assistant for Gig Worker Insights
How Turon AI built a natural language data assistant with strict PII guardrails, ReAct agent architecture, and retrieval-augmented SQL generation, deployed as an MVP to 100 gig workers.
- Domain
- Gig Economy Platform
- Scope
- MVP / ~100 Workers
- Stack
- LangGraph + BigQuery + Vertex AI
- Delivered By
- Turon AI
Secure Assistant
Guarded Query Flow
User Query
Natural language
Pre-Query Filter
Intent + PII check
ReAct Agent
LangGraph + few-shot
BigQuery
SQL execution
Post-Response Filter
PII scrub + compliance
Safe Response
Chainlit UI
Natural Language
No SQL or dashboards required
Strict Isolation
PII blocked across the pipeline
Enable natural language queries over worker data while strictly preventing access to other workers' PII.
Traditional dashboards were too rigid. Open-ended AI systems risked exposing sensitive data. The challenge was to combine the flexibility of a natural language interface with strong data governance and safety guarantees without compromise on either.
The Challenge
Flexibility and safety cannot be a trade-off
Natural Language Interface
Workers needed to ask questions about personal performance, earnings, and regional market trends without using dashboards or SQL.
Strict Data Isolation
The system had to prevent access to other workers' data and block personally identifiable information at every layer.
Safety Guarantees
The assistant needed to avoid hallucination, over-sharing, and data leakage even when users asked open-ended questions.
The Approach
Designed from first principles
Turon AI designed the MVP from the ground up, focusing on three core principles that shaped every architectural decision. Early in development, multiple approaches were explored for text-to-SQL generation, including tools like Vanna.
After evaluation, the team standardised on a ReAct-style agent architecture using LangGraph, which provided better control over reasoning, tool usage, and extensibility than simpler alternatives.
Controlled Data Access via SQL
All data access goes through structured querying: explicit, auditable, and schema-constrained.
Layered Safety Mechanisms
Guardrails are applied before and after generation, not only at one checkpoint.
Built for Extensibility
The architecture can evolve with new agents and capabilities without a redesign.
The Solution
Eight components, one coherent system
User Query
Natural language
Pre-Query Filter
Intent + PII check
ReAct Agent
LangGraph + few-shot
BigQuery
SQL execution
Post-Response Filter
PII scrub + compliance
Safe Response
Chainlit UI
01
Natural Language to SQL via ReAct Agents
A LangGraph-powered ReAct agent interprets queries, generates and executes SQL against BigQuery, and returns structured, user-friendly responses.
02
Multi-Layer Safety and Guardrails
Strict data boundaries are enforced through pre- and post-processing filters applied at both ends of every query.
03
Retrieval-Augmented Few-Shot Learning
Semantic retrieval of few-shot examples via vector search on Vertex AI improved accuracy and reduced hallucinations.
04
Multi-Agent Extensibility
An experimental supervisor layer supports future multi-domain expansion without architectural redesign.
05
Multi-LLM Flexibility
The platform can work with OpenAI, Gemini, and other providers, with dynamic switching and no core code changes.
06
Insight Generation from Structured Data
The system generated proactive automated insights grounded entirely in real data, moving beyond reactive Q&A.
07
Interactive UI with Chainlit
An interactive chat interface made the system accessible during the MVP phase and fast to iterate.
08
Observability and Iteration with LangSmith
LangSmith instrumentation gave visibility into agent decisions and supported rapid iteration from real usage.
Deployment & Iteration
Launched to 100 real workers
The system was launched as an MVP to a controlled group of approximately 100 gig workers. This allowed the team to observe real-world usage patterns, identify edge cases and failure modes, and continuously refine the system based on actual behaviour.
Every observation from the field fed directly back into prompt refinements, filter adjustments, and agent behaviour updates.
01
Observe real-world usage patterns
Monitor how workers naturally phrase questions and what they most want to know.
02
Identify edge cases and failure modes
Catch query types that expose gaps in SQL generation or filter logic.
03
Refine prompts, filters, and agent behaviour
Targeted updates based on LangSmith traces and real interaction data.
Outcome
Powerful, private, and production-ready
01 / Access
Natural Language Insights
Workers could access personal performance and regional market data without dashboards or SQL knowledge.
02 / Safety
Strict Privacy Boundaries
The system maintained strict data privacy and access boundaries with zero PII leakage and zero cross-user data exposure across all tested queries.
03 / Accuracy
Improved SQL Accuracy
Retrieval-augmented prompting improved query accuracy and reduced hallucinations across varied and complex questions.
04 / Architecture
Scalable Multi-Agent Foundation
New domains and capabilities can be added without redesigning the core system.
05 / Flexibility
Beyond Fixed Dashboards
A flexible query interface reduced dependency on rigid dashboards by adapting to worker questions.
The result is an AI assistant that does not just answer questions, but does so safely, accurately, and in alignment with real-world constraints.
Key Takeaway
Combining AI capability with system design discipline, grounding generation in structured data, enforcing layered safety, and building for extensibility, is what makes AI assistants both powerful and trustworthy.
AI capability and system design discipline
Getting natural language querying right is not just a model problem. It is an architecture problem, a safety problem, and an iteration problem all at once.
By grounding generation in structured data through SQL, enforcing safety through layered guardrails, and designing for extensibility from day one, Turon AI delivered a system that is both powerful and controlled.
The MVP deployment to 100 real workers created the tight feedback loop needed to refine the system rapidly. The result is a foundation that can grow with new agents, new domains, and new capabilities.