A Python library for Agent-to-Agent communication
Project description
AI Agent2Agent
A Python library for Agent-to-Agent communication.
Installation
pip install ai_agent2agent
Usage
Client
from agent2agent import A2AClient, A2ACardResolver
# Initialize client
client = A2AClient(url="https://your-agent-endpoint.com", api_key="your-api-key")
# Example: Send a task to an agent
response = client.send_task(
message={
"role": "user",
"parts": [{"type": "text", "text": "Hello, Agent!"}]
}
)
# Print the task ID
print(f"Task ID: {response.id}")
Server
from agent2agent import A2AServer, InMemoryTaskManager
# Initialize server with an in-memory task manager
task_manager = InMemoryTaskManager()
server = A2AServer(task_manager=task_manager)
# Register handler for tasks
@server.handle_task
async def handle_task(task):
# Process the task
return {
"role": "agent",
"parts": [{"type": "text", "text": "Task completed!"}]
}
# Run the server (depends on your web framework)
Features
- Client-server architecture for agent communication
- Support for various message types (text, files, data)
- Task management with different states
- In-memory caching
- Push notification support
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ai_agent2agent-0.1.1.tar.gz
(12.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_agent2agent-0.1.1.tar.gz.
File metadata
- Download URL: ai_agent2agent-0.1.1.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71f049b58a382a08b11a0cb201b5d71c546abf84eef24a875f7a21f96e6c5d4a
|
|
| MD5 |
4c429c29196f4a80ac4e8cb4c00c2e63
|
|
| BLAKE2b-256 |
057f03d742e3f00409c86d4fc9d061871983c4c93635741b4ef86051b07a5bb4
|
File details
Details for the file ai_agent2agent-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ai_agent2agent-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70c52c2b3f89cfd02e97b20e0c1ee69266e989ecf7051f5b6b97050ad5295dff
|
|
| MD5 |
0b07c156271d15d5a43c6d8927bc6271
|
|
| BLAKE2b-256 |
ad6f667d6f2016509639c31ff4d0e994dce6964e979d27499657aff12ea3a84e
|