Typing issue when using createReactAgent with tools with "configurable" parameters #7645
Open
5 tasks done
Labels
auto:bug
Related to a bug, vulnerability, unexpected error with an existing feature
Checked other resources
Example Code
As soon as i bind configurable parameters to
playwrightActionTool
I get the following error:
I want the playwright tool to have access to the page object, and currently typescript is stopping me from doing it
Error Message and Stack Trace (if applicable)
Type '(DynamicStructuredTool<ZodObject<{ goal: ZodString; summary: ZodString; }, "strip", ZodTypeAny, { goal: string; summary: string; }, { goal: string; summary: string; }>> | Runnable<...>)[]' is not assignable to type 'ToolNode | (StructuredToolInterface | RunnableToolLike<ZodType<any, ZodTypeDef, any>, unknown>)[]'.
Type '(DynamicStructuredTool<ZodObject<{ goal: ZodString; summary: ZodString; }, "strip", ZodTypeAny, { goal: string; summary: string; }, { goal: string; summary: string; }>> | Runnable<...>)[]' is not assignable to type '(StructuredToolInterface | RunnableToolLike<ZodType<any, ZodTypeDef, any>, unknown>)[]'.
Type 'DynamicStructuredTool<ZodObject<{ goal: ZodString; summary: ZodString; }, "strip", ZodTypeAny, { goal: string; summary: string; }, { goal: string; summary: string; }>> | Runnable<...>' is not assignable to type 'StructuredToolInterface | RunnableToolLike<ZodType<any, ZodTypeDef, any>, unknown>'.
Type 'Runnable<ToolCall | { textToFind: string; actionType: "type" | "click" | "hover" | "doubleClick"; inputText?: string | undefined; }, any, RunnableConfig<Record<string, any>>>' is not assignable to type 'StructuredToolInterface | RunnableToolLike<ZodType<any, ZodTypeDef, any>, unknown>'.
Type 'Runnable<ToolCall | { textToFind: string; actionType: "type" | "click" | "hover" | "doubleClick"; inputText?: string | undefined; }, any, RunnableConfig<Record<string, any>>>' is missing the following properties from type 'RunnableToolLike<ZodType<any, ZodTypeDef, any>, unknown>': schema, bound, config, _mergeConfigts(2322)
react_agent_executor.d.ts(37, 5): The expected type comes from property 'tools' which is declared here on type 'CreateReactAgentParams<AnnotationRoot<{}>, Record<string, any>>'
Also when i try to run the code using @ts-ignore, i get the following
Description
I am trying to send the reference of playwright object to my tool, but typescript won't allow me to do that
System Info
(base) ➜ browserwise git:(main) ✗ pnpm info langchain
langchain@0.3.15 | MIT | deps: 12 | versions: 310
Typescript bindings for langchain
https://github.com/langchain-ai/langchainjs/tree/main/langchain/
node -v
v20.13.1
MacOS
pnpm -v
9.1.2
The text was updated successfully, but these errors were encountered: