Observed since 20 Oct, 16:26 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
JSON-RPC implementation for the A2A (Agent-to-Agent) Protocol
A JSON-RPC implementation for the A2A (Agent-to-Agent) Protocol.
The a2a-json-rpc library provides a lightweight, transport-agnostic implementation of the JSON-RPC 2.0 protocol specifically tailored for A2A (Agent-to-Agent) communication. It includes:
pip install a2a-json-rpc
import asyncio
from a2a_json_rpc.protocol import JSONRPCProtocol
from a2a_json_rpc.models import Json
# Create a protocol instance
protocol = JSONRPCProtocol()
# Register a method handler
@protocol.method("echo")
async def echo_handler(method: str, params: Json) -> Json:
return params
# Process a request
async def main():
request = protocol.create_request("echo", {"message": "Hello, A2A!"})
response = await protocol._handle_raw_async(request)
print(response)
if __name__ == "__main__":
asyncio.run(main())
The library implements the latest A2A Protocol specification (2025), which defines a standard way for AI agents to communicate with each other. The implementation includes:
rejected and auth-requiredThe library provides a comprehensive set of error types:
from a2a_json_rpc.json_rpc_errors import ParseError, InvalidRequestError
from a2a_json_rpc.a2a_errors import (
TaskNotFoundError,
PushNotificationsNotSupportedError,
TaskRejectedError,
AuthenticationRequiredError
)
# JSON-RPC standard errors
raise ParseError("Invalid JSON payload")
raise InvalidRequestError("Missing required field")
# A2A-specific errors
raise TaskNotFoundError(data={"id": "task-123"})
raise PushNotificationsNotSupportedError()
raise TaskRejectedError("Task was rejected by the agent")
raise AuthenticationRequiredError("Authentication is required")
The transport layer is defined as a protocol interface, allowing for different implementations:
from a2a_json_rpc.transport import JSONRPCTransport
class MyTransport(JSONRPCTransport):
async def call(self, method: str, params: any) -> any:
# Implementation
...
async def notify(self, method: str, params: any) -> None:
# Implementation
...
def stream(self) -> AsyncIterator[Json]:
# Implementation
...
# Clone the repository
git clone https://github.com/yourusername/a2a-json-rpc.git
cd a2a-json-rpc
# Install development dependencies
make dev-install
make test
make build
make publish
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.4 | 6 Oct 2025 | 6 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 16:26 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:d2903917b7b50423e68add073abeb16482ece2f48c34ee400fc1cc09d690f3b1