Graph Agents¶
Compose multiple steps into a DAG the engine runs for you.
Minimal walkthrough¶
A graph is nodes (functions, tools, or agents) wired by dependencies. The engine runs independent nodes in parallel and feeds outputs downstream:
from neurosurfer.graph import Graph, GraphNode, GraphExecutor
graph = Graph(nodes=[
GraphNode(id="fetch", fn=fetch_docs),
GraphNode(id="summarise", fn=summarise, depends_on=["fetch"]),
GraphNode(id="report", fn=make_report, depends_on=["summarise"]),
])
result = await GraphExecutor(graph).run(inputs={"query": "quarterly numbers"})
print(result["report"])
Nodes can be agents, so a step is a full tool-using run. Persisted, runnable Workflow packages wrap a graph with its tools and metadata for reuse.
Full notebook¶
The Colab notebook builds a multi-node workflow end to end, including agent nodes and parallel branches.
Next: Graph & Workflows guide · Architect · Tutorial 4 →