flow() API Flow builder, workflow graph, and mermaid APIs. typescript api api/flow build/apidocs api flow() API

flow() API

Flow builder, workflow graph, execution plan, and mermaid APIs.

Most Used

AxFlow

Interface for flows that can be tuned, executed, and used in compositions. Provides methods for building and executing complex AI workflows.

FieldValue
Kindclass
FormAxFlow
Sourcesource

Call Shape

TypeScript
m<TNewState>(transform: (_state: TState) => TNewState): AxFlow<IN, OUT, TNodes, TNewState>;
TypeScript
m<TNewState>(transform: (_state: TState) => Promise<TNewState>): AxFlow<IN, OUT, TNodes, TNewState>;
TypeScript
m<TNewState>(transforms: (_state: TState) => TNewState[], options: object): AxFlow<IN, OUT, TNodes, TNewState>;

Full reference

flow

Creates a new AxFlow builder. Passing a string compiles a mermaid flowchart in the AxFlow dialect (see AxFlow.toString) into a runnable flow — node contracts come from %%ax nodeId: <signature> directives or from bindings.nodes, data wiring is by field name (a node input binds to the nearest upstream producer of that field), labeled out-edges of a decision node become branches, and back-edges become feedback/while loops. flow(String(otherFlow)) round-trips.

FieldValue
Kindvariable
Formflow
ReturnsAxFlow<TInput, TOutput, { }, TInput>
Sourcesource

Call Shape

TypeScript
<TInput, TOutput>(options?: AxFlowOptions): AxFlow<TInput, TOutput, {
}, TInput>;
TypeScript
<TInput, TOutput>(mermaid: string, bindings?: AxFlowMermaidBindings): AxFlow<TInput, TOutput, any, any>;

Arguments And Options

NameTypeDescription
options?AxFlowOptions

Full reference

Advanced / internals / full reference

axCreateFlowColorLogger

Factory function to create a colorized AxFlow logger

FieldValue
Kindfunction
FormaxCreateFlowColorLogger
ReturnsAxFlowLoggerFunction
Sourcesource

Call Shape

TypeScript
function axCreateFlowColorLogger(output: (message: string) => void): AxFlowLoggerFunction;

Arguments And Options

NameTypeDescription
output(message: string) => void

Full reference

axCreateFlowTextLogger

Factory function to create a text-only AxFlow logger (no colors)

FieldValue
Kindfunction
FormaxCreateFlowTextLogger
ReturnsAxFlowLoggerFunction
Sourcesource

Call Shape

TypeScript
function axCreateFlowTextLogger(output: (message: string) => void): AxFlowLoggerFunction;

Arguments And Options

NameTypeDescription
output(message: string) => void

Full reference

axDefaultFlowLogger

Default AxFlow logger with colors

FieldValue
Kindvariable
FormaxDefaultFlowLogger
Sourcesource

Call Shape

TypeScript
const axDefaultFlowLogger: AxFlowLoggerFunction;

Full reference

AxFlowable

Interface for flows that can be tuned, executed, and used in compositions. Provides methods for building and executing complex AI workflows.

FieldValue
Kindinterface
FormAxFlowable
Sourcesource

Call Shape

TypeScript
applyOptimization(optimizedProgram: AxOptimizedProgram<OUT>): void;

Full reference

AxFlowBranchEvaluationData

Data types for different AxFlow logging events

FieldValue
Kindinterface
FormAxFlowBranchEvaluationData
Sourcesource

Call Shape

TypeScript
[key: string]: unknown

Full reference

AxFlowCompleteData

Data types for different AxFlow logging events

FieldValue
Kindinterface
FormAxFlowCompleteData
Sourcesource

Call Shape

TypeScript
[key: string]: unknown

Full reference

AxFlowDynamicContext

TypeScript interface exported by @ax-llm/ax. See the fields and full reference below.

FieldValue
Kindinterface
FormAxFlowDynamicContext
Sourcesource

Full reference

AxFlowErrorData

Data types for different AxFlow logging events

FieldValue
Kindinterface
FormAxFlowErrorData
Sourcesource

Call Shape

TypeScript
[key: string]: unknown

Full reference

AxFlowExecutionPlan

TypeScript interface exported by @ax-llm/ax. See the fields and full reference below.

FieldValue
Kindinterface
FormAxFlowExecutionPlan
Sourcesource

Full reference

AxFlowExecutionPlanGroup

TypeScript interface exported by @ax-llm/ax. See the fields and full reference below.

FieldValue
Kindinterface
FormAxFlowExecutionPlanGroup
Sourcesource

Full reference

AxFlowExecutionPlanStep

TypeScript interface exported by @ax-llm/ax. See the fields and full reference below.

FieldValue
Kindinterface
FormAxFlowExecutionPlanStep
Sourcesource

Full reference

AxFlowForwardOptions

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxFlowForwardOptions
Sourcesource

Call Shape

TypeScript
type AxFlowForwardOptions<T> = AxProgramForwardOptionsWithModels<T> & object;

Full reference

