Skip to main content

Constructors

Methods

Interfaces

Module Functions


Constructors

constructor

new Graph(options: Config): Graph
Creates a new Graph instance.

Parameters

options
Config
required

Returns

Graph

Methods

start

start(input: any, ExecutionContext?: ExecutionContext): Promise<ExecutionResult>
Starts execution of the graph with the provided input. This method is asynchronous. Returns an containing: - outputStream: Async iterator for processing results - executionId: Unique identifier for this execution - variantName: The variant of the graph that was executed Important Changes in 0.8.0: - ✅ start() is now async - always use await - ✅ Returns ExecutionResult object (not just the stream) - ✅ Graph initialization happens on first call Execution Flow: 1. Call await graph.start(input) to begin execution 2. Iterate over outputStream to process results 3. Call stopInworldRuntime() when done

Parameters

input
any
required
Input data for the graph. Type depends on your start node’s expected input. Common types: string, LLMChatRequest, TTSRequest, Audio, or custom objects.
ExecutionContext
ExecutionContext
Optional execution context

Returns

Promise<ExecutionResult>

toJSON

toJSON(): string
Returns the JSON configuration of the graph.

Returns

string

stop

stop(): Promise<void>
Stops the graph executor.

Returns

Promise<void>

visualize

visualize(outputPath: string): Promise<void>
Generate a visualization of the graph structure. Creates a visual representation of the graph in PNG format. This method requires Graphviz to be installed on the system.

Parameters

outputPath
string
required
Path where the PNG visualization should be saved

Returns

Promise<void>

stopRuntime

stopRuntime(): Promise<any>
Completely stops Inworld Runtime;

Returns

Promise<any>

cancelExecution

cancelExecution(id: string): Promise<void>
Cancel the execution

Parameters

id
string
required

Returns

Promise<void>

getGraphId

getGraphId(): string
Gets the unique identifier for this graph.

Returns

string

Interfaces

ExecutionResult

Result returned from , containing the execution stream and metadata. This interface provides access to the graph execution results through an async iterator, along with execution tracking information.

Properties

variantName: string outputStream: GraphOutputStream executionId: string

ExecutionContext

Optional context parameters for graph execution. Provides control over execution tracking, user targeting, and initial state. All parameters are optional and have sensible defaults.

Properties

executionId?: string userContext?: UserContextInterface dataStoreContent?: { [x: string]: any; }

Module Functions

isGraphOptions

isGraphOptions(options: any): boolean

Parameters

options
any
required

Returns

boolean