Spaces:
Running on Zero
Running on Zero
Download agent/graph.py from AliHaider1/Final_Assignment_Template: direct link, hf CLI and curl.
- Browser
- Download file 553 Bytes
-
https://huggingface.co/spaces/AliHaider1/Final_Assignment_Template/resolve/main/agent/graph.py
- Command line
-
hf download hf://spaces/AliHaider1/Final_Assignment_Template/agent/graph.py
-
curl -L -o graph.py https://huggingface.co/spaces/AliHaider1/Final_Assignment_Template/resolve/main/agent/graph.py
553 Bytes
| from langgraph.graph import StateGraph, START | |
| from langgraph.prebuilt import ToolNode, tools_condition | |
| from .state import AgentState | |
| from .nodes import assistant_node | |
| from .tools import ALL_TOOLS | |
| def build_graph(): | |
| builder = StateGraph(AgentState) | |
| builder.add_node("assistant", assistant_node) | |
| builder.add_node("tools", ToolNode(ALL_TOOLS)) | |
| builder.add_edge(START, "assistant") | |
| builder.add_conditional_edges("assistant", tools_condition) | |
| builder.add_edge("tools", "assistant") | |
| return builder.compile() |