Metadata-Version: 2.4
Name: toolbox-langchain
Version: 1.0.0
Summary: Python SDK for interacting with the Toolbox service with LangChain
Author-email: Google LLC <googleapis-packages@google.com>
Project-URL: Homepage, https://github.com/googleapis/mcp-toolbox-sdk-python/blob/main/packages/toolbox-langchain
Project-URL: Repository, https://github.com/googleapis/mcp-toolbox-sdk-python.git
Project-URL: Bug Tracker, https://github.com/googleapis/mcp-toolbox-sdk-python/issues
Project-URL: Changelog, https://github.com/googleapis/mcp-toolbox-sdk-python/blob/main/packages/toolbox-langchain/CHANGELOG.md
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: toolbox-core==1.0.0
Requires-Dist: langchain-core<2.0.0,>=0.2.23
Requires-Dist: PyYAML<7.0.0,>=6.0.1
Requires-Dist: pydantic<3.0.0,>=2.7.0
Requires-Dist: aiohttp<4.0.0,>=3.8.6
Requires-Dist: deprecated<2.0.0,>=1.1.0
Provides-Extra: test
Requires-Dist: black[jupyter]==26.1.0; extra == "test"
Requires-Dist: isort==8.0.0; extra == "test"
Requires-Dist: mypy==1.19.1; extra == "test"
Requires-Dist: pytest-asyncio==1.3.0; extra == "test"
Requires-Dist: pytest==9.0.2; extra == "test"
Requires-Dist: pytest-cov==7.0.0; extra == "test"
Requires-Dist: Pillow==12.1.0; python_version >= "3.10" and extra == "test"
Requires-Dist: google-cloud-secret-manager==2.26.0; extra == "test"
Requires-Dist: google-cloud-storage==3.7.0; extra == "test"

![MCP Toolbox Logo](https://raw.githubusercontent.com/googleapis/genai-toolbox/main/logo.png)
# MCP Toolbox LangChain SDK

This SDK allows you to seamlessly integrate the functionalities of
[MCP Toolbox](https://github.com/googleapis/genai-toolbox) into your LangChain GenAI
applications, enabling advanced orchestration and interaction with LLMs.

For detailed guides, authentication examples, and advanced configuration, visit the [Python SDK Langchain Guide](https://googleapis.github.io/genai-toolbox/sdks/python-sdk/langchain/).

<!-- TOC ignore:true -->
## Table of Contents
<!-- TOC -->

- [Installation](#installation)
- [Quickstart](#quickstart)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)
- [Support](#support)

<!-- /TOC -->

## Installation

```bash
pip install toolbox-langchain
```

## Quickstart

Here's a minimal example to get you started using
[LangGraph](https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.chat_agent_executor.create_react_agent):

```py
from toolbox_langchain import ToolboxClient
from langchain_google_vertexai import ChatVertexAI
from langgraph.prebuilt import create_react_agent

async with ToolboxClient("http://127.0.0.1:5000") as toolbox:
    tools = toolbox.load_toolset()

    model = ChatVertexAI(model="gemini-3-flash-preview")
    agent = create_react_agent(model, tools)

    prompt = "How's the weather today?"

    for s in agent.stream({"messages": [("user", prompt)]}, stream_mode="values"):
        message = s["messages"][-1]
        if isinstance(message, tuple):
            print(message)
        else:
            message.pretty_print()
```

## Usage

The toolbox-langchain package provids a dedicated integration to seamlessly load and use MCP Toolbox tools within the LangChain orchestration framework. For detailed guides and advanced configuration, please visit the following sections on our [Documentation Site](https://googleapis.github.io/genai-toolbox/sdks/python-sdk/langchain):

- [Transport Protocols](https://googleapis.github.io/genai-toolbox/sdks/python-sdk/langchain/#transport-protocols)
- [Loading Tools](https://googleapis.github.io/genai-toolbox/sdks/python-sdk/langchain/#loading-tools)
- [Use with Langchain](https://googleapis.github.io/genai-toolbox/sdks/python-sdk/langchain/#use-with-langchain)
- [Use with Langraph](https://googleapis.github.io/genai-toolbox/sdks/python-sdk/langchain/#use-with-langgraph)
- [Manual Usage](https://googleapis.github.io/genai-toolbox/sdks/python-sdk/langchain/#manual-usage)
- [Client to Server Authentication](https://googleapis.github.io/genai-toolbox/sdks/python-sdk/langchain/#client-to-server-authentication)
- [Authenticating Tools](https://googleapis.github.io/genai-toolbox/sdks/python-sdk/langchain/#authenticating-tools)
- [Binding Parameter Values](https://googleapis.github.io/genai-toolbox/sdks/python-sdk/langchain/#parameter-binding)
- [Asynchronous Usage](https://googleapis.github.io/genai-toolbox/sdks/python-sdk/langchain/#asynchronous-usage)
- [OpenTelemetry](https://googleapis.github.io/genai-toolbox/sdks/python-sdk/langchain/#opentelemetry)

# Contributing

Contributions are welcome! Please refer to the [`DEVELOPER.md`](https://github.com/googleapis/mcp-toolbox-sdk-python/blob/main/packages/toolbox-langchain/DEVELOPER.md) file for guidelines on how to set up a development environment and run tests.

# License

This project is licensed under the Apache License 2.0. See the
[LICENSE](https://github.com/googleapis/genai-toolbox/blob/main/LICENSE) file for details.

# Support

If you encounter issues or have questions, check the existing [GitHub Issues](https://github.com/googleapis/genai-toolbox/issues) for the main Toolbox project.
