Skip to content

Execution Flow

Sudhanshu edited this page Nov 11, 2026 · 1 revision

Runtime Execution Flow

Offline CLI invocation

sequenceDiagram
  participant User
  participant Main as main(argv)
  participant Registry as EXAMPLES registry
  participant Example as example_*()
  participant Builder as StateGraph
  participant Runtime as CompiledGraph
  User->>Main: --self-test / --topic
  Main->>Registry: select demo functions
  loop selected offline topics
    Main->>Example: call(export_dir)
    Example->>Builder: add_node / add_edge / compile
    Builder-->>Example: compiled graph
    Example->>Runtime: invoke(initial_state)
    Runtime-->>Example: updated state
    Example-->>Main: result dictionary
  end
  Main->>Main: self_test(results) if requested
  Main-->>User: console JSON / optional result file
Loading

The EXAMPLES registry maps 18 topic keys to (function, requires_llm) tuples. Without --with-llm, the default loop selects the 16 non-API topics. --self-test runs these and validates expected values. --topic selects exactly one example.

Compilation and visualization

compile_graph() calls builder.compile() and optionally writes Mermaid text to --export-mermaid directory. Diagram export is not image rendering and does not require online Mermaid PNG services.

Paths that do not build a graph

example_add_messages() merges message lists directly with add_messages. It returns a dictionary but does not invoke compile_graph(). The generated system diagrams are maintained separately from the per-example .mmd exports.

Clone this wiki locally