From 80b284af256f12a6047d4d7ff84e83bd87a2383d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=83=D1=80=20=D0=9A=D1=83=D0=B7=D0=B0?= =?UTF-8?q?=D1=85=D0=BC=D0=B5=D1=82=D0=BE=D0=B2?= Date: Wed, 1 Jul 2026 14:00:26 +0000 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82=D1=8C=20ag?= =?UTF-8?q?ent.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent.py | 68 -------------------------------------------------------- 1 file changed, 68 deletions(-) delete mode 100644 agent.py diff --git a/agent.py b/agent.py deleted file mode 100644 index 8ffd31d..0000000 --- a/agent.py +++ /dev/null @@ -1,68 +0,0 @@ -""" -A simple self-correcting agent example using LangGraph. - -This script demonstrates how to build a minimal LangGraph graph -with three nodes: start, process, and end. The graph concatenates -a greeting message and prints it at the end. The example ensures -that imports from `langgraph.graph` work correctly. -""" - -from langgraph.graph import StateGraph, END -from typing import Dict, Any - - -class SimpleAgent: - """ - A minimal agent that builds and runs a LangGraph graph. - """ - - def __init__(self) -> None: - # Create a new StateGraph instance - self.graph = StateGraph() - - # Add nodes to the graph - self.graph.add_node("start", self.start_node) - self.graph.add_node("process", self.process_node) - self.graph.add_node("end", self.end_node) - - # Define the entry point and edges - self.graph.set_entry_point("start") - self.graph.add_edge("start", "process") - self.graph.add_edge("process", "end") - self.graph.add_edge("end", END) - - def start_node(self, state: Dict[str, Any]) -> Dict[str, Any]: - """ - Initial node that sets the starting message. - """ - state["message"] = "Hello" - return state - - def process_node(self, state: Dict[str, Any]) -> Dict[str, Any]: - """ - Process node that appends to the message. - """ - state["message"] += " World" - return state - - def end_node(self, state: Dict[str, Any]) -> Dict[str, Any]: - """ - End node that prints the final message. - """ - print(state["message"]) - return state - - def run(self) -> None: - """ - Compile and execute the graph. - """ - # Compile the graph into a runnable function - runnable = self.graph.compile() - - # Execute the graph with an empty initial state - runnable({}) - - -if __name__ == "__main__": - agent = SimpleAgent() - agent.run() \ No newline at end of file