Skip to main content

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_id) 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.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rayrun-sdk 0.9.0
File Size Uploaded
rayrun_sdk-0.9.0.tar.gz 14.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rayrun-sdk 0.9.0
File Interpreter ABI Platform
rayrun_sdk-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.8 kB

Release files / rayrun_sdk-0.9.0.tar.gz

Download URL rayrun_sdk-0.9.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1b34a63a1b3db614e533bd079ed4c34cf6329a58f231130ad5fa71690bcb504a
BLAKE2b-256 checksum
How to use checksums
3e97a7a46f8073f1eda6e28416e3cf2ff66261587721aa0ea1bd4b0c00f4b741
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 Sep 1, 2026.

Transparency log

Release files / rayrun_sdk-0.9.0-py3-none-any.whl

Download URL rayrun_sdk-0.9.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14d137ec179fa5ba1ecddf385e40f925c7763a88272bf94bb42e50c43fa3a428
BLAKE2b-256 checksum
How to use checksums
e7afd0f9b10ff033c53504bf64571931ccbdbdbd7b82bbea6c1134467d94ca41
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 Sep 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

0.8.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page