Rosen Python agent SDK
Project description
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.inputis the request text.ctx.model.run(prompt)runs a tool-calling loop over the bound model.ctx.toolsare the MCP tools the model can call.ctx.memoryis 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.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rosen_sdk-0.2.0.tar.gz.
File metadata
- Download URL: rosen_sdk-0.2.0.tar.gz
- Upload date:
- Size: 43.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e92d8b019d8e6f629eb6769811d279382823a6a86a8c3bf978726e1b5df76e0
|
|
| MD5 |
ea0ecd42f90c28e062fcde53be6a6251
|
|
| BLAKE2b-256 |
3395e91a5ac512813f289e535299fdba884e6546884357081bd95935246da3f8
|
File details
Details for the file rosen_sdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: rosen_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 26.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb7235f78338a59199263afbbec2a1c286a623444ef10dc311f07b4ec47c8699
|
|
| MD5 |
6b489aa446b7b800550cf34c716010f1
|
|
| BLAKE2b-256 |
fee170ef5bf8a90a8c87b0952f0a8cfb705283187c1b3aa12f8b8fe575ce9a68
|