AI Engineer · Core LLMs, Distributed Multi-Agent Runtimes & Evaluation
AI Engineer @ KPMG India (Apr 2024 – Present) · Hyderabad, India
Author of agent-occ-lock & llm-cost-watch
LinkedIn · Email · Hacker News
I build production AI systems designed to operate deterministically under enterprise scale: distributed agent state synchronization, bounded runtime control planes, multimodal RAG platforms, and low-latency evaluation pipelines.
At KPMG, I architect enterprise AI platforms serving 10,000+ monthly queries with sub-1.2s p95 latency, maintaining 94% autonomous tool-calling accuracy and reducing hallucinations by 40% through continuous RAGAS evaluation gates.
Optimistic Concurrency Control (OCC) and 3-way delta reconciliation for parallel agent swarms.
When parallel subagents (LangGraph, CrewAI, AutoGen) execute concurrently with 500ms–3000ms model latency, standard in-memory dictionary writes suffer from silent lost updates. The slowest agent overwrites previous mutations. Holding distributed Redis mutexes forces serial execution and spikes p95 latency.
agent-occ-lock provides pure Python 3.13 atomic Compare-And-Swap (CAS) revision tokens and 3-way semantic diffs:
- CAS Revision Tokens: Every state read yields an immutable revision tag (
version,etag). - 3-Way Delta Merge: Reconciles non-colliding key updates automatically without re-invoking the LLM (0 reruns).
- Jittered Backoff: Retries genuine key collisions asynchronously with fresh state injection.
┌──────────────────────────────────┐
│ Shared Agent State │
│ (Version: 4, ETag: 'a3f9e2') │
└─────────────────┬────────────────┘
│
┌──────────────────────┴──────────────────────┐
▼ ▼
Agent 1 (Reads v4) Agent 2 (Reads v4)
[ LLM Call: extracts tags ] [ LLM Call: writes summary ]
│ │
▼ ▼
CAS Commit: v4 -> v5 CAS Commit: v4 (STALE!)
(State becomes v5) │
▼
3-Way Semantic Merge
┌──────────────────────────────┐
│ Keys orthogonal? │
│ - summary != tags -> MERGE! │
│ State becomes v6 (0 reruns) │
└──────────────────────────────┘
| Architecture | Retained Updates | Lost Updates (Data Loss) | Data Loss Rate | Wall Clock Time |
|---|---|---|---|---|
| Naive In-Place Overwrites | 1 / 25 | 24 | 96.0% | 0.0350s |
agent-occ-lock (CAS + 3-Way Merge) |
25 / 25 | 0 | 0.0% | 0.0323s (Sub-35ms) |
Model Context Protocol (MCP 2.x) server that lets Claude debug LLM spend and latency.
Instead of navigating passive web dashboards, llm-cost-watch connects directly to Claude Desktop and Claude Code, enabling conversational performance debugging:
cost_by_feature: Ranks subagents and endpoints by dollar spend and token consumption.slow_calls: Isolates p95 and p99 latency outliers and diagnoses bottlenecks (uncompressed context, recursive tool loops).routing_suggestions: Scans for short structured prompts running on expensive frontier models (GPT-4o, Sonnet) and calculates exact dollar savings from routing to Claude 3.5 Haiku or GPT-4o-mini (up to 94% cost reduction, -70% latency).- Zero External Egress: 100% local JSON/SQLite telemetry—no customer data ever leaves your environment.
# 1-line decorator for automated telemetry
@watch_llm(feature="customer_intent_classifier", task_type="classification", model="gpt-4o")
def classify_intent(message: str) -> str:
return client.chat.completions.create(...)Bounded state machines, decision ledgers, and deterministic evaluation gates for production agents.
Autonomous agents degrade into non-deterministic loops when tools return malformed outputs or unexpected schema structures. agent-eval-router bounds multi-agent execution loops with deterministic gates:
- Dynamic Policy Routing: Routes incoming requests between frontier models and fast local models based on task complexity, cutting token spend by up to 68%.
- Cryptographic Decision Ledger: Append-only SHA-256 ledger recording every tool call, state transition, and confidence score for enterprise compliance.
-
Continuous Assertion Gates: Enforces RAGAS evaluation metrics (Recall@K
$\ge$ 0.92, Faithfulness$\ge$ 0.90) directly inside the CI/CD pipeline.
Self-correcting AST validation engine for natural language analytical queries.
Engineered at PowerSchool to translate natural language into optimized SQL queries across 50+ enterprise Snowflake tables:
- Semantic Schema Parsing: Dynamic FAISS vector retrieval of relevant schema subsets to prevent context window bloat.
- AST Syntax & Security Guardrails: Pre-execution Abstract Syntax Tree (AST) inspection enforcing read-only constraints and eliminating SQL injection risks.
- Production Impact: Reduced analyst time-to-insight by 60% with 98% query accuracy across 500+ production test suites.
| Domain | Production Tooling |
|---|---|
| Agentic Frameworks | LangGraph, Multi-Agent Swarms, FastMCP, Model Context Protocol (MCP 2.x), ReAct, Supervisor-Worker |
| Models & Optimization | Claude 3.5 Sonnet, Claude 3.5 Haiku, GPT-4o, GPT-4o-mini, Gemini 1.5 Flash, Prompt Caching |
| Evaluation & Governance | RAGAS, LangSmith, Golden Evaluation Sets, Bounded State Machines, Decision Ledgers |
| Backend & Cloud Scale | Python 3.11/3.13, FastAPI, Docker, Kubernetes (AKS), PostgreSQL, Snowflake, Azure AI Search, Kafka |
-
AI Engineer — KPMG India (Apr 2024 – Present)
Architect of enterprise multi-agent platforms and multimodal RAG serving 10,000+ monthly queries with sub-1.2s p95 latency. Enforced 94% autonomous tool precision and 40% hallucination reduction via continuous RAGAS evaluation suites. Neutralized 99.9% of adversarial prompt injections. -
AI / Data Engineer — PowerSchool India (Jul 2023 – Mar 2024)
Shipped self-correcting AST Text-to-SQL agents unblocking 50+ analysts. Built multi-agent QA engines catching 92% of silent data regressions before ingestion.
I collaborate with engineering leads, CTOs, and researchers building deterministic agentic infrastructure.
- Email: balsarohith7@gmail.com
- LinkedIn: linkedin.com/in/rohithbalsa
- Hacker News: @rohith0707


