Skip to main content
mudraid-sdk is how an agent authenticates itself. It’s a drop-in replacement for the requests library: you swap the client, and every call your agent makes is signed with a short-lived MudraID token. No decorators, no boilerplate, no secrets in your request code.
# Before
import requests
response = requests.get("https://api.skyscanner.com/flights")

# After
from mudraid import Agent
agent = Agent()
response = agent.get("https://api.skyscanner.com/flights")
That’s the whole integration. Everything below is what the SDK does for you behind that one-line change.

When to use it

Use the SDK on the agent side — in the program that makes API calls. If you’re on the receiving side (an API that agents call), you want the FastAPI middleware instead.

What it does per call

  1. Resolves the URL’s host to the right MudraID platform. It learns your agent’s platforms once, on first use.
  2. Mints a short-lived token for that platform, then caches it in memory until shortly before it expires.
  3. Attaches the token as an Authorization: Bearer header.
  4. Forwards the request and returns the response unchanged.
If a platform returns 401 because a token expired in flight, the SDK refreshes once and retries — so expiry never surfaces in your code.

Built so your secret can’t leak

Internally the SDK keeps two separate connection pools: one for talking to MudraID, one for outgoing platform calls. They never share connections. Your agent’s secret is used only against MudraID and can’t accidentally ride along on a request to a platform — that separation is structural, not a convention.

Install

pip install mudraid-sdk
Requires Python 3.10 or newer.
During the v0.1 alpha the package isn’t on PyPI yet. From the repo root: pip install -e sdks/mudraid-sdk-python.

The request surface

Agent mirrors requests.Session, so your existing call sites barely change:
agent.get(url, **kwargs)
agent.post(url, **kwargs)
agent.put(url, **kwargs)
agent.delete(url, **kwargs)
agent.patch(url, **kwargs)
agent.head(url, **kwargs)
agent.options(url, **kwargs)
All the usual requests keyword arguments work — params, json, data, headers, timeout, stream, files — and you get back a real requests.Response. The SDK is a thin authentication shim, not a client framework, so it doesn’t change how you read responses or handle platform errors.

Next