langgraph-prebuilt 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/PKG-INFO +1 -1
  2. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/langgraph/prebuilt/chat_agent_executor.py +10 -5
  3. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/pyproject.toml +1 -1
  4. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/uv.lock +1 -1
  5. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/.gitignore +0 -0
  6. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/LICENSE +0 -0
  7. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/Makefile +0 -0
  8. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/README.md +0 -0
  9. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/langgraph/prebuilt/__init__.py +0 -0
  10. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/langgraph/prebuilt/interrupt.py +0 -0
  11. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/langgraph/prebuilt/py.typed +0 -0
  12. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/langgraph/prebuilt/tool_node.py +0 -0
  13. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/langgraph/prebuilt/tool_validator.py +0 -0
  14. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/tests/__init__.py +0 -0
  15. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/tests/__snapshots__/test_react_agent_graph.ambr +0 -0
  16. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/tests/any_str.py +0 -0
  17. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/tests/compose-postgres.yml +0 -0
  18. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/tests/conftest.py +0 -0
  19. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/tests/conftest_checkpointer.py +0 -0
  20. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/tests/conftest_store.py +0 -0
  21. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/tests/memory_assert.py +0 -0
  22. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/tests/messages.py +0 -0
  23. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/tests/model.py +0 -0
  24. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/tests/test_react_agent.py +0 -0
  25. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/tests/test_react_agent_graph.py +0 -0
  26. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/tests/test_tool_node.py +0 -0
  27. {langgraph_prebuilt-0.2.0 → langgraph_prebuilt-0.2.1}/tests/test_validation_node.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-prebuilt
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Library with high-level APIs for creating and executing LangGraph agents and tools.
5
5
  Project-URL: Repository, https://www.github.com/langchain-ai/langgraph
6
6
  License-Expression: MIT
@@ -240,7 +240,7 @@ def _validate_chat_history(
240
240
 
241
241
  def create_react_agent(
242
242
  model: Union[str, LanguageModelLike],
243
- tools: Union[Sequence[Union[BaseTool, Callable]], ToolNode],
243
+ tools: Union[Sequence[Union[BaseTool, Callable, dict[str, Any]]], ToolNode],
244
244
  *,
245
245
  prompt: Optional[Prompt] = None,
246
246
  response_format: Optional[
@@ -420,12 +420,13 @@ def create_react_agent(
420
420
  else AgentState
421
421
  )
422
422
 
423
+ llm_builtin_tools: list[dict] = []
423
424
  if isinstance(tools, ToolNode):
424
425
  tool_classes = list(tools.tools_by_name.values())
425
426
  tool_node = tools
426
427
  else:
427
- tool_node = ToolNode(tools)
428
- # get the tool functions wrapped in a tool class from the ToolNode
428
+ llm_builtin_tools = [t for t in tools if isinstance(t, dict)]
429
+ tool_node = ToolNode([t for t in tools if not isinstance(t, dict)])
429
430
  tool_classes = list(tool_node.tools_by_name.values())
430
431
 
431
432
  if isinstance(model, str):
@@ -442,8 +443,12 @@ def create_react_agent(
442
443
 
443
444
  tool_calling_enabled = len(tool_classes) > 0
444
445
 
445
- if _should_bind_tools(model, tool_classes) and tool_calling_enabled:
446
- model = cast(BaseChatModel, model).bind_tools(tool_classes)
446
+ if (
447
+ _should_bind_tools(model, tool_classes)
448
+ and len(tool_classes) > 0
449
+ or (len(llm_builtin_tools) > 0)
450
+ ):
451
+ model = cast(BaseChatModel, model).bind_tools(tool_classes + llm_builtin_tools) # type: ignore[operator]
447
452
 
448
453
  model_runnable = _get_prompt_runnable(prompt) | model
449
454
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "langgraph-prebuilt"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "Library with high-level APIs for creating and executing LangGraph agents and tools."
9
9
  authors = []
10
10
  requires-python = ">=3.9"
@@ -461,7 +461,7 @@ dev = [
461
461
 
462
462
  [[package]]
463
463
  name = "langgraph-prebuilt"
464
- version = "0.2.0"
464
+ version = "0.2.1"
465
465
  source = { editable = "." }
466
466
  dependencies = [
467
467
  { name = "langchain-core" },