diff --git a/libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py b/libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py index 06383edf6..4235f6b02 100644 --- a/libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py +++ b/libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py @@ -473,6 +473,11 @@ def create_react_agent( if context_schema is None: context_schema = config_schema + if len(deprecated_kwargs) > 0: + raise TypeError( + f"create_react_agent() got unexpected keyword arguments: {deprecated_kwargs}" + ) + if version not in ("v1", "v2"): raise ValueError( f"Invalid version {version}. Supported versions are 'v1' and 'v2'." diff --git a/libs/prebuilt/tests/test_deprecation.py b/libs/prebuilt/tests/test_deprecation.py index 6ce9dfa16..63e9e9b2e 100644 --- a/libs/prebuilt/tests/test_deprecation.py +++ b/libs/prebuilt/tests/test_deprecation.py @@ -31,3 +31,11 @@ def test_config_schema_deprecation() -> None: match="`get_config_jsonschema` is deprecated. Use `get_context_jsonschema` instead.", ): assert agent.get_config_jsonschema() is not None + + +def test_extra_kwargs_deprecation() -> None: + with pytest.raises( + TypeError, + match="create_react_agent\(\) got unexpected keyword arguments: \{'extra': 'extra'\}", + ): + create_react_agent(FakeToolCallingModel(), [], extra="extra")