Series • 9 Parts
Building Customer Support Agent with Custom Runtime
An architectural walkthrough on building a production customer support agent from scratch in pure Python—no LangChain, no framework black boxes. Every post focuses on a specific engineering problem: eliminating framework bloat, preventing prompt-injected refund fraud, local markdown search without vector DBs, and tracing latency waterfalls in Jaeger.
The 9 Parts
- Part 0 Why customer support is where agent frameworks breakThe real-world failure modes of off-the-shelf runtimes: address leaks, IDOR refund fraud, motor reset hallucinations, and the invariants you need before putting an agent in front of customers.
- Part 1 Why We Skipped LangChain: Designing a Provider-Agnostic Agent Harness from First PrinciplesHow to eliminate framework bloat: building a swappable LLM provider abstraction (Gemini, Claude, GPT-4) with strict alternating turn invariants in under 400 lines of Python.
- Part 2 Building the Runtime: Type-Safe Tool Calling, Schema Introspection, and ReAct LoopsHow to build a zero-dependency ToolRegistry that introspects Python type hints into JSON Schema, traps exceptions, and powers deterministic ReAct loops.
- Part 3 Zero-Trust AI: Defeating IDOR and Building Authentication Middleware for Agent Tool CallsWhy raw LLM tool calling is an IDOR vulnerability, and how to build deterministic pre-execution middleware for session identity binding and step-up 2FA/OTP.
- Part 4 Shipping NovaGear: Dogfooding Our Harness with RAG, Transactions, and Eval-Driven DevelopmentAssembling the full customer support agent: local markdown RAG without vector DB bloat, order state machines, and a 100% pass rate across deterministic eval benchmarks.
- Part 5 Event-Driven AI: Designing Decoupled Agent Lifecycle Hooks and ObserversHow to decouple agent reasoning loops from telemetry, web streaming, and auditing using a strongly-typed AgentEventBus.
- Part 6 Production Observability: OpenTelemetry GenAI Semantic Conventions and Latency WaterfallsHow to instrument autonomous AI agents with OpenTelemetry, gen_ai.* semantic conventions, and distributed tracing waterfalls in Jaeger.
- Part 7 Context Hygiene & Compaction: Micro-Observations and Cache-Aware Prefix FreezingHow to save 80% on tool token bloat and protect LLM prompt caching discounts using tool micro-compaction and prefix freezing.
- Part 8 The Production Blueprint: Deploying, Containerizing, and Serving Self-Hosted Agent RunnablesHow to deploy autonomous agents to production using FastAPI REST + SSE streaming, non-root hardened Docker containers, and Jaeger distributed tracing.