Before you start
- A MudraID account, with an agent registered (step 1 below).
- Python 3.10 or newer.
- An existing piece of code that makes HTTP calls with
requests— or a willingness to write three lines.
1. Register an agent
Sign in to the MudraID portal, create an agent, and grant it the platforms and scopes it needs. (You can also do this through the API.) You’ll receive two values, once:MUDRAID_API_KEY_ID— the agent’s public identifier. Safe to log.MUDRAID_SECRET— the private credential. Treat it like a password; never log it.
2. Add the credentials to .env
.env to your .gitignore so the secret never lands in version control. The SDK loads this file on its own — you don’t have to read it yourself.
3. Install the SDK
During the v0.1 alpha the package isn’t on PyPI yet. Install from source:
pip install -e sdks/mudraid-sdk-python from the repo root.4. Swap requests for Agent
The SDK is a drop-in replacement for requests. Change the client, keep everything else.
Agent mirrors the requests interface — get, post, put, delete, and the usual keyword arguments (params, json, headers, timeout, …) all work, and you get back a normal requests.Response.
Verify it works
Make a call to a platform your agent is registered with and check the status:200 (or the platform’s normal response) means the trust loop ran end to end: your agent authenticated, the platform verified it, and the call went through.
What just happened
On that first call the SDK did four things, all invisibly:- Resolved the URL’s host to the right MudraID platform.
- Minted a short-lived token for that platform, using your credentials.
- Attached it as an
Authorization: Bearerheader. - Forwarded the request and returned the response unchanged.
401 mid-flight, the SDK refreshes once and retries — so token expiry never surfaces in your code.
Troubleshooting
| What you see | What it means | Fix |
|---|---|---|
MudraIDConfigError | Credentials missing or blank | Check MUDRAID_API_KEY_ID and MUDRAID_SECRET are set in .env or the environment |
MudraIDAuthError | MudraID rejected the credentials | The key id / secret pair is wrong — rotate or re-check |
MudraIDRevokedError | The agent is inactive, or lacks platform/scope access | Check the agent’s status and grants in the portal |
MudraIDPlatformNotRegisteredError | The host you called isn’t a platform this agent is registered with | Register the agent for that platform, or check the URL |
Next steps
Configuration
Settings, precedence, and environments.
Handle errors
The exception hierarchy and how to use it.
Register & manage an agent
Scopes, rotation, and revocation.
How it works
The model behind the trust loop.

