Skip to main content

ORS SDK

Docs

Python SDK for the Open Reward Standard (ORS) — an HTTP-based protocol for connecting AI agents to reinforcement learning environments.

Installation

pip install ors-sdk

Quick Start

Server (hosting an environment)

from pydantic import BaseModel
from ors import Environment, Server, tool, ToolOutput, TextBlock, Split


class SubmitInput(BaseModel):
    answer: str


class MathEnv(Environment):
    @classmethod
    def list_splits(cls):
        return [Split(name="test", type="test")]

    @classmethod
    def list_tasks(cls, split: str):
        return [{"question": "What is 2+2?", "answer": "4"}]

    def get_prompt(self):
        return [TextBlock(text=self.task_spec["question"])]

    @tool
    def submit(self, params: SubmitInput) -> ToolOutput:
        correct = params.answer.strip() == self.task_spec["answer"]
        return ToolOutput(
            blocks=[TextBlock(text="Correct!" if correct else "Incorrect")],
            reward=1.0 if correct else 0.0,
            finished=True,
        )


if __name__ == "__main__":
    Server([MathEnv]).run(port=8080)

Client (connecting to an environment)

from ors.client import ORS

client = ORS(base_url="http://localhost:8080")
env = client.environment("mathenv")
tasks = env.list_tasks(split="test")

with env.session(task=tasks[0]) as session:
    prompt = session.get_prompt()
    print(f"Question: {prompt[0].text}")

    result = session.call_tool("submit", {"answer": "4"})
    print(f"Reward: {result.reward}, Finished: {result.finished}")

License

Apache 2.0

Metadata

Release files for ors-sdk 0.1.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 ors-sdk 0.1.0
File Size Uploaded Provenance Actions
ors_sdk-0.1.0.tar.gz 30.4 kB Without provenance Details for ors_sdk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ors-sdk 0.1.0
File Interpreter ABI Platform Actions
ors_sdk-0.1.0-py3-none-any.whl Python 3 none any Details for ors_sdk-0.1.0-py3-none-any.whl

Total release size: 61.7 kB

Release files / ors_sdk-0.1.0.tar.gz

Download URL ors_sdk-0.1.0.tar.gz
Size 30.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2364c4569c772fdf24b57644a606875ff5900e3ba167b81e38616177784446b1
BLAKE2b-256 checksum
How to use checksums
988e2f052c8ea1b33b6299cf7d35deb62e1256c1c33d338215772635733367eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Release files / ors_sdk-0.1.0-py3-none-any.whl

Download URL ors_sdk-0.1.0-py3-none-any.whl
Size 31.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
62fbf348f9875e975a2d961135cba140bc6f9f8c4c07955f69d9e97ec25acb66
BLAKE2b-256 checksum
How to use checksums
2ec71818ede0a134868cf2c29362f42a48376f37642641b78df75ca1678b7f4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Security for ors-sdk 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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