Skip to content

Conversation

@dbschmigelski
Copy link
Member

Description

This PR introduces LangChainTool, a wrapper that enables integration of LangChain tools with Strands Agents. The implementation lives in strands.experimental.tools and allows users to wrap any LangChain BaseTool instance for use with a Strands Agent.

The wrapper accepts any LangChain tool variant since all LangChain tools inherit from BaseTool. This includes tools created with the @tool decorator (both sync and async), StructuredTool.from_function(), and custom BaseTool subclasses. The implementation extracts the tool's name, description, and input schema from the LangChain tool and converts them into a Strands-compatible ToolSpec. Users can optionally override the tool name and description if needed.

Since langchain-core is an optional dependency, the LangChainTool class uses a lazy loading pattern via __getattr__ in the module's __init__.py. This ensures that users without langchain-core installed won't encounter import errors unless they explicitly try to use LangChainTool.

. LangChain's TOOL_MESSAGE_BLOCK_TYPES includes additional content types like image, json, and document that may be added in future versions as needed. Currently, _convert_result_to_content only supports string results from LangChain tools. This clearly will not handle most use cases. But, what I want to do is have the scaffolding down, then we can expand the mappings as we go

As part of the review process I encourage everyone to pull this down and actually experiment.

Related Issues

N/A

Documentation PR

ToDo

Type of Change

New feature

Testing

The changes have been tested with both unit tests and integration tests covering all LangChain tool variants. All tests pass successfully.

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

❌ Patch coverage is 90.47619% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/strands/experimental/tools/langchain_tool.py 92.98% 2 Missing and 2 partials ⚠️
src/strands/experimental/tools/__init__.py 66.66% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@dbschmigelski dbschmigelski marked this pull request as ready for review January 7, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant