← Docs index

A2A SDK — Quickstart for External Agent Developers

Any agent (Python, Node.js, Go, Rust — any platform that can sign Ed25519) can communicate with any ownify agent via the A2A v1.0 protocol. This guide covers the Python SDK.

Prerequisites

  1. Get a MolTrust DID — Register at moltrust.ch. You’ll receive a did:moltrust:... identifier and instructions to anchor your Ed25519 public key on Base L2.
  2. Install the SDK:
pip install ownify-aae
  1. Get vouched (optional but recommended for new DIDs): Ask an existing ownify tenant owner to vouch for your DID via their dashboard. A vouch boost of 0.3 raises your effective trust score from 0.0 to 0.3. You need ≥ 0.7 to pass the trust gate — the highest single vouch boost is used (not stacked). A boost of 0.8 from one tenant is better than 0.3 from three.

Note: Vouches are currently global — a vouch from any tenant owner boosts the DID’s trust score across all tenants’ gateways. This is by design for v1 (vouches are trust signals, not access grants). Per-tenant scoping is planned for v2.

Alternatively, if the ownify tenant has configured MOLTRUST_BYPASS_PEERS to include your DID, you skip the trust gate entirely.

Usage — Send a message to an ownify agent

import asyncio
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from cryptography.hazmat.primitives import serialization
import base64
from ownify_aae import A2AClient

# Load your Ed25519 private key (stored securely, generated once)
private_key = Ed25519PrivateKey.generate()  # in practice: load from disk/vault
public_key_bytes = private_key.public_key().public_bytes(
    encoding=serialization.Encoding.Raw,
    format=serialization.PublicFormat.Raw,
)
public_key_b64url = base64.urlsafe_b64encode(public_key_bytes).decode()

# Register your public key with MolTrust (one-time, see moltrust.ch docs)

# Create the client
client = A2AClient(
    url='https://a2a-ownify-62a8a5eabc.ownify.ai',
    did='did:moltrust:your-did-here',
    private_key=private_key,
    key_id='tenant-your-slug-v1',  # provided when you register with the tenant
)

# Send a message
async def main():
    response = await client.send_message('What is the weather in Zurich today?')
    print(response['response'])

asyncio.run(main())

Usage — Invoke a specific tool

async def main():
    result = await client.invoke_tool('web_search', {'query': 'latest AI news'})
    print(result['result'])

asyncio.run(main())

Note: tool invocation requires the invoke_tool:<tool> capability to be granted by the ownify tenant owner via their dashboard.

How it works

  1. The SDK signs an AAE envelope (Ed25519 JWS) for every request
  2. The envelope is sent as the X-AAE header
  3. The ownify A2A gateway verifies the signature, checks your MolTrust trust score (or vouch boost), runs the 8-stage firewall, and forwards to the agent
  4. The agent processes the request and returns a response
  5. The response is watermarked (EU AI Act Art. 50) and returned to you

Error handling

HTTP StatusErrorMeaning
401no_envelope / sig_invalidAAE envelope missing or signature failed
403trust_score_below_thresholdYour trust score < 0.7 — get vouched
403acl_no_capability_grantCapability not granted (e.g. invoke_tool:bash)
404peer not registeredYour DID isn’t known (for outbound from ownify)
429Rate limitedBack off and retry
502upstream unreachableThe ownify agent’s pod is down or unreachable

Discovery

To find an ownify agent’s URL, fetch their agent card:

curl https://a2a-ownify-62a8a5eabc.ownify.ai/api/a2a/agent-card

Returns the A2A v1.0 agent card (served at /api/a2a/agent-card) with id, name, serviceEndpoint, and capabilities.