# Policy server with Tune

**URL:** <https://discuss.ray.io/t/policy-server-with-tune/2209>\
**Category:** Ray Tune\
**Created:** [May 19, 2021, 8:06pm UTC](https://discuss.ray.io/t/policy-server-with-tune/2209 "2021-05-19T20:06:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![antmak](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/antmak/32/1871_2.png) [@antmak](https://discuss.ray.io/u/antmak)\
**Post date:** [May 19, 2021, 8:06pm UTC](https://discuss.ray.io/t/policy-server-with-tune/2209/1 "2021-05-19T20:06:02Z")

</div>

We have set up client server similar to this example:

[ray/cartpole\_server.py at master · ray-project/ray · GitHub](https://github.com/ray-project/ray/blob/master/rllib/examples/serving/cartpole_server.py)

We would like to use Tune for hyperparameter tuning.

What will be the recommended way to use it in this setting?

Is it possible to subscribe to Tune event when starting a new trial so we can start additional simulators?

---

<div class="post-metadata">

**Author:** ![kai](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/kai/32/3380_2.png) [@kai](https://discuss.ray.io/u/kai)\
**Post date:** [May 19, 2021, 8:16pm UTC](https://discuss.ray.io/t/policy-server-with-tune/2209/2 "2021-05-19T20:16:24Z")

</div>

Hi @antmask, does this Ray Tune example help? [ray/pbt\_ppo\_example.py at master · ray-project/ray · GitHub](https://github.com/ray-project/ray/blob/master/python/ray/tune/examples/pbt_ppo_example.py)  
You probably don’t want to use PBT here, but the rest of the setup (the call to `tune.run()`) should be helpful.

What do you mean with subscribing to Tune events? Do you mean event callbacks? Like this: [Tune Internals — Ray v2.0.0.dev0](https://docs.ray.io/en/master/tune/api_docs/internals.html#callbacks)

---

<div class="post-metadata">

**Author:** ![antmak](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/antmak/32/1871_2.png) [@antmak](https://discuss.ray.io/u/antmak)\
**Post date:** [May 19, 2021, 8:30pm UTC](https://discuss.ray.io/t/policy-server-with-tune/2209/3 "2021-05-19T20:30:52Z")

</div>

Thanks Kai, we’ll have a look on the callbacks. Looks helpful thanks.  
For the first part, the ray tune example doesn’t use the client server architecture, are you aware of an example that uses this architecture?

Thank you.
