Agent-to-Secure Payload Authorization
A2SPA is the cryptographic firewall for AI agents, ensuring that every autonomous action is signed, verified, authorized, and monitored. Build secure agent-to-agent communication with enforced permissions, replay protection, and comprehensive audit trails.
A2SPA (Agent-to-Secure Payload Authorization) is a secure protocol that enables verified, cryptographically signed payloads between AI agents. This platform allows developers and non-technical users to create, manage, and monitor modular AI agents, all protected by A2SPA.
/register
/login
/forgot_password
Use the dashboard or POST /api/create_agent
to create
agents with configurable permissions:
{ "agent_name": "calendarAgent", "permissions": { "send": true, "receive": false }, "enabled": true }
Permission | Description |
---|---|
send |
Can initiate actions or payloads |
receive |
Can be a target agent and receive payloads |
🔐 Helps prevent abuse even if an agent is compromised.
Each payload must be:
{ "agent_id": "abc123_calendarAgent", "target_agent_id": "def456_reminderAgent", "timestamp": "2025-08-07T13:50:00Z", "nonce": "abc123xyz", "input": "Reschedule meeting to Monday 10am", "output": "OK, rescheduled", "hash": "SHA256(payload)" }
Sign the payload JSON (excluding hash and signature) using your private key and send both:
{ "payload": { ... }, "signature": "<hex_signature>" }
Send this to:
POST /api/verify_payload Headers: { x-api-key: YOUR_API_KEY }
import json import uuid from datetime import datetime, timezone from a2spa_sdk.signer import compute_payload_hash, sign_payload # Step 1: Create your raw payload (before hash/signature) raw_payload = { "agent_id": "abc123_calendarAgent", "target_agent_id": "abc456_meetingAgent", "timestamp": datetime.now(timezone.utc).isoformat(), "nonce": str(uuid.uuid4()), # Prevent replay attacks "input": "Reschedule call to Friday", "output": "OK, rescheduled to Friday" } # Step 2: Compute the hash raw_payload["hash"] = compute_payload_hash(raw_payload) # Step 3: Load private key and sign with open("myagent.priv.pem", "r") as f: private_key = f.read() signature = sign_payload(raw_payload, private_key)
/api/verify_payload
Method: POST
Content-Type: application/json
{ "agent_id": "abc123_agentName", "payload": {"text": "Summarize this"}, "signature": "...", "hash": "...", "nonce": "...", "reply_to": "optional_payload_id" }
Error | Cause |
---|---|
Invalid API key | Bad or missing key |
Signature verification failed | Payload not signed properly |
Payload hash mismatch | Modified payload or wrong hash |
Replay attack detected | Nonce already used |
Permission denied | Agent cannot send/receive |
Agent is toggled OFF | Agent not active |
Payload timestamp too old | Must be within 2 minutes |
Endpoint | Method | Description |
---|---|---|
/api/create_agent | POST | Create new agent |
/api/verify_payload | POST | Submit signed payload |
/api/delete_agent | POST | Remove agent |
/api/toggle_agent_status | POST | Toggle agent ON/OFF |
/api/agents | GET | List all agents |
/billing/topup | POST | Add tokens |
/api/logs | GET | Fetch last 50 logs |
/api/errors | GET | Fetch last 50 errors |
/api/roi_summary | GET | Daily ROI per agent |
/api/logs_csv | GET | Export logs to CSV |
/api/toggle_agent_status
Mistake | Fix |
---|---|
Reusing a nonce or timestamp | Use uuid4() and datetime.utcnow() |
Sending wrong agent_id | Match dashboard agent exactly |
Forgetting to hash the payload | Call compute_payload_hash() |
Signing before adding the hash | Always hash first, then sign |
Payload too old (>2 min) | Send immediately, use NTP-synced clocks |
Agent is toggled OFF | Go to dashboard and toggle it ON |
Term | What It Means | Why It Matters |
---|---|---|
Nonce | One-time string (UUID) | Stops replay attacks |
Hash | Fingerprint of the payload | Proves nothing changed |
Signature | Encrypted proof of identity | Proves you sent it |
API Key | Your agent's access ID | Tracks usage and billing |
The A2SPA dashboard provides comprehensive monitoring and management capabilities for your agents:
Each log entry contains:
Status | Balance | Indicator | API Access |
---|---|---|---|
Normal | >10 tokens | Green status | Full access |
Warning | <10 tokens | ⚠️ Yellow banner | Full access |
Critical | 0 tokens | 🔴 Red banner | API disabled |
A2SPA uses a simple, transparent pay-as-you-go model:
/billing/topup
Each agent can define its ROI profile to track value generation:
{ "roi": { "time_saved_minutes": 3, "value_usd": 0.08 } }
Default ROI fallback if not provided:
{ "time_saved_minutes": 2, "value_usd": 0.05 }
reply_to
field in payloads. Both agents
must be A2SPA-enabled for verification.