Skip to main content
Get started with ORS by building a simple math environment server and testing it locally.

What You’ll Build

A working ORS server for math problems (GSM8K-style) with:
  • One tool (submit) for submitting answers
  • Train and test task splits
  • Reward signals for RL training
  • Local HTTP server you can test with curl or Python
Time: ~15 minutes

Prerequisites

  • Python 3.11+ installed
  • Basic Python knowledge
  • Terminal/command line access

Step 1: Install Dependencies

The ORS Python SDK is one implementation of the ORS specification. We’ll use it for this quickstart.

Step 2: Download GSM8K Data

Download the GSM8K dataset from the HuggingFace repository:
  1. Download train-00000-of-00001.parquet
  2. Download test-00000-of-00001.parquet
Place both files in your working directory.
GSM8K is a dataset of grade school math word problems. Each task has a question and an integer answer.

Step 3: Create Your Environment

Create a file gsm8k_env.py:
What this code does:
  • Loads GSM8K tasks from the parquet files
  • Defines an ORS environment with math tasks
  • Implements list_splits(), list_tasks(), and get_prompt()
  • Creates a submit tool that checks answers and returns rewards
  • Starts an HTTP server on port 8080

Step 4: Run the Server

You should see:
Your ORS server is now running!

Step 5: Test with HTTP

Let’s test the server with curl. Open a new terminal:

List environments

Response:

List tools

Response:

List splits

Response:

List tasks

Response (first 2 tasks shown):
The full dataset contains 7,473 training tasks and 1,319 test tasks.

Step 6: Run an Episode

Now let’s run a complete episode (session):

Create session ID

Response (SSE stream):
The session ID is in the task_id event. Save it for the next steps.

Create episode

Use a task from the dataset:
Response:

Get prompt

Response:

Call submit tool

Response (SSE stream):
Success! The agent got reward 1.0 and finished: true.

Cleanup

Step 7: Test with Python Client

Create test_client.py:
Run it:
Output:

Understanding the Code

Key Components

1. Environment Class
Inherits from Environment base class, which handles HTTP protocol details. 2. Splits and Tasks
Organize problems into train/test sets. 3. Prompt Generation
Convert task into initial agent prompt. 4. Tools
Actions agents can take. Return ToolOutput with reward and finished flag. 5. Tool Output
Structured response with content, reward, and termination signal.

What You’ve Learned

  • How to implement an ORS server using the Python SDK
  • Core ORS concepts: splits, tasks, tools, prompts, rewards
  • How sessions (episodes) work
  • The HTTP API for ORS
  • How to test an ORS server locally

Next Steps

Add More Tools

Add bash, calculator, or other tools to your environment

Design Rewards

Learn reward design patterns for RL

Implementation Guide

Deep dive into building ORS servers

Specification

Understand the complete ORS protocol

Common Issues

”ModuleNotFoundError: No module named ‘ors’”

Install the SDK:

“404 Environment not found”

Check the environment name matches the class name (lowercase):
  • Class: GSM8KEnvironment
  • Name: gsm8kenvironment

”Connection refused”

Make sure the server is running:

“Session not found”

Create a new session ID: