[Python] cannot import name 'LangChainBridge' from 'python_a2a.langchain'

Discussão em 'Python' iniciado por Stack, Julho 18, 2025.

  1. Stack

    Stack Membro Participativo

    I am using python_a2a version 0.5.9 and I am trying to use integration of langchain with python_a2a but I am unable to import ToolServer, LangChainBridge or even AgentFlow

    I am referring to this document of Python A2A: https://python-a2a.readthedocs.io/en/latest/guides/langchain.html

    error:

    Python 3.12.0 (main, Oct 3 2023, 01:27:23) [Clang 17.0.1 ] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from langchain.tools import BaseTool
    >>> from python_a2a.langchain import AgentFlow
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: cannot import name 'AgentFlow' from 'python_a2a.langchain' (/home/jayant/Documents/project/venv/lib/python3.12/site-packages/python_a2a/langchain/__init__.py)
    >>> from python_a2a.langchain import ToolServer
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: cannot import name 'ToolServer' from 'python_a2a.langchain' (/home/jayant/Documents/project/venv/lib/python3.12/site-packages/python_a2a/langchain/__init__.py)
    >>> from python_a2a.langchain import LangChainBridge
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: cannot import name 'LangChainBridge' from 'python_a2a.langchain' (/home/jayant/Documents/project/venv/lib/python3.12/site-packages/python_a2a/langchain/__init__.py)
    >>> exit()

    Python 3.12.0 (main, Oct 3 2023, 01:27:23) [Clang 17.0.1 ] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from langchain.tools import BaseTool
    >>> from python_a2a.langchain import AgentFlow
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: cannot import name 'AgentFlow' from 'python_a2a.langchain' (/home/jayant/Documents/project/venv/lib/python3.12/site-packages/python_a2a/langchain/__init__.py)
    >>> from python_a2a.langchain import ToolServer
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: cannot import name 'ToolServer' from 'python_a2a.langchain' (/home/jayant/Documents/project/venv/lib/python3.12/site-packages/python_a2a/langchain/__init__.py)
    >>> from python_a2a.langchain import LangChainBridge
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: cannot import name 'LangChainBridge' from 'python_a2a.langchain' (/home/jayant/Documents/project/venv/lib/python3.12/site-packages/python_a2a/langchain/__init__.py)
    >>> exit()
    (venv) user@home:~/Documents/project$ python --version
    Python 3.12.0
    (venv) user@home:~/Documents/project$ uv pip freeze | grep python-a2a
    Using Python 3.12.0 environment at: venv
    python-a2a==0.5.9
    (venv) user@home:~/Documents/project$ pip freeze | grep langchain
    langchain==0.3.26
    langchain-anthropic==0.3.17
    langchain-core==0.3.69
    langchain-mcp-adapters==0.1.9
    langchain-ollama==0.3.5
    langchain-tavily==0.2.10
    langchain-text-splitters==0.3.8

    Continue reading...

Compartilhe esta Página