🎉 ai-infra v1.0 is here — Production-ready AI/LLM infrastructure
What's new
nfrax logonfrax

Infrastructure that just works. Ship products, not boilerplate.

Frameworks

  • svc-infra
  • ai-infra
  • fin-infra
  • robo-infra

Resources

  • Getting Started
  • What's New
  • Contributing

Community

  • GitHub

© 2026 nfrax. All rights reserved.

nfrax logonfrax
Start HereWhat's New
GitHub
ai-infra / API Reference

Graph

from ai_infra.graph import Graph
View source
ai_infra.graph

Production-ready workflow graph with zero-config building. Supports multiple initialization patterns: 1. Simple dict-based (GOAL: minimal boilerplate):

python
graph = Graph(
       nodes={
           "analyze": analyze_func,
           "decide": decide_func,
           "execute": execute_func,
       },
       edges=[
           ("analyze", "decide"),
           ("decide", "execute", lambda state: state["should_execute"]),
       ],
       entry="analyze",
   )

2. Any callable as node:

python
graph = Graph(nodes={
       "func": my_function,
       "lambda": lambda state: {"output": state["input"] * 2},
       "method": my_instance.method,
       "agent": my_agent.run,
   })

3. Full LangGraph power:

python
graph = Graph(
       nodes={...},
       edges=[...],
       checkpointer=MemorySaver(),
       interrupt_before=["dangerous_node"],
       interrupt_after=["checkpoint_node"],
   )

4. Type-safe state:

python
class WorkflowState(TypedDict):
       input: str
       output: str

   graph = Graph[WorkflowState](
       nodes={...},
       state_schema=WorkflowState,
       validate_state=True,
   )
Constructor
Graph(nodes: dict[str, Any] | Sequence | None = None, edges: Sequence | None = None, entry: str | None = None, state_schema: type | None = None, validate_state: bool = False, checkpointer = None, store = None, interrupt_before: list[str] | None = None, interrupt_after: list[str] | None = None, state_type: type | None = None, node_definitions: Sequence | dict | None = None)
ParameterTypeDefaultDescription
nodesdict[str, Any] |Sequence|NoneNone—
edgesSequence|NoneNone—
entrystr|NoneNone—
state_schematype |NoneNone—
validate_stateboolFalse—
checkpointerAnyNone—
storeAnyNone—
interrupt_beforelist[str] |NoneNone—
interrupt_afterlist[str] |NoneNone—
state_typetype |NoneNone—
node_definitionsSequence|dict|NoneNone—

Methods

On This Page

Constructoranalyzearunasyncastreamasyncastream_valuesasyncdescribeget_arch_diagramget_stateget_state_historyrunstreamstream_values