class LittleGhost::Graph

Routes a request through named Assembly nodes and declared edges.

A Graph is an Assembly for flows whose allowed paths should be visible in application code. A node may contain an Agent, Workflow, Swarm, or another Graph. Edges declare which node may run next.

class SupportFlowGraph < LittleGhost::Graph
  node :triage, TriageAgent
  node :ledger, LedgerResearchAgent
  node :policy, PolicyResearchAgent
  node :respond, CustomerSupportAgent

  start :triage
  edge :triage, :ledger
  edge :triage, :policy
  edge :ledger, :respond
  edge :policy, :respond
  finish :respond
end

SupportFlowGraph.validate!
run = SupportFlowGraph.ask("Why is my transfer pending?")

Call a named Graph with ask for its final Run, or the streaming entrypoint for routing and final-response events.

Multiple unconditional edges from one source run in parallel and converge at their first unambiguous common successor. Array endpoints declare an explicit fan-out or wait-for-all fan-in. Parallel groups cannot nest. Conditions and input mappers receive a read-only Graph::State. Nodes do not receive caller history or application context unless their declaration opts in with history: true or context: true. Validate the topology before execution. Conditions and mappers are application callbacks and can inspect copied input, history, context, and completed results. to_mermaid renders the same definition as a flowchart.