---
title: "Local Reinforcement Learning Example"
description: "This project demonstrates how to orchestrate a reinforcement learning (RL) training pipeline using Temporal and Ray RLlib. The system simulates a job scheduling environment and trains a PPO policy to optimize job placement in a cluster."
canonical: "https://temporal.io/code-exchange/local-reinforcement-learning-example.md"
source: "https://temporal.io/code-exchange/local-reinforcement-learning-example"
published: "2025-06-27"
authors:
  - "Sam Ingbar"
languages:
  - "Python"
tags:
  - "ai"
  - "reinforcement learning"
reviewed_by_temporal: false
community_contribution: true
---

# Local Reinforcement Learning Example

This project demonstrates how to orchestrate a reinforcement learning (RL) training pipeline using Temporal and Ray RLlib. The system simulates a job scheduling environment and trains a PPO policy to optimize job placement in a cluster.

- [View repo](https://github.com/singbar/rl_demo)

This package allows the developer to simulate a job-scheduling system that uses a model to schedule jobs. There is a training loop workflow for training the model, an inference workflow for running inference, and a test end-to-end workflow. This incorporates [RLlib](https://docs.ray.io/en/latest/rllib/index.html), [OpenAI Gym](https://github.com/openai/gym), and Temporal together. Gym and RLlib provide an out of the box framework for environment setup training and inference. Temporal provides auto-recovery from training failures, support for a long running training process, and job traceability. Training metrics are published to tensorboard (a native RLlib feature).

I plan to continue adding support for other RL methods (GRPO next) and tweak the logic to improve the results of training.
