ray.rllib.utils.replay_buffers.multi_agent_replay_buffer.MultiAgentReplayBuffer.sample#
- MultiAgentReplayBuffer.sample(num_items: int, policy_id: str | None = None, **kwargs) SampleBatch | MultiAgentBatch | Dict[str, Any] | None[source]#
- Samples a MultiAgentBatch of - num_itemsper one policy’s buffer.- If less than - num_itemsrecords are in the policy’s buffer, some samples in the results may be repeated to fulfil the batch size- num_itemsrequest. Returns an empty batch if there are no items in the buffer.- Parameters:
- num_items – Number of items to sample from a policy’s buffer. 
- policy_id – ID of the policy that created the experiences we sample. If none is given, sample from all policies. 
 
- Returns:
- Concatenated MultiAgentBatch of items. - **kwargs: Forward compatibility kwargs.
 - DeveloperAPI: This API may change across minor Ray releases.