import { Runnable, RunnableConfig, RunnableLike } from "@langchain/core/runnables";
import { PregelNode } from "../pregel/read.js";
import { Pregel, PregelInterface } from "../pregel/index.js";
import { BaseCheckpointSaver } from "../checkpoint/base.js";
import { BaseChannel } from "../channels/base.js";
import { All } from "../pregel/types.js";
import { RunnableCallable } from "../utils.js";
export declare const START = "__start__";
export declare const END = "__end__";
export interface BranchOptions<IO, N extends string> {
    source: N;
    path: Branch<IO, N>["condition"];
    pathMap?: Record<string, N | typeof END> | N[];
}
export declare class Branch<IO, N extends string> {
    condition: (input: IO, config?: RunnableConfig) => string | string[] | Promise<string> | Promise<string[]>;
    ends?: Record<string, N | typeof END>;
    constructor(options: Omit<BranchOptions<IO, N>, "source">);
    compile(writer: (dests: string[]) => Runnable | undefined, reader?: (config: RunnableConfig) => IO): RunnableCallable<unknown, unknown>;
    _route(input: IO, config: RunnableConfig, writer: (dests: string[]) => Runnable | undefined, reader?: (config: RunnableConfig) => IO): Promise<Runnable | undefined>;
}
export declare class Graph<const N extends string = typeof END, RunInput = any, RunOutput = any> {
    nodes: Record<N, Runnable<RunInput, RunOutput>>;
    edges: Set<[N | typeof START, N | typeof END]>;
    branches: Record<string, Record<string, Branch<RunInput, N>>>;
    entryPoint?: string;
    compiled: boolean;
    supportMultipleEdges: boolean;
    constructor();
    private warnIfCompiled;
    get allEdges(): Set<[string, string]>;
    addNode<K extends string>(key: K, action: RunnableLike<RunInput, RunOutput>): Graph<N | K, RunInput, RunOutput>;
    addEdge(startKey: N | typeof START, endKey: N | typeof END): this;
    addConditionalEdges(source: BranchOptions<RunInput, N>): this;
    addConditionalEdges(source: N, path: Branch<RunInput, N>["condition"], pathMap?: BranchOptions<RunInput, N>["pathMap"]): this;
    /**
     * @deprecated use `addEdge(START, key)` instead
     */
    setEntryPoint(key: N): this;
    /**
     * @deprecated use `addEdge(key, END)` instead
     */
    setFinishPoint(key: N): this;
    compile({ checkpointer, interruptBefore, interruptAfter, }?: {
        checkpointer?: BaseCheckpointSaver;
        interruptBefore?: N[] | All;
        interruptAfter?: N[] | All;
    }): CompiledGraph<N>;
    validate(interrupt?: string[]): void;
}
export declare class CompiledGraph<N extends string, RunInput = any, RunOutput = any> extends Pregel<Record<N | typeof START, PregelNode<RunInput, RunOutput>>, Record<N | typeof START | typeof END | string, BaseChannel>> {
    builder: Graph<N, RunInput, RunOutput>;
    constructor({ builder, ...rest }: {
        builder: Graph<N, RunInput, RunOutput>;
    } & PregelInterface<Record<N | typeof START, PregelNode<RunInput, RunOutput>>, Record<N | typeof START | typeof END | string, BaseChannel>>);
    attachNode(key: N, node: Runnable<RunInput, RunOutput>): void;
    attachEdge(start: N | typeof START, end: N | typeof END): void;
    attachBranch(start: N | typeof START, name: string, branch: Branch<RunInput, N>): void;
}
