Skip to main content

Phlow Auth Python

JWT authentication middleware for AI agents with Supabase integration.

Installation

pip install phlow-auth

Quick Start

from phlow_auth import PhlowMiddleware, PhlowConfig, AgentCard

# Configure your agent
config = PhlowConfig(
    supabase_url="https://your-project.supabase.co",
    supabase_anon_key="your-anon-key",
    agent_card=AgentCard(
        name="My Agent",
        description="AI assistant agent",
        service_url="https://my-agent.com",
        skills=["chat", "analysis"],
        metadata={"agent_id": "my-agent-id", "public_key": "your-public-key"}
    ),
    private_key="your-private-key"
)

# Initialize middleware
phlow = PhlowMiddleware(config)

# Use as decorator with FastAPI
from fastapi import FastAPI, Request

app = FastAPI()

@app.post("/api/chat")
@phlow.authenticate()
async def chat(request: Request):
    # Access agent context
    agent = request.phlow.agent
    supabase = request.phlow.supabase
    return {"message": f"Hello from {agent.name}"}

Features

  • JWT Authentication - Verify A2A Protocol JWT tokens
  • Agent Storage - Store and retrieve agent cards from Supabase
  • RLS Helpers - Generate basic Row Level Security policies
  • Event Logging - Track authentication events
  • Multi-Framework - Works with FastAPI, Flask, and Django

Development

# Clone the repository
git clone https://github.com/prassanna-ravishankar/phlow.git
cd phlow/packages/phlow-auth-python

# Install development dependencies
uv sync --extra dev

# Run tests
uv run pytest

# Format code
uv run black src tests
uv run isort src tests

# Type checking
uv run mypy src

Documentation

License

MIT License - see LICENSE file for details.

Metadata

Release files for phlow-auth 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phlow-auth 0.0.5
File Size Uploaded
phlow_auth-0.0.5.tar.gz 10.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for phlow-auth 0.0.5
File Interpreter ABI Platform
phlow_auth-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 23.6 kB

Release files / phlow_auth-0.0.5.tar.gz

Download URL phlow_auth-0.0.5.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e5eacc17b2b2183106bca0a1829215870c1942dbb5cfebe5c562715146ec5604
BLAKE2b-256 checksum
How to use checksums
d1085ded9b9ff53cc2a0d3b85ef1f928467cba45d54a7b8ec5adeed9c53d1e28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release files / phlow_auth-0.0.5-py3-none-any.whl

Download URL phlow_auth-0.0.5-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3aa4def66a491c8272d6f6f39b5b0a3c8e33e56777828612f7242ebc22f3e870
BLAKE2b-256 checksum
How to use checksums
9362b97800d061132bfb83361dd949e5a1f989839139887e901331f89801732b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page