Rayrun Python SDK
pip install rayrun-sdk
Create one short-lived MCP session for an application user:
import os
from rayrun import Rayrun
with Rayrun(os.environ["RAYRUN_API_KEY"]) as rayrun:
principal = rayrun.external_principals.upsert(
"customer_123",
display_name="Ada",
metadata={"plan": "pro"},
)
session = rayrun.external_principals.create_session(
principal["uid"],
runtime_context={"accountId": "customer_123", "plan": "pro"},
)
page = rayrun.external_principals.list_sessions(principal["uid"], limit=50)
if page["page"]["nextCursor"]:
next_page = rayrun.external_principals.list_sessions(
principal["uid"], cursor=page["page"]["nextCursor"], limit=50
)
print(session["endpoint"], session["sessionToken"])
AsyncRayrun exposes the same methods for async applications. Use a key with
principals:read, principals:write, sessions:read, and sessions:write. Create a Connect Link
with create_connect_link(principal_uid, connection_uid) when the user must authorize an upstream
OAuth account. Correlate the returned uid with connectLinkUid in either terminal webhook:
external.authorization.completed or external.authorization.failed (provider_denied,
incomplete_response, authorization_failed, or expired). A session created without
tool_access_profile_uid is read-only; pass an access profile to define an explicit tool ceiling that
includes approved mutations.
Release files for rayrun-sdk 0.8.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 | |
|---|---|---|---|
| rayrun_sdk-0.8.0.tar.gz | 13.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rayrun_sdk-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.7 kB
Release files / rayrun_sdk-0.8.0.tar.gz
| Download URL | rayrun_sdk-0.8.0.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d16ba050499e863ac12b82f0b3d873d9a4c8339e3fc97047c8dc82ddc007703
|
|
BLAKE2b-256 checksum How to use checksums |
7388263b76bbdf35c9b95afd5b83f979996346e91c419c1833633ee3aa1744cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 30, 2026.
Transparency logRelease files / rayrun_sdk-0.8.0-py3-none-any.whl
| Download URL | rayrun_sdk-0.8.0-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10d9ac6c92311907723e72b6c7cf85e29a93d8fc29700728eda0cba9eb624784
|
|
BLAKE2b-256 checksum How to use checksums |
9af50ac06c84938e963007adc3d948f71e681c4ec29e2ecb19fa88de250ee501
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 30, 2026.
Transparency log