Environment Samplers#

When a simulator (environment) is available, InputReader - are used to collect and return experiences from the envs. For more details on InputReader used for offline RL (e.g. reading files of pre-recorded data), see the offline RL API reference here.

The base sampler API (SamplerInput) is defined as follows:

Base Sampler class (ray.rllib.evaluation.sampler.SamplerInput)#

SyncSampler (ray.rllib.evaluation.sampler.SyncSampler)#

The synchronous sampler starts stepping through and collecting samples from an environment only when its next() method is called. Calling this method blocks until a SampleBatch has been built and is returned.

AsyncSampler (ray.rllib.evaluation.sampler.AsyncSampler)#

The asynchronous sampler has a separate thread that keeps stepping through and collecting samples from an environment in the background. Calling its next() method gets the next enqueued SampleBatch from a queue and returns it immediately.