Skip to main content

Rosen Python SDK

The Python SDK for Rosen, a Kubernetes-style control plane for AI agents.

An agent is a function handler(ctx) -> str. The SDK gives that function a model, tools, and memory, and handles the wire protocol so the Rosen control plane can run it, either as a one-shot Job or a long-lived served Deployment.

Install

pip install rosen-sdk

Every backend (OpenAI-compatible models, MCP tools, Redis, FAISS, pgvector) is a required dependency, so there is nothing optional to pick.

Write an agent

import rosen

def handle(ctx: rosen.Context) -> str:
    return ctx.model.run(ctx.input)

if __name__ == "__main__":
    rosen.run(handle)

ctx carries everything the agent needs for one run:

  • ctx.input is the request text.
  • ctx.model.run(prompt) runs a tool-calling loop over the bound model.
  • ctx.tools are the MCP tools the model can call.
  • ctx.memory is conversational (Redis) and semantic (FAISS/pgvector) recall.
  • ctx.conversation_id, ctx.trace_id, ctx.agent, ctx.namespace.
  • ctx.log(msg) traces to stderr, since stdout is the result channel.

Explicit memory writes require the exported mode enum; scope only partitions records within the selected store:

ctx.memory.remember(
    "tenant-specific recovery procedure",
    scope="tenant-a",
    mode=rosen.MemoryMode.SEMANTIC,
)

ctx.model.run(...) selects MemoryMode.CONVERSATIONAL automatically when it persists conversation turns.

Run modes

  • rosen.run(handle) runs the agent once: it reads a JSON request, invokes the handler, and writes the result. The control plane uses this for one-shot Jobs.
  • rosen.serve(handle) starts an HTTP server (POST /invoke) that answers many requests over one process, so memory and connections are built once. The control plane uses this for served Deployments with replicas.

The model, tools, and memory are configured with Rosen resources (ModelEndpoint, Tool, Memory) and injected by the control plane. The agent code is the same whether it runs as a Job or a served Deployment.

License

AGPL-3.0-or-later. See LICENSE.

Metadata

Release files for rosen-sdk 0.5.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 rosen-sdk 0.5.0
File Size Uploaded Provenance Actions
rosen_sdk-0.5.0.tar.gz 47.0 kB Without provenance Details for rosen_sdk-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rosen-sdk 0.5.0
File Interpreter ABI Platform Actions
rosen_sdk-0.5.0-py3-none-any.whl Python 3 none any Details for rosen_sdk-0.5.0-py3-none-any.whl

Total release size: 75.5 kB

Release files / rosen_sdk-0.5.0.tar.gz

Download URL rosen_sdk-0.5.0.tar.gz
Size 47.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5212dd8919301003c5a72e349dce327da1faafb852635f727f66e7e1088dac5c
BLAKE2b-256 checksum
How to use checksums
ac6c76e3ddf74f6363d2cb0ec92f83a44d6eb22fd480b0364c7f82685ae4e56d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / rosen_sdk-0.5.0-py3-none-any.whl

Download URL rosen_sdk-0.5.0-py3-none-any.whl
Size 28.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
650345105ce85f78a8a0b006116402e1196a046f1a25c6ad6858c0e27664ad81
BLAKE2b-256 checksum
How to use checksums
5b7bd3b842a42d1282ef942ec755b6c0fdfcc77966833ba23befcaa8f6c14cd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for rosen-sdk 0.5.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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