Metadata-Version: 2.4
Name: demarche
Version: 0.2.0
Summary: Vendor-neutral identity verifier for AI agents
Project-URL: Homepage, https://demarche.ai
Project-URL: Documentation, https://demarche.ai
Project-URL: Repository, https://github.com/deeplethe/demarche
Project-URL: Issues, https://github.com/deeplethe/demarche/issues
Author: Deeplethe
License: Apache-2.0
Keywords: a2a,agent-identity,ai-agents,mcp,oauth,oauth-obo,verification
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: pyjwt[crypto]>=2.8
Provides-Extra: dev
Requires-Dist: fastapi>=0.115; extra == 'dev'
Requires-Dist: httpx>=0.27; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.115; extra == 'fastapi'
Description-Content-Type: text/markdown

# 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

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

## Quickstart

```python
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:

```python
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:

```python
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

```python
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/`](https://github.com/deeplethe/demarche/tree/main/examples/fastapi-app).

## Status

Pre-alpha — API surface is stabilising. See the project
[README](https://github.com/deeplethe/demarche) and
[spec](https://github.com/deeplethe/demarche/blob/main/spec/v0.1-architecture.md)
for full details.

## License

Apache 2.0.
