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.0.0.tar.gz (22.8 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.0.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for demarche-0.0.0.tar.gz
Algorithm Hash digest
SHA256 74c6f330e1882f3c5f04aa732e9ab317b16a0155db1c86e8164c4947005007e6
MD5 0118f57affd5cd32b2ff13cd4f7c00e1
BLAKE2b-256 9115b8dafb298b6d854994c6fd5a7fd295f389d3394adcc18695928da217e85d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: demarche-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 18.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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa7a5b6a60026e5dc224d36383c278d7d835cc3d715fa8fb6c9ed06ffb35642a
MD5 c8aa98556dfbf64b0c0440d6c67602f5
BLAKE2b-256 5aa74dccd93af548ebe5de7d06a3307ba632e12022c6d64495f804df2a835a39

See more details on using hashes here.

Provenance

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