from typing import TypedDict

from langgraph.graph import END, START, StateGraph


class AgentState(TypedDict):
    input: str
    output: str


def _echo_node(state: AgentState) -> AgentState:
    return {"input": state["input"], "output": state["input"]}


def build_graph():
    """Build the model-free graph used as the initial service self-check."""
    graph = StateGraph(AgentState)
    graph.add_node("echo", _echo_node)
    graph.add_edge(START, "echo")
    graph.add_edge("echo", END)
    return graph.compile()
