Skip to main content

Vendor-neutral identity verifier for AI agents

Project description

demarche (Python)

Vendor-neutral identity verification for AI agents.

Demarche sits between your application and agent-identity issuers (Microsoft Entra Agent ID, Auth0 for AI Agents, any OAuth OBO issuer). Integrate once, verify agents from any issuer.

Install

pip install demarche                    # core + OAuth OBO + Entra/Auth0
pip install 'demarche[fastapi]'         # + FastAPI integration

Quickstart

from demarche import Verifier, entra_agent_id

verifier = Verifier(adapters=[
    entra_agent_id(
        tenant_id="<your-azure-tenant-id>",
        audience="api://your-app",
    ),
])

result = await verifier.verify(token)
result.principal_id  # the user who delegated authority
result.agent_id      # the agent acting on the user's behalf
result.scopes        # what the agent is authorized to do
result.audit_id      # opaque ID for log correlation

For Auth0:

from demarche import Verifier, auth0_ai_agents

verifier = Verifier(adapters=[
    auth0_ai_agents(
        domain="myapp.us.auth0.com",
        audience="https://api.myapp.com",
    ),
])

For any other OAuth OBO issuer:

from demarche import Verifier, OAuthOBOAdapter, JWKSKeyProvider

verifier = Verifier(adapters=[
    OAuthOBOAdapter(
        issuer="https://your-issuer.example/",
        audience="https://your-api.example",
        key_provider=JWKSKeyProvider(
            "https://your-issuer.example/.well-known/jwks.json"
        ),
    ),
])

FastAPI integration

from demarche.fastapi import DemarcheAuth

auth = DemarcheAuth(verifier)


@app.get("/whoami")
async def whoami(
    agent: Annotated[VerificationResult, Depends(auth.require_agent)],
):
    return {"user": agent.principal_id, "agent": agent.agent_id}


@app.post("/book-meeting")
async def book_meeting(
    agent: Annotated[
        VerificationResult,
        Depends(auth.require_scope("calendar.write")),
    ],
):
    return {"booked_by": agent.principal_id}

A complete runnable example lives at examples/fastapi-app/.

Status

Pre-alpha — API surface is stabilising. See the project README and spec for full details.

License

Apache 2.0.

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

demarche-0.2.0.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

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

demarche-0.2.0-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file demarche-0.2.0.tar.gz.

File metadata

  • Download URL: demarche-0.2.0.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for demarche-0.2.0.tar.gz
Algorithm Hash digest
SHA256 498cbf59ebf388c9a07bb074f8f2f3157683eb0d82ef1972ced70fcd88ca27d1
MD5 8e9680cefa2d5dc1aa42f7f22e5ed596
BLAKE2b-256 3b6f1a5401e855e4ed7c11bc99795fabdaff86983b02f5719a1445630595ab9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for demarche-0.2.0.tar.gz:

Publisher: publish.yml on deeplethe/demarche

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file demarche-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: demarche-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for demarche-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 91932168c6e1a9d3be10257341bb43cb99f744cbde52cbe189315cc68d50bc50
MD5 86197c00b1f66ccd49ca8066490bd2f2
BLAKE2b-256 4f6e90e022f3e006a0f49626b70c344470e6bcb089ff500dbf9e1713b52241d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for demarche-0.2.0-py3-none-any.whl:

Publisher: publish.yml on deeplethe/demarche

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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