Agent authentication and orchestrator client utilities for secure multi-agent communication
Project description
rotagent
A Python library for secure agent-orchestrator communication using JWT-based authentication with RSA keypairs.
Features
- 🔐 AgentAuth: Flask decorator for securing agent endpoints with JWT verification
- 📡 OrchestratorClient: Async client for sending signed requests to agents
- 🔑 KeyManager: RSA keypair generation and public key loading
- 🛠️ DevTools: Development utilities for key setup and token generation
Installation
pip install rotagent
Quick Start
Agent Side (Flask Application)
from flask import Flask, request, jsonify
from rotagent import AgentAuth
app = Flask(__name__)
auth = AgentAuth(keys_dir="./authorized_keys")
@app.route("/agent", methods=["POST"])
@auth.require_auth
def agent_endpoint():
data = request.get_json()
# Your agent logic here
return jsonify({"response": "Hello from agent!"})
Orchestrator Side
import aiohttp
from rotagent import OrchestratorClient
async def call_agent():
async with aiohttp.ClientSession() as session:
response = await OrchestratorClient.send_secure_request(
session=session,
url="http://agent-url.com",
payload={"query": "What movies are playing?"},
issuer_id="my_orchestrator",
private_key_pem=private_key_pem # Your RSA private key
)
return response
Development Setup
Generate development keys for testing:
from rotagent import DevTools
# Generate keys - saves public key to disk, prints private key for .env
DevTools.setup_persistent_keys(keys_dir="authorized_keys", issuer_id="dev_postman")
# Generate a test token for Postman/curl testing
token, body = DevTools.generate_bearer_token(query="test query")
Environment Variables
APP_ENV: Set todevelopmentto disable security checks (replay protection, body hash verification)
Security Features
- JWT-based authentication with RS256 signing
- Replay attack protection with JTI (JWT ID) tracking
- Body tampering detection via SHA256 content hashing
- Hot-reload of public keys (no restart needed when adding new orchestrators)
License
MIT License
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
rotagent-0.1.0.tar.gz
(7.3 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 rotagent-0.1.0.tar.gz.
File metadata
- Download URL: rotagent-0.1.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
389bdcf68d967fe0409ca769b1c80bf0bf46946432c9d50b391d11c3c76c7cdf
|
|
| MD5 |
6d5a424c049e6288144ff1f35c55c670
|
|
| BLAKE2b-256 |
57c8203c83d28b9643e26b5d698fb276ade95b1f06ec61df5d9a37915e910820
|
File details
Details for the file rotagent-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rotagent-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c06177f434eea034188c5acfe46659582fda3941b923524d1d856a8e44d8e2c
|
|
| MD5 |
8a36a148f955f052f8de555d5078f3a9
|
|
| BLAKE2b-256 |
87060bb9804b4d9420c3aedea3f6af2ebc58737d85415fb42e44a05c550029bb
|