descope-agent-auth (Python)
Client-side SDK for custom-built agents. It signs your agent in to Descope and fetches the Connection or Resource tokens its tools need from the vault. It's the OAuth client side — not for building MCP servers (use the Descope MCP SDK for that), and it works with any framework via the tool wrapper.
Install
pip install descope-agent-auth
Quickstart (autonomous agent)
from descope_agent_auth import AgentAuthClient, ClientCredentialsProvider
from descope_agent_auth.errors import ConnectionAuthorizationRequired
client = AgentAuthClient(
project_id="P2abc...",
credential=ClientCredentialsProvider(
client_id="agent-client-id",
client_secret="agent-client-secret",
),
)
try:
github = client.connections.get_token(
connection="github",
identifier="user@example.com", # the user the agent acts for
# scopes=["repo"], # optional; overrides the Connection defaults
)
print(github.access_token)
except ConnectionAuthorizationRequired as e:
# Send the user to e.connect_url to complete OAuth consent, then retry.
print("connect first:", e.connect_url)
Sign-in providers
Pass one as credential=.
| Provider | When |
|---|---|
ClientCredentialsProvider |
autonomous agent, no user |
DeviceCodeProvider |
headless agent (no browser) |
CibaProvider |
out-of-band user approval (also backs the approval gate) |
JwtBearerProvider |
exchange a signed JWT from a trusted issuer (RFC 7523) |
AccessTokenProvider |
bring your own user access token (user-scoped access) |
ManagementKeyProvider |
privileged, not recommended (bypasses Policies; needs allow_management_key=True) |
For a user-scoped call on a shared client, pass act_as_user_token=<user jwt> to
connections.get_token / resources.get_token.
Scopes
Omit scopes → the Connection's configured defaults. Pass scopes → they fully
override the defaults (not clamped). The guardrail is Policies plus downstream
consent, not the scope list.
What's included
All sign-in providers, Connection and Resource token exchange, a pluggable token store
(persists and refreshes across restarts), a CIBA approval gate (require_approval), the
with_connection tool wrapper, and an MCP auth adapter
(descope_agent_auth.integrations.mcp). See the
quickstart and framework cookbook.
A few endpoint paths (device authorization, resource token-exchange parameters) live in
_endpoints.py, with comments to confirm against your project's OIDC discovery document.
Metadata
Release files for descope-agent-auth 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| descope_agent_auth-0.2.0.tar.gz | 228.5 kB | With provenance | Details for descope_agent_auth-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| descope_agent_auth-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for descope_agent_auth-0.2.0-py3-none-any.whl |
Total release size: 276.9 kB
Release files / descope_agent_auth-0.2.0.tar.gz
| Download URL | descope_agent_auth-0.2.0.tar.gz |
|---|---|
| Size | 228.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e2856fd070d00c653d7c9de7db5631745a914c6900ba0af217811ee3467ed8c8
|
|
BLAKE2b-256 checksum How to use checksums |
5f697cce72533dc0a53de1999dab15acac7f62980ea8ad6b60ac457e0fb8ac6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 25, 2026.
Transparency logRelease files / descope_agent_auth-0.2.0-py3-none-any.whl
| Download URL | descope_agent_auth-0.2.0-py3-none-any.whl |
|---|---|
| Size | 48.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9eb386a348a101baec76525ba3dcc53a9a854487d3dfe0599a76a086c14711ae
|
|
BLAKE2b-256 checksum How to use checksums |
56dbfe9018dcfb5d4b902c218c6531938f229061e71f29d890a1d9ded5a2a740
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 25, 2026.
Transparency logSecurity for descope-agent-auth 0.2.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for descope_agent_auth-0.2.0.tar.gz
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 Nov 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.