Skip to main content

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.

Metadata

Release files for demarche 0.2.0

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

Source distribution (sdist)

Source distribution for demarche 0.2.0
File Size Uploaded
demarche-0.2.0.tar.gz 32.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for demarche 0.2.0
File Interpreter ABI Platform
demarche-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 57.1 kB

Release files / demarche-0.2.0.tar.gz

Download URL demarche-0.2.0.tar.gz
Size 32.2 kB
Tags Source
SHA-256 checksum
How to use checksums
498cbf59ebf388c9a07bb074f8f2f3157683eb0d82ef1972ced70fcd88ca27d1
BLAKE2b-256 checksum
How to use checksums
3b6f1a5401e855e4ed7c11bc99795fabdaff86983b02f5719a1445630595ab9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 18, 2026.

Transparency log

Release files / demarche-0.2.0-py3-none-any.whl

Download URL demarche-0.2.0-py3-none-any.whl
Size 24.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91932168c6e1a9d3be10257341bb43cb99f744cbde52cbe189315cc68d50bc50
BLAKE2b-256 checksum
How to use checksums
4f6e90e022f3e006a0f49626b70c344470e6bcb089ff500dbf9e1713b52241d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

0.0.0

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