services > case studies > langgraph-case-study-runninghill-builds-stateful-ai-agent-for-insurance-quote-workflow

LangGraph Case Study: RUNNINGHILL Builds Stateful AI Agent for Insurance Quote Workflow

by Runninghill Software Development
Published on: 11/18/2025

Executive Summary

To solve a complex client requirement for an insurance quote, RUNNINGHILL embarked on a 6-month project, beginning with a 2-month deep-dive to build a foundational agentic workflow. Mastering the LangGraph SDK, our team successfully built a stateful, reliable proof-of-concept that is now being expanded for production. This initial phase, using a JSON-based “collection plan” and Redis for state management, proves our expertise in building robust, production-ready AI systems.

The Client Challenge

Our client needed an agentic workflow for insurance quotes, a task that is simple on the surface but complex in reality. Standard AI applications are “straight-line”—they take a prompt and return an output. They break on the first unexpected error.

A real-world quote process requires loops (“Did the API fail? Try again.”), self-correction (“The user’s ID number failed validation, I must ask for it again.”), and statefulness (remembering the user’s data across a 20-step conversation). Furthermore, we discovered that an “LLM-heavy” approach was inefficient and slow, as unique user data made caching useless. We needed to build an agent that was not just intelligent, but reliable.

The Solution: Innovation in Action

We architected a sophisticated, stateful agent using LangGraph, a library designed to be a “state machine for AI”.

Instead of a “giant messy function,” the agent’s logic is a clean graph built from three key components:

  1. Nodes: Python functions that act as “workers” (e.g., “call external API,” “validate_user_input”).
  2. Edges: The connectors that define the flow and logic (e.g., “if validation fails, go back to the ‘ask_for_ID’ node”).
  3. State: The central “memory” of the conversation. This object is passed to every node and is checkpointed in a Redis cache, so the agent can reliably resume the conversation at any time.

Crucially, the entire workflow is driven by a flexible JSON “collection plan,” not hard-coded logic. This tells the agent what steps to take, allowing us to change the conversation (e.g., add a “vehicle details” step) just by updating a JSON file. This system is served via a single AWS Lambda, and the front end dynamically renders structured forms, calendars, and dropdowns based on the agent’s state, providing a user-friendly experience.

The Build

This was a dedicated, client-focused R&D initiative, with one of our developers, Dustin McDonald, working on the project for two months.

The process began with foundational upskilling in LangGraph, starting with “hello world” examples and progressing to complex conditional logic and loops. The most critical phase was the pivot away from an “LLM-heavy” solution. We re-architected the workflow to use LangGraph’s deterministic logic for data collection and state management, reserving the powerful (and expensive) LLM only for the tasks where it was truly needed. This 700-line workflow represents a mature, efficient, and production-ready architecture.

The Results & Impact

This project delivered a robust, client-ready POC and equipped our team with deep expertise in a cutting-edge AI framework.

“Well, thank you Dustin. That was really nice and showing us some skills as well… Thanks for the demo. We really appreciate it.”

Henk Bothma, Head of IT

Bulleted Key Metrics:

  • 100% Stateful & Reliable: The agent can handle errors, retries, and interruptions by using Redis for state checkpointing.
  • Massive Efficiency Gain: We created a highly efficient system by reducing our reliance on expensive, non-cacheable LLM calls for routine logic.
  • Flexible Architecture: The “collection plan” (JSON-driven) design allows the client’s business logic to be changed without re-writing the core application.
  • Deep Upskilling: Our team (led by Dustin) mastered a cutting-edge framework, moving from basic examples to a complex, client-facing agent in two months.

Why This Matters to Our Clients

This project is a perfect example of how we solve real-world business problems. Any company venturing into AI will quickly discover that a simple “chatbot” is not enough. You need reliable, stateful, and efficient applications. This R&D proves:

  • We Build Production-Ready AI: We understand the difference between a fragile demo and a robust, stateful application. We build systems (using LangGraph, Redis, and more) that can handle real-world errors and complexity.
  • We Are AI Efficiency Experts: We don’t just “use AI” for everything. We architect solutions that use powerful LLMs intelligently, saving you compute costs and improving performance by using deterministic logic where it’s more effective.
  • We Build for Your User: We know that “most people aren’t ready for a pure chatbot”. If required, our agents provide a structured, user-friendly experience with forms, calendars, and controls that reflect your business process and increase user trust.

About RUNNINGHILL

Established in 2013, Runninghill Software Development is among South Africa’s fastest-growing BBBEE Level 2 companies within the Information Technology Sector. With over 50 full-stack developers specialising in finance, banking, fintech, and more, we help companies design, build, and ship amazing products.

We are passionate software developers who deliver world-class solutions using the best tools in the industry. We focus on technical team augmentation, consulting, and agentic solution design, and we partner with the best design agencies so we can focus on what we do best: technical excellence.

Our services include:

  • Technical Consultation: We partner with your business to identify opportunities, solve complex challenges, and design strategic technology roadmaps that drive growth and digital transformation.
  • AI-enabled Technical Team Augmentation: We provide skilled developers and technical experts who integrate seamlessly with your existing team to accelerate project delivery and fill capability gaps.
  • Agents as a Service (AaaS): We design, build, and deploy intelligent AI agents that work autonomously within your business processes, creating a digital workforce that handles complex tasks while you focus on strategy.

Frequently Asked Questions (FAQ)

1. What is LangGraph and why is it important?

LangGraph is a library for building stateful AI applications. Most simple AI apps are “straight-line” and break when an error occurs. LangGraph works like a “state machine,” allowing us to build complex, reliable workflows with loops, retries, and self-correction. This is essential for building production-ready agents that can handle real-world tasks.

2. Why did this solution use less AI (LLM) over time?

The team discovered that an “LLM-heavy” approach was inefficient, slow, and expensive for this workflow, as unique user data meant responses couldn’t be cached. We re-architected the solution to use the LLM intelligently (for tasks needing true AI) and used LangGraph’s deterministic state machine for the core logic. This is a more mature, cost-effective, and higher-performance architecture.

3. What is the “collection plan” and why is it a better approach?

The “collection plan” is a JSON file that defines the entire conversational flow for the agent. Instead of hard-coding the logic (e.g., “ask for ID, then ask for car”), the agent reads this JSON. This is a far more flexible approach, as the business can change the quote process (add, remove, or re-order steps) just by editing the file, with no new code required.

4. Can RUNNINGHILL build a stateful AI agent for my business?

Yes. This case study is a direct example of that capability. We have proven expertise in designing and building complex, stateful agentic workflows using frameworks like LangGraph. We can help you architect a reliable AI system—from state management (using tools like Redis) to the API—that can handle your specific, multi-step business processes.

5. How does this relate to your “Agents as a Service (AaaS)” capability?

This project is our Agents as a Service (AaaS) capability in action. Our service is to design, build, and deploy a “digital workforce” of autonomous AI agents that are custom-built for your company. This insurance agent is a prime example of how we create a sophisticated, autonomous system that integrates with your processes, is driven by your business logic (like the “collection plan”), and creates a reliable, user-friendly experience.

WRITTEN BY

Runninghill Software Development

Looking for some more adventure?

How about this next article.