Andrei Sferdian commited on
Commit ·
d1aaa5c
1
Parent(s): 9db26e8
Add dummy graph
Browse files
agent.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Annotated, TypedDict
|
| 2 |
+
|
| 3 |
+
from langchain_core.messages import AnyMessage
|
| 4 |
+
from langgraph.graph.message import add_messages
|
| 5 |
+
from langgraph.graph.state import END, START, StateGraph
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class AgentState(TypedDict):
|
| 9 |
+
"""
|
| 10 |
+
State for the agent.
|
| 11 |
+
|
| 12 |
+
Attributes:
|
| 13 |
+
messages (list[AnyMessage]): A list of messages associated with the agent.
|
| 14 |
+
The `add_messages` annotation provides additional metadata or validation
|
| 15 |
+
for this attribute.
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
messages: Annotated[list[AnyMessage], add_messages]
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
graph = StateGraph(AgentState) # noqa: F821
|
| 22 |
+
graph.add_node(
|
| 23 |
+
"agent",
|
| 24 |
+
)
|
| 25 |
+
graph.add_edge(START, "agent")
|
| 26 |
+
graph.add_edge("agent", END)
|