langchain.js
    Preparing search index...

    Interface GraphNodeTypes<InputSchema, OutputSchema, ContextSchema, Nodes>

    Type bag for GraphNode that accepts schema types. All fields are optional - unspecified fields use defaults.

    This enables separate input/output schemas for nodes, which is useful when a node receives a subset of state fields and returns different fields.

    const node: GraphNode<{
    InputSchema: typeof NodeInputSchema;
    OutputSchema: typeof NodeOutputSchema;
    ContextSchema: typeof ContextSchema;
    Nodes: "agent" | "tool";
    }> = (state, runtime) => {
    return { answer: `Response to: ${state.query}` };
    };
    interface GraphNodeTypes<
        InputSchema = unknown,
        OutputSchema = unknown,
        ContextSchema = unknown,
        Nodes extends string = string,
    > {
        ContextSchema?: ContextSchema;
        InputSchema?: InputSchema;
        Nodes?: Nodes;
        OutputSchema?: OutputSchema;
    }

    Type Parameters

    • InputSchema = unknown
    • OutputSchema = unknown
    • ContextSchema = unknown
    • Nodes extends string = string
    Index

    Properties

    ContextSchema?: ContextSchema

    Schema for runtime context (uses ExtractStateType)

    InputSchema?: InputSchema

    Schema for node input state (uses ExtractStateType)

    Nodes?: Nodes

    Union of valid node names for Command.goto

    OutputSchema?: OutputSchema

    Schema for node output/update (uses ExtractUpdateType)