Skip to content

feat: add A2A tool for invoking remote agents at runtime#761

Merged
PopescuTudor merged 1 commit into
mainfrom
feature/a2a-tool
Apr 15, 2026
Merged

feat: add A2A tool for invoking remote agents at runtime#761
PopescuTudor merged 1 commit into
mainfrom
feature/a2a-tool

Conversation

@PopescuTudor
Copy link
Copy Markdown
Collaborator

@PopescuTudor PopescuTudor commented Apr 9, 2026

Adds an A2A LangChain tool that enables low-code agents to invoke Remote A2A agents at runtime. When an agent definition includes an A2A resource ($resourceType: "a2a"), the tool factory now creates an A2aTool that sends messages through the AgentHub A2A proxy.

Two conversation persistence modes are supported:

  • Graph state (advancedPersistance: true): task_id/context_id stored in LangGraph's tools_storage
  • LLM passthrough (default): IDs included in tool schema so the LLM tracks conversation continuity

Uses the a2a-sdk Python client for A2A protocol communication, with lazy auth via UiPath Bearer token.

Development Package

  • Use uipath pack --nolock to get the latest dev build from this PR (requires version range).
  • Add this package as a dependency in your pyproject.toml:
[project]
dependencies = [
  # Exact version:
  "uipath-langchain==0.9.25.dev1007614040",

  # Any version from PR
  "uipath-langchain>=0.9.25.dev1007610000,<0.9.25.dev1007620000"
]

[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true

[tool.uv.sources]
uipath-langchain = { index = "testpypi" }

[tool.uv]
override-dependencies = [
    "uipath-langchain>=0.9.25.dev1007610000,<0.9.25.dev1007620000",
]

@PopescuTudor PopescuTudor requested a review from radugheo April 9, 2026 08:34
@PopescuTudor PopescuTudor self-assigned this Apr 9, 2026
@PopescuTudor PopescuTudor force-pushed the feature/a2a-tool branch 2 times, most recently from 537fa6f to 133bad3 Compare April 9, 2026 09:01
Comment thread src/uipath_langchain/agent/tools/a2a/a2a_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/a2a/a2a_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/a2a/a2a_tool.py Outdated
@PopescuTudor PopescuTudor force-pushed the feature/a2a-tool branch 2 times, most recently from eae2235 to d52537e Compare April 9, 2026 14:48
@PopescuTudor PopescuTudor requested a review from radugheo April 9, 2026 14:49
@PopescuTudor PopescuTudor force-pushed the feature/a2a-tool branch 2 times, most recently from a7f7563 to b8c3dff Compare April 14, 2026 15:53
Comment thread src/uipath_langchain/agent/tools/a2a/a2a_tool.py Outdated
_client: Client | None = None
_http_client: httpx.AsyncClient | None = None

async def _ensure_client() -> Client:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The httpx.AsyncClient is never closed. We could add a context manager like open_mcp_tools (from the mcp tool) to handle cleanup.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Restructured following the MCP pattern:

  • Added A2aClient class wrapping the httpx client with a dispose() method
  • create_a2a_tools_and_clients() returns (tools, clients) like create_mcp_tools_and_clients
  • Added open_a2a_tools() async context manager for convenience
  • Removed A2A handling from tool_factory.py - now wired in build_agent_graph with the clients added to the disposables list, so the runtime closes them on teardown

Depends on companion PR in uipath-agents-python that wires create_a2a_tools_and_clients into build_agent_graph alongside MCP clients: https://github.com/UiPath/uipath-agents-python/pull/424. Must be merged after this one (and after bumping the uipath-langchain pin there).

Comment thread src/uipath_langchain/agent/tools/a2a/a2a_tool.py Outdated
@PopescuTudor PopescuTudor merged commit 71e583a into main Apr 15, 2026
45 checks passed
@PopescuTudor PopescuTudor deleted the feature/a2a-tool branch April 15, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants