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.
withConfig(
config: Omit<LangGraphRunnableConfig, "store" | "writer" | "interrupt">
): CompiledStateGraph<S, U, N, I, O, C, NodeReturnType, InterruptType, WriterType>| Name | Type | Description |
|---|---|---|
config* | Omit<LangGraphRunnableConfig, "store" | "writer" | "interrupt"> | 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" }
});