langchain.js
    Preparing search index...

    Type Alias StateGraphInit<SD, I, O, C, N, InterruptType, WriterType>

    Initialization options for StateGraph. Accepts any combination of schema types for state/input/output.

    Supports both state and stateSchema as aliases for backward compatibility. If only input is provided (no state/stateSchema), input is used as the state schema.

    type StateGraphInit<
        SD extends StateDefinitionInit = StateDefinitionInit,
        I extends StateDefinitionInit | undefined = undefined,
        O extends StateDefinitionInit | undefined = undefined,
        C extends StateDefinitionInit | undefined = undefined,
        N extends string = string,
        InterruptType = unknown,
        WriterType = unknown,
    > = {
        context?: C;
        input?: I;
        interrupt?: InterruptType;
        nodes?: N[];
        output?: O;
        state?: SD;
        stateSchema?: SD;
        writer?: WriterType;
    }

    Type Parameters

    • SD extends StateDefinitionInit = StateDefinitionInit

      State definition type

    • I extends StateDefinitionInit | undefined = undefined

      Input definition type (defaults to undefined)

    • O extends StateDefinitionInit | undefined = undefined

      Output definition type (defaults to undefined)

    • C extends StateDefinitionInit | undefined = undefined

      Context schema type (defaults to undefined)

    • N extends string = string

      Node name union type (defaults to string)

    • InterruptType = unknown

      Interrupt type (defaults to unknown)

    • WriterType = unknown

      Writer type (defaults to unknown)

    Index

    Properties

    context?: C

    Context schema for runtime configuration validation. Does not support StateSchema.

    input?: I
    interrupt?: InterruptType
    nodes?: N[]
    output?: O
    state?: SD

    Primary key for state schema

    stateSchema?: SD

    Use state instead. Will be removed in a future version.

    writer?: WriterType