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. 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 memory_recall, memory_ingest, get_memory_items, or get_memory_job. For example, await memory_recall(query="...", base_url="https://memory.example/v1/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.9.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.9.1
File Size Uploaded Provenance Actions
cosens_sdk-0.9.1.tar.gz 72.2 kB With provenance Details for cosens_sdk-0.9.1.tar.gz

Built distribution (wheel)

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

Total release size: 142.8 kB

Release files / cosens_sdk-0.9.1.tar.gz

Download URL cosens_sdk-0.9.1.tar.gz
Size 72.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e32c3b2700680913078803f9c9dac34f8f8dcc1462b89173b63347109e4e7f10
BLAKE2b-256 checksum
How to use checksums
4d87fbc928daab326894e39da9332e9dea3f2e23c352a0a0668bad7ff7f85cec
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 20, 2026.

Transparency log

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

Download URL cosens_sdk-0.9.1-py3-none-any.whl
Size 70.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9334b393edbb3888d75f270c4ffec02ad3d0cc6dd5ae94ee303ecc9042a721b
BLAKE2b-256 checksum
How to use checksums
55484af0cbc9d3516ac1182d92d5c869acbafb73164d3c20ee0eefded2bf53fc
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 20, 2026.

Transparency log

Security for cosens-sdk 0.9.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.9.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 20, 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