withConfig(config: Omit<RunnableConfig, "store" | "writer" | "interrupt">): ReactAgent<Types>| Name | Type | Description |
|---|---|---|
config* | Omit<RunnableConfig, "store" | "writer" | "interrupt"> | Configuration to merge with existing config |
const agent = createAgent({ model: "gpt-4o", tools: [...] });
// Set a default recursion limit
const configuredAgent = agent.withConfig({ recursionLimit: 1000 });
// Chain multiple configs
const debugAgent = agent
.withConfig({ recursionLimit: 1000 })
.withConfig({ tags: ["debug"] });Creates a new ReactAgent with the given config merged into the existing config. Follows the same pattern as LangGraph's Pregel.withConfig().
The merged config is applied as a default that gets merged with any config passed at invocation time (invoke/stream). Invocation-time config takes precedence.