AxFlowLogData

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxFlowLogData
Sourcesource

Call Shape

TypeScript
type AxFlowLogData = 
  | AxFlowStartData
  | AxFlowStepStartData
  | AxFlowStepCompleteData
  | AxFlowParallelGroupStartData
  | AxFlowParallelGroupCompleteData
  | AxFlowBranchEvaluationData
  | AxFlowCompleteData
  | AxFlowErrorData;

Full reference

AxFlowLoggerData

Data types for different AxFlow logging events

FieldValue
Kindinterface
FormAxFlowLoggerData
Sourcesource

Call Shape

TypeScript
[key: string]: unknown

Full reference

AxFlowLoggerFunction

Function type for AxFlow logging

FieldValue
Kindtypealias
FormAxFlowLoggerFunction
Returnsvoid
Sourcesource

Call Shape

TypeScript
type AxFlowLoggerFunction = (data: AxFlowLogData) => void;

Arguments And Options

NameTypeDescription
dataAxFlowLogData

Full reference

AxFlowMermaidBindings

TypeScript interface exported by @ax-llm/ax. See the fields and full reference below.

FieldValue
Kindinterface
FormAxFlowMermaidBindings
Sourcesource

Full reference

AxFlowMermaidError

TypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.

FieldValue
Kindclass
FormAxFlowMermaidError
Sourcesource

Call Shape

TypeScript
new AxFlowMermaidError(
   message: string, 
   line: number, 
   context: string, 
   suggestion?: string): AxFlowMermaidError;

Full reference

AxFlowMermaidNodeBinding

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxFlowMermaidNodeBinding
Sourcesource

Call Shape

TypeScript
type AxFlowMermaidNodeBinding = 
  | string
  | AxSignature
  | {
  forward: (...args: any[]) => any;
}
  | (state: AxFlowState) => 
  | AxFlowState
| Promise<AxFlowState>;

Full reference

AxFlowMermaidRenderOptions

TypeScript interface exported by @ax-llm/ax. See the fields and full reference below.

FieldValue
Kindinterface
FormAxFlowMermaidRenderOptions
Sourcesource

Full reference

AxFlowOptions

TypeScript interface exported by @ax-llm/ax. See the fields and full reference below.

FieldValue
Kindinterface
FormAxFlowOptions
Sourcesource

Full reference

AxFlowParallelGroupCompleteData

Data types for different AxFlow logging events

FieldValue
Kindinterface
FormAxFlowParallelGroupCompleteData
Sourcesource

Call Shape

TypeScript
[key: string]: unknown

Full reference

AxFlowParallelGroupStartData

Data types for different AxFlow logging events

FieldValue
Kindinterface
FormAxFlowParallelGroupStartData
Sourcesource

Call Shape

TypeScript
[key: string]: unknown

Full reference

AxFlowStartData

Data types for different AxFlow logging events

FieldValue
Kindinterface
FormAxFlowStartData
Sourcesource

Call Shape

TypeScript
[key: string]: unknown

Full reference

AxFlowState

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxFlowState
Sourcesource

Call Shape

TypeScript
type AxFlowState = Record<string, unknown>;

Full reference

AxFlowStateDependencyAnalysis

Best-effort static dependency extraction for flow execute mappings.

FieldValue
Kindinterface
FormAxFlowStateDependencyAnalysis
Sourcesource

Full reference

AxFlowStepCompleteData

Data types for different AxFlow logging events

FieldValue
Kindinterface
FormAxFlowStepCompleteData
Sourcesource

Call Shape

TypeScript
[key: string]: unknown

Full reference

AxFlowStepStartData

Data types for different AxFlow logging events

FieldValue
Kindinterface
FormAxFlowStepStartData
Sourcesource

Call Shape

TypeScript
[key: string]: unknown

Full reference

AxFlowTypedParallelBranch

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxFlowTypedParallelBranch
ReturnsAxFlowTypedSubContext<TNodes, AxFlowState>
Sourcesource

Call Shape

TypeScript
type AxFlowTypedParallelBranch<TNodes, TState> = (subFlow: AxFlowTypedSubContext<TNodes, TState>) => AxFlowTypedSubContext<TNodes, AxFlowState>;

Arguments And Options

NameTypeDescription
subFlowAxFlowTypedSubContext<TNodes, TState>

Full reference

AxFlowTypedSubContext

TypeScript interface exported by @ax-llm/ax. See the fields and full reference below.

FieldValue
Kindinterface
FormAxFlowTypedSubContext
Sourcesource

Call Shape

TypeScript
execute<TNodeName, TAI>(
   nodeName: TNodeName, 
   mapping: (state: TState) => GetGenIn<TNodes[TNodeName]>, 
dynamicContext?: AxFlowDynamicContext<TAI>): AxFlowTypedSubContext<TNodes, AddNodeResult<TState, TNodeName, GetGenOut<TNodes[TNodeName]>>>;

Full reference

Full Reference

Open the full TypeScript reference. This page highlights the flow symbols most relevant to everyday use.

Docs