Skip to main content

CoSens Python RSI SDK

Install with pip install --upgrade cosens-sdk.

Cloud mode is the default. Set COSENS_API_KEY; CoSens learns with its own models and you need no model of your own.

from cosens.rsi import RSIClient

rsi = RSIClient()  # cloud
run = rsi.execution_create(
    evidence={"context_path": "context.txt", "files": [{"path": "sales.csv", "role": "input"}]},
    idempotency_key="delivery-42",
)
print(rsi.execution_get(run["id"])["status"])

The cloud SDK uploads files listed in evidence and the optional recipe_reference. For local mode, pass a data directory, the tool-calling model name and the host's model request headers.

rsi = RSIClient(
    data_dir="./.rsi-python",
    config={"model": "your-model", "base_url": "http://127.0.0.1:8000/v1", "headers": {}, "auto_start": True},
)

After refreshing a token, create a Client with the same data directory and credential_scope and the new headers. rsi.recover() resumes that account's unfinished work with the new Client settings, and rsi.recover(recipe_id=recipe_id) limits recovery to one SDK Recipe. Local Recipe reads include a storage_path relative to data_dir. See the atomic API and Hook lifecycle and the Python Hook example.

Virtual User selection

For cloud RSI, use RSIClient(virtual_user_id="vu_...") to bind this client to a Virtual User. The option sets the X-Virtual-User-Id request header, which is how the service identifies the Virtual User. Use separate clients for separate Virtual Users. Local RSI does not accept this option. Memory's memory_recall, memory_ingest, get_memory_items, and get_memory_job take an optional virtual_user_id per call. get_memory and get_memory_experience do not support Virtual User selection and reject it. Calls without a selection use the authenticated account. The server checks each caller's current grant; availability depends on the service deployment.

For a different Memory deployment, pass both base_url (the HTTPS Memory API URL, including its deployment-specific path) and api_key to any Memory function: memory_recall, memory_ingest, get_memory_items, get_memory_job, get_memory_experience, or get_memory. For example, await memory_recall(query="...", base_url="https://memory.example/memory", api_key="..."). The explicit key is used only for that call; the configured URL cannot contain credentials, a query, a fragment, or path traversal, and redirects are not followed.

To explicitly retry a timed-out local execution, call rsi.recover(recipe_id=recipe_id, retry_key=request_id). Reuse the key if the request is submitted again.

Metadata

Release files for cosens-sdk 0.10.1

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

Source distribution (sdist)

Source distribution for cosens-sdk 0.10.1
File Size Uploaded Provenance Actions
cosens_sdk-0.10.1.tar.gz 72.5 kB With provenance Details for cosens_sdk-0.10.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cosens-sdk 0.10.1
File Interpreter ABI Platform Actions
cosens_sdk-0.10.1-py3-none-any.whl Python 3 none any Details for cosens_sdk-0.10.1-py3-none-any.whl

Total release size: 143.3 kB

Release files / cosens_sdk-0.10.1.tar.gz

Download URL cosens_sdk-0.10.1.tar.gz
Size 72.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f935ac64d9355afb484f6f57647d2509e891bd3f53c22a0166fb9828aeff5eff
BLAKE2b-256 checksum
How to use checksums
aa4f5b63da72c345baaf4d039f2676ec9b711dad7cffac830a813cb62cb4d523
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 21, 2026.

Transparency log

Release files / cosens_sdk-0.10.1-py3-none-any.whl

Download URL cosens_sdk-0.10.1-py3-none-any.whl
Size 70.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
981b90f8c4653a271443067cab932a06a07555e4abf04d30349dfcdb3f5b61cf
BLAKE2b-256 checksum
How to use checksums
1089720bfc054acfedfcadad381403f697131e46a7c08b59f81526a47fc6ced0
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 21, 2026.

Transparency log

Security for cosens-sdk 0.10.1

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.

Select from 2 files

Attestation for cosens_sdk-0.10.1.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 21, 2026.

Transparency log

A 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.

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