How to Integrate LangGraph for investment banking with Redis for multi-agent systems
Combining LangGraph for investment banking with Redis gives you a clean way to run stateful, multi-agent workflows without turning your app into a pile of ad hoc retries and shared globals. In practice, this lets you coordinate deal analysis, compliance checks, risk review, and summarization as separate agents while Redis handles shared state, caching, and coordination across workers.
Prerequisites
- •Python 3.10+
- •A running Redis instance
- •Local:
redis-server - •Or managed Redis with a connection URL
- •Local:
- •Access to an LLM provider supported by LangChain/LangGraph
- •Installed packages:
- •
langgraph - •
langchain - •
langchain-openaior your model provider package - •
redis
- •
- •Environment variables configured:
- •
OPENAI_API_KEYor equivalent model key - •
REDIS_URL
- •
Integration Steps
- •Install the dependencies
pip install langgraph langchain langchain-openai redis
If you are deploying this in a bank environment, pin versions. LangGraph and Redis client behavior should not drift between environments.
- •Set up the Redis connection
Use Redis as the shared backing store for coordination data, checkpoints, or cached agent outputs.
import os
import redis
REDIS_URL = os.environ["REDIS_URL"]
redis_client = redis.from_url(
REDIS_URL,
decode_responses=True,
)
# Basic health check
print(redis_client.ping())
For multi-agent systems, keep Redis usage explicit. Do not hide it behind global mutable state. You want clear keys for workflow IDs, agent statuses, and intermediate results.
- •Build a LangGraph workflow for investment banking tasks
Here is a minimal graph with two nodes:
- •one agent drafts an investment memo
- •another agent performs a compliance review
from typing import TypedDict, Annotated
from langgraph.graph import StateGraph, END
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)
class DealState(TypedDict):
deal_summary: str
memo: str
compliance_notes: str
def draft_memo(state: DealState) -> dict:
prompt = f"""
Write a concise investment banking memo for this deal:
{state["deal_summary"]}
"""
response = llm.invoke(prompt)
return {"memo": response.content}
def compliance_review(state: DealState) -> dict:
prompt = f"""
Review this memo for compliance red flags:
{state["memo"]}
"""
response = llm.invoke(prompt)
return {"compliance_notes": response.content}
graph = StateGraph(DealState)
graph.add_node("draft_memo", draft_memo)
graph.add_node("compliance_review", compliance_review)
graph.set_entry_point("draft_memo")
graph.add_edge("draft_memo", "compliance_review")
graph.add_edge("compliance_review", END)
app = graph.compile()
This is the core LangGraph pattern: define state, define nodes, connect them into a graph, compile it. For investment banking workflows, each node should map to a controlled responsibility.
- •Persist workflow state in Redis
LangGraph supports checkpointing through checkpointers. In production, that matters because multi-agent systems fail mid-flight all the time.
If you want durable execution across restarts and worker handoffs, use Redis-backed storage for checkpoints or workflow metadata. A common pattern is to store run metadata in Redis while LangGraph manages execution state.
import json
import uuid
workflow_id = str(uuid.uuid4())
deal_payload = {
"deal_summary": "Evaluate a $250M acquisition of a regional payments processor.",
"memo": "",
"compliance_notes": ""
}
redis_client.set(f"deal:{workflow_id}:input", json.dumps(deal_payload))
redis_client.hset(
f"deal:{workflow_id}:status",
mapping={
"state": "queued",
"owner": "langgraph",
}
)
result = app.invoke(deal_payload)
redis_client.set(f"deal:{workflow_id}:result", json.dumps(result))
redis_client.hset(
f"deal:{workflow_id}:status",
mapping={
"state": "completed",
"owner": "langgraph",
}
)
In real systems, Redis becomes your coordination layer:
- •queueing work items
- •storing run status
- •caching intermediate outputs
- •sharing agent decisions across services
- •Add multi-agent coordination with Redis keys
For more than two agents, use Redis to coordinate which agent owns which stage. This is useful when separate services handle research, risk, legal, and client-facing output.
def assign_agent(workflow_id: str, stage: str, agent_name: str):
redis_client.hset(
f"deal:{workflow_id}:agents",
mapping={stage: agent_name}
)
def get_agent_assignment(workflow_id: str, stage: str) -> str | None:
return redis_client.hget(f"deal:{workflow_id}:agents", stage)
assign_agent(workflow_id, "research", "agent-research")
assign_agent(workflow_id, "risk", "agent-risk")
print(get_agent_assignment(workflow_id, "risk"))
This pattern scales better than stuffing everything into one graph node. Let LangGraph manage execution flow and let Redis manage distributed coordination.
Testing the Integration
Run the graph end-to-end and confirm that both LangGraph execution and Redis persistence work.
test_state = {
"deal_summary": "Assess whether acquiring a fintech lender improves cross-sell revenue without breaching capital constraints.",
"memo": "",
"compliance_notes": ""
}
output = app.invoke(test_state)
print(output)
stored_result = redis_client.get(f"deal:{workflow_id}:result")
print(stored_result)
Expected output will look similar to this:
{
'deal_summary': 'Assess whether acquiring a fintech lender improves cross-sell revenue without breaching capital constraints.',
'memo': '...',
'compliance_notes': '...'
}
{"deal_summary":"...","memo":"...","compliance_notes":"..."}
If ping() works but the workflow result is missing in Redis:
- •check your key names
- •verify
app.invoke()completed successfully - •confirm your process has write access to the Redis instance
Real-World Use Cases
- •
Deal screening pipelines
- •One agent summarizes target companies.
- •Another checks regulatory exposure.
- •A third produces an IC-ready memo.
- •Redis stores status so analysts can resume interrupted runs.
- •
Credit and risk review orchestration
- •Separate agents evaluate financials, covenant risk, sector risk, and concentration limits.
- •LangGraph controls the sequence.
- •Redis caches prior evaluations so repeated requests do not recompute everything.
- •
Client reporting workflows
- •One agent drafts market commentary.
- •Another validates numbers against internal sources.
- •Another formats the final report.
- •Redis keeps document versions and audit metadata tied to each workflow ID.
If you are building AI systems for banking teams, this combination is practical because it separates concerns cleanly. LangGraph handles deterministic orchestration; Redis gives you durable coordination across agents and workers.
Keep learning
- •The complete AI Agents Roadmap — my full 8-step breakdown
- •Free: The AI Agent Starter Kit — PDF checklist + starter code
- •Work with me — I build AI for banks and insurance companies
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