How to Integrate LangGraph for wealth management with Kubernetes for multi-agent systems
Combining LangGraph for wealth management with Kubernetes gives you a clean way to run regulated multi-agent workflows at scale. You get graph-based orchestration for portfolio analysis, risk checks, and client servicing, while Kubernetes handles deployment, scaling, and isolation across teams or tenants.
This is the setup you want when one agent gathers market data, another evaluates suitability, and a third generates advisor-ready summaries. The result is a production system that can keep stateful financial workflows reliable under load.
Prerequisites
- •Python 3.10+
- •A Kubernetes cluster with
kubectlaccess - •
kubernetesPython client installed - •
langgraphinstalled - •Access to your model provider or internal LLM endpoint
- •A container registry for pushing agent images
- •Basic familiarity with:
- •LangGraph
StateGraph - •Kubernetes Jobs, Deployments, and ConfigMaps
- •LangGraph
Install the Python dependencies:
pip install langgraph kubernetes pydantic
Integration Steps
- •
Define the shared state for wealth management workflows
Start with a typed state object. In wealth management, every agent needs the same core data: client profile, holdings, risk score, and recommendation output.
from typing import TypedDict, List, Dict, Any
class WealthState(TypedDict):
client_id: str
portfolio: List[Dict[str, Any]]
risk_profile: str
market_signals: Dict[str, Any]
recommendation: str
kubernetes_job_name: str
- •
Build the LangGraph workflow
Use
StateGraphto connect agents in sequence. For example: intake → risk analysis → recommendation.
from langgraph.graph import StateGraph, END
def intake_node(state: WealthState) -> WealthState:
state["market_signals"] = {"sp500": "up", "rates": "flat"}
return state
def risk_node(state: WealthState) -> WealthState:
portfolio = state["portfolio"]
exposure = sum(item.get("weight", 0) for item in portfolio)
state["risk_profile"] = "high" if exposure > 0.8 else "moderate"
return state
def recommendation_node(state: WealthState) -> WealthState:
if state["risk_profile"] == "high":
state["recommendation"] = "Reduce equity concentration and rebalance into short-duration fixed income."
else:
state["recommendation"] = "Maintain current allocation and monitor rate-sensitive positions."
return state
workflow = StateGraph(WealthState)
workflow.add_node("intake", intake_node)
workflow.add_node("risk", risk_node)
workflow.add_node("recommendation", recommendation_node)
workflow.set_entry_point("intake")
workflow.add_edge("intake", "risk")
workflow.add_edge("risk", "recommendation")
workflow.add_edge("recommendation", END)
app = workflow.compile()
- •
Use Kubernetes from inside the graph to launch an isolated agent job
This is where the integration becomes useful. For heavier computations like Monte Carlo simulation or document extraction, trigger a Kubernetes Job from a LangGraph node.
from kubernetes import client, config
def submit_k8s_job(state: WealthState) -> WealthState:
config.load_incluster_config() # use load_kube_config() locally
batch_v1 = client.BatchV1Api()
job_name = f"wealth-agent-{state['client_id']}".lower()
container = client.V1Container(
name="risk-worker",
image="registry.example.com/wealth/risk-worker:latest",
command=["python", "-m", "worker.run"],
env=[
client.V1EnvVar(name="CLIENT_ID", value=state["client_id"]),
],
)
template = client.V1PodTemplateSpec(
metadata=client.V1ObjectMeta(labels={"app": job_name}),
spec=client.V1PodSpec(restart_policy="Never", containers=[container]),
)
job_spec = client.V1JobSpec(
template=template,
backoff_limit=2,
ttl_seconds_after_finished=300,
)
job = client.V1Job(
api_version="batch/v1",
kind="Job",
metadata=client.V1ObjectMeta(name=job_name),
spec=job_spec,
)
batch_v1.create_namespaced_job(namespace="wealth-ai", body=job)
state["kubernetes_job_name"] = job_name
return state
- •
Wire Kubernetes execution into the graph
Put the job submission node before recommendation if you want results from an external worker. In production, that worker can write results to Redis, Postgres, or object storage.
from langgraph.graph import StateGraph, END
def wait_for_results(state: WealthState) -> WealthState:
# Replace this with polling Redis/Postgres/S3 or a callback endpoint.
state["market_signals"]["worker_status"] = f"submitted:{state['kubernetes_job_name']}"
return state
workflow = StateGraph(WealthState)
workflow.add_node("intake", intake_node)
workflow.add_node("submit_job", submit_k8s_job)
workflow.add_node("wait_for_results", wait_for_results)
workflow.add_node("risk", risk_node)
workflow.add_node("recommendation", recommendation_node)
workflow.set_entry_point("intake")
workflow.add_edge("intake", "submit_job")
workflow.add_edge("submit_job", "wait_for_results")
workflow.add_edge("wait_for_results", "risk")
workflow.add_edge("risk", "recommendation")
workflow.add_edge("recommendation", END)
app = workflow.compile()
- •
Run the graph with a real wealth-management payload
Keep the input small and explicit. In regulated systems, that makes tracing and audit much easier.
initial_state: WealthState = {
"client_id": "c12345",
"portfolio": [
{"symbol": "AAPL", "weight": 0.35},
{"symbol": "MSFT", "weight": 0.30},
{"symbol": "BND", "weight": 0.20},
],
"risk_profile": "",
"market_signals": {},
"recommendation": "",
"kubernetes_job_name": "",
}
result = app.invoke(initial_state)
print(result["recommendation"])
print(result["kubernetes_job_name"])
Testing the Integration
Use a local Kubernetes context first if you are developing on your laptop. Then verify that LangGraph can execute the workflow and create the Job object.
from kubernetes import client, config
config.load_kube_config()
batch_v1 = client.BatchV1Api()
jobs = batch_v1.list_namespaced_job(namespace="wealth-ai")
print([job.metadata.name for job in jobs.items if job.metadata.name.startswith("wealth-agent-")])
test_result = app.invoke({
"client_id": "c99999",
"portfolio": [{"symbol": "QQQ", "weight": 0.9}],
"risk_profile": "",
"market_signals": {},
"recommendation": "",
"kubernetes_job_name": "",
})
print(test_result["risk_profile"])
print(test_result["recommendation"])
Expected output:
['wealth-agent-c99999']
high
Reduce equity concentration and rebalance into short-duration fixed income.
Real-World Use Cases
- •
Advisor copilot workflows
- •One agent pulls holdings.
- •Another checks concentration risk.
- •A Kubernetes worker generates compliant summary notes for the advisor portal.
- •
Client onboarding automation
- •LangGraph orchestrates KYC intake, suitability checks, and exception handling.
- •Kubernetes runs document parsing and OCR jobs in isolated pods.
- •
Portfolio monitoring at scale
- •One agent watches market events.
- •Another scores impacted accounts.
- •Kubernetes fans out heavy analytics jobs across namespaces or node pools.
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