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

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

Combining LangGraph for fintech with Redis gives you a clean way to build stateful multi-agent workflows that can survive retries, coordinate across workers, and keep shared context close to the execution layer. In practice, this is what you want for things like fraud triage, KYC review, payment exception handling, or any workflow where multiple agents need to hand off work without losing state.

Prerequisites

  • Python 3.10+
  • A running Redis instance
    • Local: redis-server
    • Docker: docker run -p 6379:6379 redis:7
  • A LangGraph-based fintech workflow already defined or ready to define
  • Installed packages:
    • langgraph
    • redis
    • langchain-core if your graph uses message objects
  • Environment variables configured:
    • REDIS_URL=redis://localhost:6379/0
    • Any LLM/API keys your agents need

Integration Steps

  1. Install the dependencies and verify Redis connectivity

    Start by installing the Python packages and checking that Redis is reachable before wiring it into LangGraph.

    pip install langgraph redis langchain-core
    
    import os
    import redis
    
    redis_client = redis.Redis.from_url(os.getenv("REDIS_URL", "redis://localhost:6379/0"))
    print(redis_client.ping())  # True
    
  2. Define a shared state model for your multi-agent workflow

    In fintech workflows, keep the state explicit. Each agent should read and write a predictable structure so you can inspect and persist it cleanly.

    from typing import TypedDict, Annotated, List
    from langgraph.graph import StateGraph, START, END
    from langgraph.graph.message import add_messages
    from langchain_core.messages import HumanMessage, AIMessage
    
    class FintechState(TypedDict):
        messages: Annotated[List, add_messages]
        case_id: str
        risk_score: int
        decision: str
        notes: str
    
  3. Create agent nodes and persist intermediate state in Redis

    Use Redis as the shared backing store for case metadata, handoff status, or checkpoints. The pattern below stores per-case progress under a deterministic key.

    import json
    import os
    import redis
    
    redis_client = redis.Redis.from_url(os.getenv("REDIS_URL", "redis://localhost:6379/0"))
    
    def fraud_agent(state: FintechState):
        case_id = state["case_id"]
        risk_score = 87
    
        redis_key = f"fintech:case:{case_id}"
        redis_client.hset(redis_key, mapping={
            "stage": "fraud_review",
            "risk_score": risk_score,
            "status": "reviewed"
        })
    
        return {
            "risk_score": risk_score,
            "messages": [AIMessage(content=f"Fraud analysis complete. Risk score={risk_score}")]
        }
    
    def compliance_agent(state: FintechState):
        case_id = state["case_id"]
        risk_score = state["risk_score"]
    
        decision = "manual_review" if risk_score > 70 else "approve"
        notes = f"Compliance decision={decision}"
    
        redis_client.hset(f"fintech:case:{case_id}", mapping={
            "stage": "compliance_review",
            "decision": decision,
            "notes": notes
        })
    
        return {
            "decision": decision,
            "notes": notes,
            "messages": [AIMessage(content=notes)]
        }
    
  4. Build the LangGraph workflow and connect the agents

    This is the actual orchestration layer. LangGraph handles the routing between nodes; Redis stores durable shared context that other workers or services can read.

    def route_by_risk(state: FintechState):
        return "compliance" if state["risk_score"] >= 70 else END
    
    graph = StateGraph(FintechState)
    
    graph.add_node("fraud", fraud_agent)
    graph.add_node("compliance", compliance_agent)
    
    graph.add_edge(START, "fraud")
    graph.add_conditional_edges("fraud", route_by_risk)
    graph.add_edge("compliance", END)
    
    app = graph.compile()
    
  5. Run the workflow with a real case ID and inspect Redis

    Pass a case identifier through the graph so every agent writes to the same Redis namespace.

     initial_state = {
         "messages": [HumanMessage(content="Review payment case for possible fraud")],
         "case_id": "CASE-1042",
         "risk_score": 0,
         "decision": "",
         "notes": ""
     }
    
     result = app.invoke(initial_state)
     print(result)
     print(redis_client.hgetall("fintech:case:CASE-1042"))
    

Testing the Integration

Use a simple end-to-end test that runs the graph once and confirms Redis contains the expected fields.

test_case_id = "CASE-TEST-1"

result = app.invoke({
    "messages": [HumanMessage(content="Test transaction review")],
    "case_id": test_case_id,
    "risk_score": 0,
    "decision": "",
    "notes": ""
})

stored = redis_client.hgetall(f"fintech:case:{test_case_id}")
print("decision:", result["decision"])
print("redis_stage:", stored.get(b"stage"))
print("redis_status:", stored.get(b"status"))

Expected output:

decision: manual_review
redis_stage: b'compliance_review'
redis_status: b'reviewed'

If that passes, your LangGraph flow is producing state transitions and Redis is persisting them correctly.

Real-World Use Cases

  • Fraud investigation pipelines

    • One agent scores transaction risk.
    • Another checks sanctions/KYC flags.
    • A third routes to manual review and stores audit metadata in Redis.
  • Claims processing in insurance

    • Intake agent extracts claim details.
    • Validation agent checks policy coverage.
    • Triage agent assigns priority and writes queue status to Redis for downstream workers.
  • Payment exception handling

    • One agent classifies failed payments.
    • Another recommends retry vs escalation.
    • Redis keeps correlation IDs and retry counters across distributed workers.

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