fix(a2a-adapter): add follow_redirects=True to httpx AsyncClient calls#868
Open
bleib1dj wants to merge 7 commits into
Open
fix(a2a-adapter): add follow_redirects=True to httpx AsyncClient calls#868bleib1dj wants to merge 7 commits into
bleib1dj wants to merge 7 commits into
Conversation
httpx.AsyncClient defaults follow_redirects to False, causing 308 Permanent Redirect responses from Agentverse and A2A endpoints to be returned as errors instead of followed. Affects agent discovery, health checks, message sending, and LLM routing.
Comment on lines
+543
to
553
| logger.info("successfully registered to Agentverse.") | ||
|
|
||
| # set agent as active | ||
| if agent_registration.active: | ||
| try: | ||
| logger.info("setting agent as active...") | ||
| _update_agent_status(True, identity) | ||
| logger.info("successfully set agent to active.") | ||
| except AgentverseRequestError as e: | ||
| logger.warning(f"failed to set agent as active. {str(e)}") | ||
| logger.info("setting agent as active...") | ||
| _update_agent_status(True, identity) | ||
| logger.info("successfully set agent to active.") | ||
|
|
||
| return True | ||
|
|
||
|
|
||
| def register_chat_agent( |
There was a problem hiding this comment.
Bug: The error handling in register_agent() and register_chat_agent() was changed, causing AgentverseRequestError to propagate instead of being silently handled. This is an undocumented breaking change.
Severity: HIGH
Suggested Fix
The breaking change should be explicitly documented in the pull request description and release notes to inform users of the new behavior. Alternatively, revert the change to maintain backward compatibility or introduce a new function for the new behavior. The change should not be bundled with an unrelated bug fix.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: python/uagents-core/uagents_core/utils/registration.py#L533-L553
Potential issue: The functions `register_agent()` and `register_chat_agent()` were
modified to no longer catch `AgentverseRequestError`. Previously, registration failures
were logged and the function returned `None`, allowing the calling application to
continue execution. With the new changes, if registration fails, the
`AgentverseRequestError` will propagate unhandled. This can crash any downstream
application that calls these functions without its own `try/except` block, as they may
not be prepared to handle this exception. This constitutes a breaking API change that
was not documented in the pull request description.
Did we get this right? 👍 / 👎 to inform future reviews.
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.
Summary
httpx.AsyncClientdefaultsfollow_redirectstoFalse, causing 308 Permanent Redirect responses from Agentverse and A2A endpoints to be returned as errors instead of being followed. This affects agent discovery, health checks, message sending, and LLM routing in the A2A outbound adapter.This is a companion fix to flockx-official/platform#11263, which addresses the same issue in the platform codebase.
Notable changes
a2a_outbound/adapter.py- 4httpx.AsyncClientinstantiations now includefollow_redirects=True:_send_to_a2a_agent(message sending)_discover_and_health_check_agents(agent card fetching)route_to_llm(LLM API routing)How tested
httpx.AsyncClientinstantiations in the adapterRisks / breaking changes
None. Adding
follow_redirects=Truemakes httpx behave likerequestsandaiohttpdo by default.