Skip to main content

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 to development to 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


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)

Uploaded Source

Built Distribution

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

rotagent-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

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

Hashes for rotagent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 389bdcf68d967fe0409ca769b1c80bf0bf46946432c9d50b391d11c3c76c7cdf
MD5 6d5a424c049e6288144ff1f35c55c670
BLAKE2b-256 57c8203c83d28b9643e26b5d698fb276ade95b1f06ec61df5d9a37915e910820

See more details on using hashes here.

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

Hashes for rotagent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c06177f434eea034188c5acfe46659582fda3941b923524d1d856a8e44d8e2c
MD5 8a36a148f955f052f8de555d5078f3a9
BLAKE2b-256 87060bb9804b4d9420c3aedea3f6af2ebc58737d85415fb42e44a05c550029bb

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