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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rosen_sdk-0.3.0.tar.gz (46.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rosen_sdk-0.3.0-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file rosen_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: rosen_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 46.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for rosen_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 35cd239c6100a88d26956c0172feb2a23c7fa35fdfc0272eafcdd39babdf2b8d
MD5 17e2b2df98318c77a98c3bdfac4dac05
BLAKE2b-256 1e04ba41c3ccc1401510a5dc423e401be00fb3ce9ef594b609239dbabc010128

See more details on using hashes here.

File details

Details for the file rosen_sdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: rosen_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for rosen_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 455c99bc21890bae9408f848f0cc612873f212bb606f68bd217eacfff371d6f5
MD5 b977102e6ecb23a0ca7bc429754cfb89
BLAKE2b-256 b5afba9501b2e75122a743f8c49cf88fa678a223a140a62ba936c1e4381a531e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page