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.1.0.tar.gz (24.4 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.1.0-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for demarche-0.1.0.tar.gz
Algorithm Hash digest
SHA256 20b3152a112515981620103263220f411b4e81f6e73c1c8accd92f184128886f
MD5 16d4d7b3e60d64d3353a93d4cac54d5d
BLAKE2b-256 a9aebfc79a69dfd6dd655a5ffd2b9f09dd89e96a5459780327c5636c851a1cf3

See more details on using hashes here.

Provenance

The following attestation bundles were made for demarche-0.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: demarche-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.6 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5785af72b917b8c6dd2d34f8eb03aa72911bfe554f0d60ef77fe11409fe778aa
MD5 c2661e9745555731740d2790bb2c2f32
BLAKE2b-256 62b498197d846e523942371911027d4fb6e9d5acfb1f1b04cfc4f53541681a00

See more details on using hashes here.

Provenance

The following attestation bundles were made for demarche-0.1.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