Skip to main content

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


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.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_agent2agent-0.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file ai_agent2agent-0.1.0.tar.gz.

File metadata

  • Download URL: ai_agent2agent-0.1.0.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

Hashes for ai_agent2agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ce37daa0d879e566c19fc6ec88cdbaad292d40cda2ba336cb261b09bb34027cb
MD5 0bd0508523f2c278e8f664c08b6d3178
BLAKE2b-256 8140c43c607d7574fed4e26c9e24d1e87f3a3f4a7eff8aee3f7912a10d217aad

See more details on using hashes here.

File details

Details for the file ai_agent2agent-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ai_agent2agent-0.1.0-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

Hashes for ai_agent2agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38c4cd78be822df2d13eeb2b600fe99f64117f17460214ab2172ba868ba3c68b
MD5 2fdb90f12aba190498af31a4ebda3155
BLAKE2b-256 9e2a1aee83a7befc5d1e867f8cc592ef4f5fc09adbb82b296f33f5e52e734a6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page