25 lines
644 B
Python
25 lines
644 B
Python
from langgraph.graph import StateGraph
|
|
from src.graph import build_graph
|
|
from langchain_core.messages import HumanMessage
|
|
|
|
def main():
|
|
# Build and compile the graph
|
|
graph = build_graph()
|
|
app = graph.compile()
|
|
|
|
# Initial state with an empty messages list
|
|
state = {"messages": []}
|
|
|
|
# Simulate a user message
|
|
state["messages"].append(HumanMessage(content="Hello, agent!"))
|
|
|
|
# Run the graph
|
|
result = app.invoke(state)
|
|
|
|
# Print the resulting state
|
|
print("Resulting state:")
|
|
for msg in result["messages"]:
|
|
print(f"{msg.__class__.__name__}: {msg.content}")
|
|
|
|
if __name__ == "__main__":
|
|
main() |