Skip to main content
Back to Prompt Library
implementation

Construct LangGraph Liquidity Risk State Graph

Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.

Linked challenge: Bank Insolvency & Liquidity Risk Early Warning System with LangGraph

Format
Code-aware
Lines
19
Sections
4
Linked challenge
Bank Insolvency & Liquidity Risk Early Warning System with LangGraph

Prompt source

Original prompt text with formatting preserved for inspection.

19 lines
4 sections
No variables
0 checklist items
from typing import TypedDict, Annotated
from langgraph.graph import StateGraph, END
import operator

class BankRiskState(TypedDict):
    bank_id: str
    lcr_ratio: float
    uninsured_deposits: float
    risk_level: str
    alerts: Annotated[list[str], operator.add]

def evaluate_liquidity(state: BankRiskState):
    if state["lcr_ratio"] < 0.85:
        return {"risk_level": "HIGH", "alerts": ["LCR below minimum threshold"]}
    return {"risk_level": "STABLE", "alerts": []}

builder = StateGraph(BankRiskState)
builder.add_node("evaluator", evaluate_liquidity)
builder.set_entry_point("evaluator")
builder.add_edge("evaluator", END)
checkpointer = None # Memory checkpointer instance
app = builder.compile()

Adaptation plan

Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.

Keep stable

Hold the task contract and output shape stable so generated implementations remain comparable.

Tune next

Update libraries, interfaces, and environment assumptions to match the stack you actually run.

Verify after

Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.