## ADDED Requirements ### Requirement: Pregel execution engine The system SHALL implement a Pregel-style superstep execution engine where: - Each "superstep" executes all ready nodes concurrently - Nodes communicate through typed channels (not direct function calls) - Channel writes from one superstep are visible as reads in the next - The engine supports `PULL` (edge-triggered) and `PUSH` (dynamic Send) task scheduling #### Scenario: Nodes execute in dependency order - **WHEN** node B subscribes to channel A - **THEN** node B SHALL execute in the superstep after node A writes to channel A #### Scenario: Concurrent nodes run in parallel - **WHEN** two nodes have no dependencies between them - **THEN** they SHALL execute concurrently within the same superstep #### Scenario: Dynamic Send spawns new node executions - **WHEN** a node calls `send("node_c", { ... })` via `Command` - **THEN** `node_c` SHALL be scheduled for execution in the current or next superstep ### Requirement: Graph compilation The system SHALL provide `graph.compile()` that produces a runnable compiled graph. Parameters: - `checkpointer?: Checkpointer` — optional persistence - `interruptBefore?: string[]` — nodes to pause before - `interruptAfter?: string[]` — nodes to pause after - `name?: string` — graph name #### Scenario: Compiled graph can be invoked - **WHEN** `compiled_graph.invoke({ messages: [] })` is called - **THEN** it SHALL execute all nodes and return the final state ### Requirement: Recursion limit The system SHALL enforce a configurable recursion limit to prevent infinite loops. #### Scenario: Exceeding recursion limit throws - **WHEN** a graph exceeds the recursion limit - **THEN** a `GraphRecursionError` SHALL be thrown