{"id":27903,"library":"langchain-protocol","title":"LangChain Agent Protocol Python Bindings","description":"Python client bindings for the LangChain agent streaming protocol. Provides a client to interact with remote agents following the protocol specification. Version 0.0.15 supports Python >=3.10, <4.0. New releases are frequent (multiple per month) with backward-incompatible changes expected.","status":"active","version":"0.0.15","language":"python","source_language":"en","source_url":"https://github.com/langchain-ai/agent-protocol","tags":["langchain","agent-protocol","streaming","client","protocol"],"install":[{"cmd":"pip install langchain-protocol","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Package uses underscore, not dot notation","wrong":"from langchain.protocol import Client","symbol":"Client","correct":"from langchain_protocol import Client"},{"note":"Class is named Client, not LangChainClient","wrong":"from langchain_protocol import LangChainClient","symbol":"LangChainClient","correct":"from langchain_protocol import Client"},{"note":"AsyncClient is re-exported from top-level package","wrong":"from langchain_protocol.async_client import AsyncClient","symbol":"AsyncClient","correct":"from langchain_protocol import AsyncClient"}],"quickstart":{"code":"import os\nfrom langchain_protocol import Client\n\nclient = Client(\n    url=os.environ.get(\"PROTOCOL_URL\", \"http://localhost:8000\"),\n    headers={\"Authorization\": f\"Bearer {os.environ.get('PROTOCOL_API_KEY', '')}\"}\n)\n\n# List available agents\nagents = client.agents.search()\nprint(agents)\n\n# Create a thread and run\nthread = client.threads.create()\nrun = client.runs.create(\n    thread_id=thread[\"thread_id\"],\n    agent_id=agents[0][\"agent_id\"],\n    input={\"messages\": [{\"role\": \"user\", \"content\": \"Hello\"}]}\n)\nprint(run)\n\n# Stream results\nfor event in client.runs.stream(thread[\"thread_id\"], run[\"run_id\"]):\n    print(event)","lang":"python","description":"Creates a client and performs a simple agent interaction."},"warnings":[{"fix":"Use client = Client(url='...')","message":"The Client constructor expects a 'url' argument (not 'base_url'). Using 'base_url' may silently fall back to default.","severity":"gotcha","affected_versions":"all"},{"fix":"Always pin a specific version and consult the changelog before upgrading.","message":"The package version follows the protocol spec versioning, not semantic versioning. Minor increments (0.1.x -> 0.2.0) may include breaking API changes.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Use client.runs.create() without thread_id argument for stateless runs, or pass thread_id as argument.","message":"The 'runs.create' endpoint moved from /threads/{tid}/runs to /runs in version 0.2.0. Old path is deprecated.","severity":"deprecated","affected_versions":">=0.2.0"},{"fix":"Explicitly pass headers={'Authorization': 'Bearer <token>'} on client creation.","message":"Authentication headers must be passed as dict to the Client constructor. The library does not read environment variables automatically.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use 'from langchain_protocol import Client'","cause":"Incorrect import path; the package is 'langchain-protocol' but the module is 'langchain_protocol'.","error":"ModuleNotFoundError: No module named 'langchain.protocol'"},{"fix":"Use Client(url='http://...') instead of Client(base_url='http://...')","cause":"Client constructor uses 'url' not 'base_url'. Common mistake from other HTTP clients.","error":"TypeError: Client.__init__() got an unexpected keyword argument 'base_url'"},{"fix":"Check the response object keys (e.g., 'id' instead of 'run_id' in some versions) and pin the protocol version.","cause":"The response schema changed between versions. For example, runs.wait() may return a different structure.","error":"KeyError: 'run_id'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}