Repository navigation
fix(langgraph): restore currency agent sample (Gemini model, LangChain 1.x, Frankfurter API) - #723
Open
naveenkarmegam wants to merge 3 commits into
Open
naveenkarmegam wants to merge 3 commits into
naveenkarmegam wants to merge 3 commits into
Conversation
api.frankfurter.app now responds with a 301 redirect to api.frankfurter.dev/v1. httpx does not follow redirects by default, so raise_for_status() failed and get_exchange_rate always returned an "API request failed" error. Point the tool and the README docs link at the new location.
gemini-2.0-flash has been retired and the Gemini API now returns
404 NOT_FOUND for it. Current Gemini models require thought signatures
on function calls, which langchain-google-genai 2.x does not send
("Function call is missing a thought_signature"), so move to
langchain-google-genai 3.x and the LangChain/LangGraph 1.x stack it
requires.
On LangGraph 1.x, create_react_agent's response_format makes an extra
model call that ends with a model turn, which Gemini rejects ("Requests
ending with a model turn are not supported"). Switch to
langchain.agents.create_agent with ToolStrategy(ResponseFormat) so the
structured response is returned as a tool call instead.
Also register ResponseFormat with the checkpoint serializer so restoring
it between turns does not trigger LangGraph's "unregistered type"
deserialization warning.
httpx defaults to a 5 second timeout, and a full request against the agent (model call, tool call, structured response) can take longer, which made test_client.py fail with A2AClientTimeoutError.
This branch has not been deployed
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.
Description
The LangGraph currency agent sample (
samples/python/agents/langgraph) currently fails on every request with a JSON-RPC-32603 Internal error. This PR fixes the three underlying causes described in #722. There is one commit per cause, plus a small test-client fix.Changes
fix(langgraph): use frankfurter.dev v1 endpointapi.frankfurter.appnow returns301toapi.frankfurter.dev/v1.httpxdoesn't follow redirects by default, so the tool always returnedAPI request failed. This commit updates the tool URL and the README docs link.fix(langgraph): upgrade to LangChain/LangGraph 1.x and gemini-3.8-flashgemini-2.0-flashhas been retired and returns404 NOT_FOUND. Switched togemini-3.8-flash.langchain-google-genai2.x doesn't send (400 Function call is missing a thought_signature). Bumpedlangchain-google-genai>=3.0.0,langgraph>=1.0.0andlangchain-openai>=1.0.0, addedlangchain>=1.0.0, and regenerateduv.lock.create_react_agent(..., response_format=...)makes an extra model call that ends on a model turn, and Gemini rejects it (400 Requests ending with a model turn are not supported). Replaced it withlangchain.agents.create_agent+ToolStrategy(ResponseFormat), which returns the structured response through a tool call.ResponseFormatwith the checkpointer'sJsonPlusSerializer. Without this, LangGraph 1.x warns that restoring it between turns "will be blocked in a future version", which would break multi-turn conversations.The model change and the dependency upgrade are in one commit because neither works without the other.
fix(langgraph): raise test client HTTP timeoutA full request (model → tool → structured response) can take more than
httpx's default 5 s, sotest_client.pyfailed withA2AClientTimeoutErroreven though the server succeeded. Raised the timeout to 60 s.Testing
Ran
uv run appandapp/test_client.pylocally (Windows 11, Python 3.12, a2a-sdk 0.3.0):message/send: "how much is 10 USD in INR?" →completedwith the converted amountinput-required→ "CAD" →completedmessage/stream:submitted→workingupdates → artifact →completedmodel_source=openaipath still builds the agent withlangchain-openai1.xruff check/ruff format: no new findings in changed lines (the file's pre-existing findings are unchanged)Out of scope
About 22 other Python samples still reference
gemini-2.0-flashand/orapi.frankfurter.appand are likely affected too. I've kept this PR to the LangGraph sample and can follow up separately.CONTRIBUTINGGuide.Fixes #722 🦕