Skip to content

Graph Components

A Graph is assembled from nodes and edges. This page is the reference for those building blocks: the fields on each type, the builder or constructor that assembles them, and the options that bound execution. To build and run a graph, see Graph.

1. GraphNode

A GraphNode represents a node in the graph with:

  • node_id: Unique identifier for the node
  • executor: The Agent, A2AAgent, or MultiAgentBase instance to execute
  • dependencies: Set of nodes this node depends on
  • execution_status: Current status (PENDING, EXECUTING, COMPLETED, FAILED)
  • result: The NodeResult after execution
  • execution_time: Time taken to execute the node in milliseconds

2. GraphEdge

A GraphEdge represents a connection between nodes with:

  • from_node: Source node
  • to_node: Target node
  • condition: Optional function that determines if the edge should be traversed

3. GraphBuilder

The GraphBuilder constructs graphs:

  • add_node(): Add an agent or multi-agent system as a node
  • add_edge(): Create a dependency between nodes
  • set_entry_point(): Define starting nodes for execution
  • set_max_node_executions(): Limit total node executions (useful for cyclic graphs)
  • set_execution_timeout(): Set maximum execution time
  • set_node_timeout(): Set timeout for individual nodes
  • reset_on_revisit(): Control whether nodes reset state when revisited
  • build(): Validate and create the Graph instance