withConfig<
TTransformers extends readonly () =
> StreamTransformer<any>[] = []>(
config: | Name | Type | Description |
|---|---|---|
config* | Omit<LangGraphRunnableConfig<Record<string, any>>, "store" | "writer" | "interrupt"> & __type |
Creates a new instance of the Pregel graph with updated configuration. This method follows the immutable pattern - instead of modifying the current instance, it returns a new instance with the merged configuration.
The configuration to merge with the current configuration
// Create a new instance with debug enabled
const debugGraph = graph.withConfig({ debug: true });
// Create a new instance with a specific thread ID
const threadGraph = graph.withConfig({
configurable: { thread_id: "123" }
});