class_docstr: A minimal replay buffer used by Decision Transformer (DT)
  to process episodes into max_seq_len length segments and do shuffling.
  Stores MultiAgentSample.
class_docstr_tok: ["A","minimal","replay","buffer","used","by","Decision","Transformer","(","DT",")","to","process","episodes","into","max_seq_len","length","segments","and","do","shuffling",".","Stores","MultiAgentSample","."]
docstr: Add a MultiAgentBatch of episodes. Replace if full.
  
  Args:
      batch: MultiAgentBatch of full episodes.
docstr_tok: ["Add","a","MultiAgentBatch","of","episodes",".","Replace","if","full",".","Args",":","batch",":","MultiAgentBatch","of","full","episodes","."]
code: def add(self, batch: SampleBatchType):
      """Add a MultiAgentBatch of episodes. Replace if full.
  
      Args:
          batch: MultiAgentBatch of full episodes.
      """
      # Make a copy so the replay buffer doesn't pin plasma memory.
      batch = batch.copy()
      # Handle everything as if multi-agent.
      batch = batch.as_multi_agent()
  
      for policy_id, sample_batch in batch.policy_batches.items():
          self.buffers[policy_id].add(sample_batch)
  
file_path: ray/rllib_contrib/dt/src/rllib_dt/dt/segmentation_buffer.py
imports: import logging
  import random
  from collections import defaultdict
  from typing import List
  import numpy
  from ray.rllib.evaluation.postprocessing import discount_cumsum
  from ray.rllib.policy.sample_batch import MultiAgentBatch, SampleBatch, concat_samples
  from ray.rllib.utils.typing import SampleBatchType
label_desc: Use image node_id 2 for calling the MultiAgentSegmentationBuffer obj's underlying member method code with example usage: obj.add(batch) without return types