Metadata-Version: 2.4
Name: agentity-a2a
Version: 0.1.1
Summary: Agentity A2A protocol plugin for Google
License: Apache-2.0
Project-URL: Homepage, https://github.com/agenttity/agentity
Project-URL: Source, https://github.com/agenttity/agentity
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: agentity-sdk-python>=0.1
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"

# agentity-a2a

**A2A (Agent-to-Agent) protocol plugin for Agentity.**
Sign and verify inter-agent communication using the Agentity identity layer — enabling scoped, auditable agent-to-agent requests.

## Installation

```bash
pip install agentity-a2a
```

## Usage

```python
import asyncio
from agentity_a2a import A2AClient

async def main():
    # Create an A2A client with Agentity identity
    client = A2AClient()

    print(f"Agent DID: {client.agent_did}")
    print(f"Scopes: {client.agent_scope}")

    # Send a signed A2A request
    result = await client.send_request(
        url="https://api.agent-service.com/agent/message",
        method="POST",
        body=b'{"type": "task", "payload": "..."}',
    )
    print(f"Status: {result['status']}")
    print(f"Body: {result['body']}")

asyncio.run(main())
```

### Custom keypair and identity

```python
from agentity_sdk import AgentKeyPair
from agentity_a2a import A2AClient

kp = AgentKeyPair()
aid = kp.create_identity(
    owner_did="did:agentity:human:alice",
    scopes=["a2a:agent:send", "a2a:message:receive"],
    ttl_days=30,
)

client = A2AClient(keypair=kp, identity=aid)
```

## Default scopes

When no identity is provided, `A2AClient` auto-creates one with scopes:
- `a2a:agent:send`
- `a2a:message:receive`

## API

| Method / Property | Description |
|---|---|
| `A2AClient(keypair?, identity?)` | Create client, auto-generates identity if omitted |
| `async send_request(url, method, body?)` | Send signed A2A HTTP request |
| `.agent_did` | The agent's DID string |
| `.agent_scope` | The agent's scope list |

License: Apache 2.0
