How to Integrate LangGraph for investment banking with LangSmith for production AI

By Cyprian AaronsUpdated 2026-04-22
langgraph-for-investment-bankinglangsmithproduction-ai

Combining LangGraph for investment banking with LangSmith gives you a practical path from agent prototype to production system. LangGraph handles the orchestration of multi-step banking workflows, while LangSmith gives you tracing, debugging, and evaluation across every node execution. That matters when your agent is summarizing deal documents, routing KYC checks, or generating investment committee memos where auditability is non-negotiable.

Prerequisites

  • Python 3.10+
  • langgraph
  • langchain
  • langsmith
  • An LLM provider key, such as OPENAI_API_KEY
  • A LangSmith account with:
    • LANGSMITH_API_KEY
    • LANGSMITH_TRACING=true
    • LANGSMITH_PROJECT set
  • A working understanding of:
    • LangGraph state graphs
    • LangChain chat models
    • Basic banking workflow logic

Install the packages:

pip install langgraph langchain langchain-openai langsmith

Integration Steps

  1. Configure LangSmith tracing before building the graph

    LangSmith needs to be enabled at process startup so every graph run is traced automatically.

import os

os.environ["LANGSMITH_TRACING"] = "true"
os.environ["LANGSMITH_API_KEY"] = "ls__your_api_key"
os.environ["LANGSMITH_PROJECT"] = "investment-banking-agent"
os.environ["OPENAI_API_KEY"] = "sk-your-openai-key"

If you skip this, your graph will still run, but you lose observability on node-level behavior.

  1. Create a LangChain model that will be used inside the graph

    LangGraph does not replace your model client. You still define the LLM separately and call it from nodes.

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)

For investment banking workflows, keep temperature low. You want consistent outputs for document extraction, risk summaries, and memo generation.

  1. Define a typed graph state and node functions

    Use a minimal state object that carries input through each step. This example builds a simple pipeline for analyzing an issuer update and producing an investment note.

from typing import TypedDict, Annotated
from operator import add

from langchain_core.messages import HumanMessage
from langgraph.graph import StateGraph, START, END


class BankAgentState(TypedDict):
    messages: Annotated[list, add]
    issuer_name: str
    raw_update: str
    analysis: str
    recommendation: str


def analyze_update(state: BankAgentState):
    prompt = f"""
You are an investment banking analyst.
Summarize the following issuer update and identify any material risks.

Issuer: {state["issuer_name"]}
Update:
{state["raw_update"]}
"""
    response = llm.invoke([HumanMessage(content=prompt)])
    return {"analysis": response.content}


def generate_recommendation(state: BankAgentState):
    prompt = f"""
Based on this analysis, write a concise recommendation for the deal team.

Issuer: {state["issuer_name"]}
Analysis:
{state["analysis"]}
"""
    response = llm.invoke([HumanMessage(content=prompt)])
    return {"recommendation": response.content}

This is where LangGraph fits well in banking systems: each node is explicit, testable, and easy to trace.

  1. Build the LangGraph workflow and compile it

    The compiled graph is what you execute in production. Once compiled, every run can be traced in LangSmith if tracing is enabled.

workflow = StateGraph(BankAgentState)

workflow.add_node("analyze_update", analyze_update)
workflow.add_node("generate_recommendation", generate_recommendation)

workflow.add_edge(START, "analyze_update")
workflow.add_edge("analyze_update", "generate_recommendation")
workflow.add_edge("generate_recommendation", END)

app = workflow.compile()

In a real banking system, you would usually add conditional routing here for things like compliance escalation or human approval.

  1. Run the graph with production-style input

    Pass structured data into the compiled app. LangSmith will capture the full execution trace across both nodes.

result = app.invoke(
    {
        "messages": [],
        "issuer_name": "Acme Capital Holdings",
        "raw_update": """
Q2 results showed revenue growth of 18% year over year.
However, management disclosed delayed receivables collection in EMEA.
The company also announced plans to refinance $250M of debt next quarter.
""",
        "analysis": "",
        "recommendation": "",
    }
)

print(result["analysis"])
print("\n---\n")
print(result["recommendation"])

At this point you have a working integration: LangGraph orchestrates the workflow and LangSmith records what happened at each step.

Testing the Integration

Use a quick smoke test to verify that tracing is active and the graph returns expected fields.

test_result = app.invoke(
    {
        "messages": [],
        "issuer_name": "Northstar Securities",
        "raw_update": "The firm announced stronger trading revenue but flagged higher funding costs.",
        "analysis": "",
        "recommendation": "",
    }
)

assert "analysis" in test_result
assert "recommendation" in test_result

print("Tracing enabled:", os.environ["LANGSMITH_TRACING"])
print("Project:", os.environ["LANGSMITH_PROJECT"])
print("Recommendation preview:", test_result["recommendation"][:120])

Expected output:

Tracing enabled: true
Project: investment-banking-agent
Recommendation preview: Based on this analysis...

If tracing is configured correctly, open your LangSmith project and inspect the run tree. You should see one top-level graph run with child runs for each node invocation.

Real-World Use Cases

  • Deal screening agents

    • Parse issuer updates, earnings releases, and debt filings.
    • Route risky cases to human analysts before anything reaches clients.
  • Investment committee memo generation

    • Build multi-step flows that extract facts, summarize risks, draft recommendations, and log every decision path in LangSmith.
  • Compliance-aware research assistants

    • Add branching logic for restricted lists, KYC flags, or jurisdiction-specific rules.
    • Use LangSmith traces to debug why a case was escalated or blocked.

The pattern here is simple: use LangGraph for deterministic orchestration and use LangSmith for visibility into production behavior. That combination is what makes AI agents acceptable in regulated investment banking environments.


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