Catalog PyPI
PACKAGE EXPLORERView in registry

a2a-protocol

PyPI

Agent to Agent Protocol Specification Python models

Versions collected1
Direct dependencies2From release 0.1.0
Last observed20 Oct, 16:28 UTC

README

Version 0.1.0 documentation

A2A Protocol

Python models for Google's Agent-to-Agent (A2A) Protocol specification. This package provides both Pydantic and dataclass model implementations, enabling type-safe communication between agents.

Maintained by the team at Legion AI.

Installation

pip install a2a-protocol

Usage

Pydantic v2 Implementation

from a2a_protocol.pydantic_v2 import Message, Part, TextPart, Role

# Create a simple message
message = Message(
    role=Role.user,
    parts=[
        Part(root=TextPart(
            type="text",
            text="Hello, agent!",
            metadata={"source": "user_interface"}
        ))
    ],
    metadata={"session_id": "12345"}
)

Dataclass Implementation

from a2a_protocol.dataclass import Message, TextPart, Role

# Create a simple message using dataclasses
message = Message(
    role=Role.user,
    parts=[
        TextPart(
            type="text",
            text="Hello, agent!",
            metadata={"source": "user_interface"}
        )
    ],
    metadata={"session_id": "12345"}
)

Core Components

Message Types

  • TextPart: For text-based messages
  • FilePart: For file attachments
  • DataPart: For structured data

Task Management

  • Task: Represents a task with its status, history, and artifacts
  • TaskStatus: Current state of a task (working, completed, failed, etc.)
  • TaskState: Enum of possible task states

JSON-RPC Communication

  • JSONRPCRequest: Standard request format
  • JSONRPCResponse: Standard response format
  • SendTaskRequest, GetTaskRequest, CancelTaskRequest: Specific request types

Protocol Workflow

┌──────────────┐            ┌──────────────┐
│              │            │              │
│   Agent A    │◄──────────►│   Agent B    │
│              │    A2A     │              │
└──────────────┘  Protocol  └──────────────┘
       │                            ▲
       │                            │
       │         ┌──────────┐       │
       └────────►│  Tasks   │◄──────┘
                 │          │
                 └──────────┘

Features

  • Full type-checked implementation of the A2A protocol
  • Both Pydantic v2 and dataclass implementations
  • Complete support for:
    • Task creation and management
    • Messaging between agents
    • File and data transfer
    • Status updates and notifications
    • Error handling

Protocol Structure

The A2A protocol enables agents to:

  1. Create and manage tasks
  2. Send and receive messages
  3. Share structured data and files
  4. Monitor task status and progress
  5. Handle errors and notifications

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.017 Apr 20252

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
theralabs/legion-a2a

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 16:28 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:5d46adee7a6bffd7a80b348d439a17fc7d77fcc97eb535c44c2a114434800e1c