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

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.2
File Size Uploaded Provenance Actions
cosens_sdk-0.9.2.tar.gz 72.3 kB With provenance Details for cosens_sdk-0.9.2.tar.gz

Built distribution (wheel)

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

Total release size: 143.0 kB

Release files / cosens_sdk-0.9.2.tar.gz

Download URL cosens_sdk-0.9.2.tar.gz
Size 72.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9f984d6448b17d61de6b3f7bf9b789a44af01721e6e6f5da4c3523b2709a0ef5
BLAKE2b-256 checksum
How to use checksums
999922e84170aef84c8776678269b57ebe05a65d3afac97085f2c07c0c1d7f85
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.9.2-py3-none-any.whl

Download URL cosens_sdk-0.9.2-py3-none-any.whl
Size 70.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd80ab4fbe2c34f7466fceba4f0f3a4424fb808b05b64864a6529465c3490f54
BLAKE2b-256 checksum
How to use checksums
4e58f916538f21dab4b7f3550db29bfebdd251a20a5442c55e27101a4e339613
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.9.2

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