"""Skeleton generated from the blueprint. It runs offline: model calls are stubs you replace.""" from typing import TypedDict from langgraph.graph import StateGraph class State(TypedDict): request: str trace: list def call_model(step: str, model: str, state: State) -> str: # Replace with your model client. Keep the step name and model for tracing. return f"[{step} via {model or 'a model'}] {state['request']}" def classify(state: State) -> State: # Request router (claude-haiku-4-5) output = call_model('classify', 'claude-haiku-4-5', state) return {"request": output, "trace": state["trace"] + ['classify']} def answer(state: State) -> State: # Answer writer (claude-sonnet-5-5) output = call_model('answer', 'claude-sonnet-5-5', state) return {"request": output, "trace": state["trace"] + ['answer']} def await_approval(state: State) -> State: # The blueprint requires a person to approve before the last step. answer = input(f"Approve? {state['request']!r} [y/N] ") if answer.strip().lower() != "y": raise SystemExit("not approved") return {"request": state["request"], "trace": state["trace"] + ["await_approval"]} graph = StateGraph(State) graph.add_node("classify", classify) graph.add_node("await_approval", await_approval) graph.add_node("answer", answer) graph.set_entry_point("classify") graph.add_edge("classify", "await_approval") graph.add_edge("await_approval", "answer") graph.set_finish_point("answer") app = graph.compile() def run(request: str) -> State: return app.invoke({"request": request, "trace": []}) if __name__ == "__main__": print(run("hello"))