# \[RLlib\] Make it easier to play trained policies

**URL:** <https://discuss.ray.io/t/rllib-make-it-easier-to-play-trained-policies/1504>\
**Category:** RLlib\
**Created:** [April 1, 2021, 4:18am UTC](https://discuss.ray.io/t/rllib-make-it-easier-to-play-trained-policies/1504 "2021-04-01T04:18:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![RickLan](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/ricklan/32/901_2.png) [@RickLan](https://discuss.ray.io/u/RickLan)\
**Post date:** [April 1, 2021, 5:24am UTC](https://discuss.ray.io/t/rllib-make-it-easier-to-play-trained-policies/1504/2 "2021-04-01T05:24:52Z")

</div>

Hi @drozzy I feel your pain. I came from stable\_baselines too. I just wrote a runnable script to try out a trained policy below. It’s for multi-agent but can be easily modified for single agent. I think the docs has an example for single agent, but I couldn’t remember where atm. Cheers,

> [@TF error when restoring from checkpoint, multi-agent](https://discuss.ray.io/t/tf-error-when-restoring-from-checkpoint-multi-agent/1448/5):
>
> import ray import ray.rllib.agents.ppo as ppo from ray.tune.logger import pretty\_print from ray.rllib.examples.env.random\_env import RandomMultiAgentEnv num\_agents = 2 config = ppo.DEFAULT\_CONFIG.copy() config["num\_workers"] = 1 config["env\_config"] = { "num\_agents" : num\_agents, } env = RandomMultiAgentEnv(config["env\_config"]) config["multiagent"] = { "policies" : { # (policy\_cls, obs\_space, act\_space, config) "{}".format(x): (None, env.observation\_space, env.action\_space, {}) for …

Edit: there is definitely a higher learning curve for RLlib than stable\_baselines, imho. For my research work, I wish I had started with RLlib than stable\_baselines.

Edit 2: the single agent version is here: [Getting Started with RLlib — Ray 3.0.0.dev0](https://docs.ray.io/en/master/rllib-training.html#computing-actions)

---

_[View the full topic](https://discuss.ray.io/t/rllib-make-it-easier-to-play-trained-policies/1504)._
