Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.1.5 instead.

llama-index-tools-a2a

PyPI version License: MIT Python Support

A2A (Agent-to-Agent) Protocol integration for LlamaIndex

Enable your LlamaIndex agents to discover and invoke other A2A-compatible agents as tools. Implements Google's A2A protocol specification for universal agent interoperability.

Features

  • Outbound Client: Connect to any A2A agent via its AgentCard URL
  • Skill Discovery: Automatically discover available tools/skills from remote agents
  • Schema Conversion: Maps A2A skill schemas to LlamaIndex FunctionTools
  • Inbound Server: Expose any LlamaIndex Workflow as an A2A-capable agent
  • Async Support: Full async/await support for non-blocking operation
  • Partial Params: Support for pre-filling common parameters across tools

Installation

pip install llama-index-tools-a2a

Or with uv:

uv add llama-index-tools-a2a

With dev dependencies:

pip install "llama-index-tools-a2a[dev]"

Quick Start

Discovering Tools from an A2A Agent

from llama_index.tools.a2a import aget_tools_from_a2a_card

# Connect to a remote A2A agent and get its tools
tools = await aget_tools_from_a2a_card(
    "https://weather-agent.example.com/.well-known/agent-card.json"
)

# Use tools in your LlamaIndex workflow
from llama_index.core.agent import ReActAgent

agent = ReActAgent.from_tools(tools)
result = await agent.chat("What's the weather in Tokyo?")

Filtering Specific Tools

# Only use specific skills
tools = await aget_tools_from_a2a_card(
    "https://agent.example.com/.well-known/agent-card.json",
    allowed_tools=["search_web", "calculate"]
)

Pre-filling Common Parameters

# Apply default parameters across all tools
tools = await aget_tools_from_a2a_card(
    "https://agent.example.com/.well-known/agent-card.json",
    global_partial_params={"api_key": "my-secret-key"}
)

Exposing a Workflow as an A2A Agent (Inbound)

from llama_index.core.workflow import Workflow, StartEvent, StopEvent, step
from llama_index.tools.a2a import workflow_as_a2a

class MyStartEvent(StartEvent):
    query: str

class MyWorkflow(Workflow):
    @step
    async def run(self, start_event: MyStartEvent) -> StopEvent:
        return StopEvent(result=f"Processed: {start_event.query}")

# Create the A2A-compatible FastAPI app
app = workflow_as_a2a(MyWorkflow())

# Run with uvicorn: uvicorn my_module:app --host 0.0.0.0 --port 8000
# The agent will be discoverable at http://localhost:8000/.well-known/agent-card.json

Architecture

This integration mirrors the existing llama-index-tools-mcp pattern:

Concept MCP Equivalent A2A Implementation
Tool discovery list_tools() AgentCard.skills[]
Tool invocation call_tool(name, args) message/send + tasks/get
Inbound server MCPServer ASGI app (workflow_as_a2a())
Workflow wrapping workflow_as_mcp() workflow_as_a2a()

Usage Examples

See examples/a2a.ipynb for a full end-to-end Jupyter notebook demonstrating:

  • Creating an inbound A2A agent with workflow_as_a2a()
  • Connecting as an outbound client via BasicA2AClient
  • Converting skills to LlamaIndex FunctionTools with A2AToolSpec
  • Using A2A tools inside a LlamaIndex ReActAgent
  • Filtering skills and pre-filling partial parameters

Run the example server standalone:

python examples/a2a_server.py --port 8000
# Then visit http://localhost:8000/.well-known/agent-card.json

Project Status

  • Milestone 1: Package scaffolded ✅
  • Milestone 2: Outbound client with AgentCard discovery ✅
  • Milestone 3: Inbound ASGI server (workflow_as_a2a()) ✅
  • Milestone 4: Integration tests (13 tests passing) ✅
  • Milestone 5: Documentation & cookbook ✅

API Reference

Outbound Client

  • BasicA2AClient(agent_card_url) — Connect to an A2A agent
    • get_agent_card() — Discover agent metadata
    • list_skills() — List available skills
    • call_skill(name, arguments) — Invoke a skill
    • send_message(message) — Send natural language message

Tool Conversion

  • A2AToolSpec(client) — Convert A2A skills to LlamaIndex FunctionTools
  • aget_tools_from_a2a_card(url) — Async convenience function
  • get_tools_from_a2a_card(url) — Sync convenience function

Inbound Server

  • workflow_as_a2a(workflow) — Expose a Workflow as an A2A agent
  • create_agent_card(workflow) — Create AgentCard from a Workflow

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details.

This project was initially developed as a contribution to the LlamaIndex ecosystem under issue #24104 in collaboration with the Google A2A team, and is now maintained as a standalone package per LlamaIndex's integration policy.

License

MIT License - see LICENSE file for details.

Acknowledgments

  • Google A2A Team for protocol design and mentorship
  • LlamaIndex community for the MCP integration pattern this builds upon

Metadata

Release files for llama-index-tools-a2a 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-tools-a2a 0.1.0
File Size Uploaded Provenance Actions
llama_index_tools_a2a-0.1.0.tar.gz 21.3 kB Without provenance Details for llama_index_tools_a2a-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-tools-a2a 0.1.0
File Interpreter ABI Platform Actions
llama_index_tools_a2a-0.1.0-py3-none-any.whl Python 3 none any Details for llama_index_tools_a2a-0.1.0-py3-none-any.whl

Total release size: 37.9 kB

Release files / llama_index_tools_a2a-0.1.0.tar.gz

Download URL llama_index_tools_a2a-0.1.0.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4f010b5f215af9f964e222db78c35d08cf83d8e54db81334aa74cd3fa88c61bb
BLAKE2b-256 checksum
How to use checksums
cbf8a48b256ccbc642e263a366ab90c8130afa4ae6807779a57e917b82888f8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / llama_index_tools_a2a-0.1.0-py3-none-any.whl

Download URL llama_index_tools_a2a-0.1.0-py3-none-any.whl
Size 16.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
537aa8aa501c8a3a737935e160bae024c2929ff13ec2eb67888791903d8f4b77
BLAKE2b-256 checksum
How to use checksums
dbad7d75a70e9987bbf327b518a4fe2f66b11b9d954115335f92b485e0943c86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for llama-index-tools-a2a 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page