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.4.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.4.0
File Size Uploaded Provenance Actions
rosen_sdk-0.4.0.tar.gz 46.9 kB Without provenance Details for rosen_sdk-0.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 75.4 kB

Release files / rosen_sdk-0.4.0.tar.gz

Download URL rosen_sdk-0.4.0.tar.gz
Size 46.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ec683a35ab58d048200d02916dee4264ff794130043c890cf776557c434fccaf
BLAKE2b-256 checksum
How to use checksums
724915824def519b12e23d0cb252576e94c7c092d17b8dea1b93a52680b44f77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

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

Download URL rosen_sdk-0.4.0-py3-none-any.whl
Size 28.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9acde8f8bea8c222151d18e8bdc537f983085ee11457b94d95e7ad97689ac75e
BLAKE2b-256 checksum
How to use checksums
941556402a21a861fb5993e6d3b9e9b1b3dcd6179a02294a45a6c90dd65a30be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for rosen-sdk 0.4.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