docs(adapter): fix LangChain README example to use the tool's actual result keys - #934
Closed
feizhuzheng wants to merge 1 commit into
Closed
Conversation
…ool's actual result keys
feizhuzheng
requested review from
Alejandro-Morales,
Archento,
jrriehl,
lrahmani and
qati
as code owners
August 16, 2026 02:12
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The LangChain adapter quickstart in
python/uagents-adapter/README.mdends with:But
LangchainRegisterTool._run()returns theagent_infodict built insrc/uagents_adapter/langchain/tools.py, whose keys arename(L136),port(L138) andaddress(set at L154) — there is noagent_name,agent_addressoragent_portanywhere in that module. So copy-pasting the example and running it raisesKeyError: 'agent_name'on that final line, right after the agent successfully starts.Evidence this is a copy-paste slip, not the intended contract
The CrewAI adapter section has an identical-looking print line (
README.mda bit further down) that uses the sameagent_name/agent_address/agent_portkeys — and there it is correct, becauseCrewaiRegisterToolinsrc/uagents_adapter/crewai/tools.pyactually builds its result dict with thoseagent_*keys. The LangChain snippet was evidently adapted from the CrewAI one without updating the key names to matchLangchainRegisterTool's different return shape (name/address/port).Fix
Align the LangChain example with the keys that tool actually returns — a one-line, docs-only change to the LangChain print statement:
The CrewAI example is left untouched, since its keys are already right.
Alternative
If you would rather keep the two adapters' documented output identical, the other direction is to make
LangchainRegisterToolemitagent_name/agent_address/agent_porttoo, unifying both adapters' result contracts. I went with the minimal docs-side fix here since it is the safest and does not change any public return shape, but happy to switch to the code-side alignment if you prefer that.Verification
LangchainRegisterTool._runreturnsagent_info; its keys are set toname/port/addressinlangchain/tools.py, with noagent_*keys in the file.agent_*and matchescrewai/tools.py, which does define those keys — confirming the mismatch is isolated to the LangChain snippet.Thanks for uAgents!