cannot import name 'LangChainBridge' from 'python_a2a.langchain'

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
Answer
StepAction
1 Run print(dir(python_a2a.langchain)) to see what's actually there
2 Check the _init_.py to confirm available exports
3 Review the official docs or GitHub for changes
4 Try downgrading the python-a2a package if needed
Enjoyed this question?
Check out more content on our blog or follow us on social media.
Browse more questions