How to Integrate LangGraph for banking with Redis for multi-agent systems

By Cyprian AaronsUpdated 2026-04-21
langgraph-for-bankingredismulti-agent-systems

LangGraph for banking gives you the orchestration layer for regulated, multi-step workflows. Redis gives you the shared state, fast coordination, and message passing you need when multiple agents are working on the same banking case, customer session, or fraud investigation.

The useful pattern here is simple: LangGraph handles deterministic control flow, while Redis stores state and coordinates agents across processes. That unlocks things like claims triage, KYC review, payment exception handling, and fraud escalation without stuffing everything into one monolith.

Prerequisites

  • Python 3.10+
  • A Redis instance running locally or in your environment
  • Access to your LangGraph runtime and a graph definition for your banking workflow
  • langgraph, redis, and an LLM provider package if your nodes call a model
  • Basic familiarity with:
    • LangGraph nodes and edges
    • Redis key/value storage
    • Python async or sync execution

Install the dependencies:

pip install langgraph redis langchain-openai

Integration Steps

  1. Set up Redis as shared agent state

Use Redis to store case context that multiple agents can read and update. For banking systems, keep this state small and explicit: case id, risk flags, approval status, and audit metadata.

import json
import redis

r = redis.Redis(host="localhost", port=6379, decode_responses=True)

case_id = "case-10291"
state_key = f"banking:case:{case_id}"

initial_state = {
    "case_id": case_id,
    "customer_id": "cust-7781",
    "amount": 12500,
    "currency": "USD",
    "risk_score": None,
    "kyc_status": "pending",
    "fraud_status": "unknown",
}

r.set(state_key, json.dumps(initial_state))
print("Stored initial case state in Redis")
  1. Define LangGraph nodes that read from and write to Redis

Each node should do one job. A fraud node can enrich the case with a risk score; a KYC node can mark identity checks complete. Keep writes idempotent so retries do not corrupt state.

import json
from typing import TypedDict
from langgraph.graph import StateGraph, END

class CaseState(TypedDict):
    case_id: str

def load_case(case_id: str) -> dict:
    raw = r.get(f"banking:case:{case_id}")
    return json.loads(raw) if raw else {}

def save_case(case: dict) -> None:
    r.set(f"banking:case:{case['case_id']}", json.dumps(case))

def fraud_check(state: CaseState):
    case = load_case(state["case_id"])
    case["risk_score"] = 82
    case["fraud_status"] = "review_required"
    save_case(case)
    return {"case_id": case["case_id"]}

def kyc_check(state: CaseState):
    case = load_case(state["case_id"])
    case["kyc_status"] = "verified"
    save_case(case)
    return {"case_id": case["case_id"]}
  1. Build the LangGraph workflow

LangGraph’s StateGraph lets you define the sequence clearly. In banking flows, avoid vague branching; use explicit conditions based on stored state.

workflow = StateGraph(CaseState)

workflow.add_node("fraud_check", fraud_check)
workflow.add_node("kyc_check", kyc_check)

workflow.set_entry_point("fraud_check")
workflow.add_edge("fraud_check", "kyc_check")
workflow.add_edge("kyc_check", END)

app = workflow.compile()

result = app.invoke({"case_id": case_id})
print(result)
  1. Add multi-agent coordination with Redis pub/sub

For actual multi-agent systems, one agent may publish work while another consumes it. Redis Pub/Sub is enough for lightweight coordination; if you need durability, move to Redis Streams.

import threading

channel = "banking:tasks"

def publisher():
    message = {"type": "kyc_review", "case_id": case_id}
    r.publish(channel, json.dumps(message))

def subscriber():
    pubsub = r.pubsub()
    pubsub.subscribe(channel)
    for event in pubsub.listen():
        if event["type"] == "message":
            payload = json.loads(event["data"])
            print("Received task:", payload)
            break

t = threading.Thread(target=subscriber)
t.start()
publisher()
t.join()
  1. Persist checkpoints for recovery and audit

If a workflow fails mid-way, you want to resume from known-good state. LangGraph supports checkpointing patterns through its persistence interfaces; pair that with Redis so your banking process can recover cleanly after restarts.

A practical pattern is:

  • store the business payload in Redis
  • persist graph progress through a checkpoint store
  • write every decision as an append-only audit event
audit_key = f"audit:{case_id}"
r.lpush(audit_key, json.dumps({
    "event": "workflow_started",
    "case_id": case_id,
}))

r.lpush(audit_key, json.dumps({
    "event": "fraud_review_completed",
    "risk_score": 82,
}))

print(r.lrange(audit_key, 0, -1))

Testing the Integration

Run a quick end-to-end test by seeding Redis, executing the graph, then reading back the stored state.

test_case_id = "case-9001"
r.set(f"banking:case:{test_case_id}", json.dumps({
    "case_id": test_case_id,
    "customer_id": "cust-100",
    "amount": 5000,
    "currency": "USD",
}))

app.invoke({"case_id": test_case_id})

final_state = json.loads(r.get(f"banking:case:{test_case_id}"))
print(final_state)

Expected output:

{
  'case_id': 'case-9001',
  'customer_id': 'cust-100',
  'amount': 5000,
  'currency': 'USD',
  'risk_score': 82,
  'fraud_status': 'review_required',
  'kyc_status': 'verified'
}

Real-World Use Cases

  • Fraud triage orchestration

    • One agent scores transaction risk.
    • Another checks device history.
    • A third routes the case to human review if thresholds are exceeded.
  • KYC / AML review pipelines

    • LangGraph coordinates document checks, sanctions screening, and exception handling.
    • Redis stores shared customer state and review progress across agents.
  • Payment exception handling

    • One agent validates payment metadata.
    • Another checks ledger consistency.
    • A supervisor agent decides whether to retry, hold, or escalate.

If you’re building AI systems for banks or insurers, this combo gives you a clean split of responsibilities: LangGraph for control flow and Redis for coordination. That’s the difference between a prototype that works once and an agent system you can actually run in production.


Keep learning

By Cyprian Aarons, AI Consultant at Topiax.

Want the complete 8-step roadmap?

Grab the free AI Agent Starter Kit — architecture templates, compliance checklists, and a 7-email deep-dive course.

Get the Starter Kit

Related Guides