Skip to content

fix(AIC-3506): strip tools from LangChain model constructor kwargs - #133

Open
andrewklatzke wants to merge 1 commit into
mainfrom
aklatzke/AIC-3506/strip-lc-openai-tools-from-params
Open

andrewklatzke wants to merge 1 commit into
mainfrom
aklatzke/AIC-3506/strip-lc-openai-tools-from-params

Conversation

@andrewklatzke

@andrewklatzke andrewklatzke commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Human explanation:

Strips model.parameter.tools off of Langchain handlers so they don't get splatted into the kwargs. model.parameters.tools is a copy of the existing tools left in for backwards compatibility.

AI explanation:

Tools in model.parameters are forwarded raw and rejected by the provider API. They are already bound from the top-level tools field.


Note

Overview
Strips tools from LangChain chat model constructor kwargs everywhere default models are built, not only on Bedrock.

model.parameters.tools is a backwards-compat mirror of top-level config["tools"]. Forwarding it into ChatOpenAI / ChatAnthropic / ChatBedrockConverse caused provider errors because tools are already bound via bind_tools / agent setup. _model_constructor_kwargs in langchain-agents and langchain-messages now always pop("tools"); native_graph does the same for the default per-node ChatOpenAI path.

Tests assert constructors receive temperature, max_tokens, and model name only—no tools in the kwargs bag.

Reviewed by Cursor Bugbot for commit 2e31f0e. Bugbot is set up for automated code reviews on this repo. Configure here.

Tools in model.parameters are forwarded raw and rejected by the provider API. They are already bound from the top-level tools field.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant