def METHOD_NAME(self, trajectory: Trajectory) -> None:
    """
    Takes a trajectory and processes it, putting it into the replay buffer.
    """
    super().METHOD_NAME(trajectory)
    last_step = trajectory.steps[-1]
    agent_id = trajectory.agent_id  # All the agents should have the same ID
    agent_buffer_trajectory = trajectory.to_agentbuffer()
    # Check if we used group rewards, warn if so.
    self._warn_if_group_reward(agent_buffer_trajectory)
    # Update the normalization
    if self.is_training:
        self.policy.actor.update_normalization(agent_buffer_trajectory)
        self.optimizer.critic.update_normalization(agent_buffer_trajectory)
    # Evaluate all reward functions for reporting purposes
    self.collected_rewards["environment"][agent_id] += np.sum(
        agent_buffer_trajectory[BufferKey.ENVIRONMENT_REWARDS]
    )
    for name, reward_signal in self.optimizer.reward_signals.items():
        evaluate_result = (
            reward_signal.evaluate(agent_buffer_trajectory) * reward_signal.strength
        )
        # Report the reward signals
        self.collected_rewards[name][agent_id] += np.sum(evaluate_result)
    # Get all value estimates for reporting purposes
    (
        value_estimates,
        _,
        value_memories,
    ) = self.optimizer.get_trajectory_value_estimates(
        agent_buffer_trajectory, trajectory.next_obs, trajectory.done_reached
    )
    if value_memories is not None:
        agent_buffer_trajectory[BufferKey.CRITIC_MEMORY].set(value_memories)
    for name, v in value_estimates.items():
        self._stats_reporter.add_stat(
            f"Policy/{self.optimizer.reward_signals[name].name.capitalize()} Value",
            np.mean(v),
        )
    # Bootstrap using the last step rather than the bootstrap step if max step is reached.
    # Set last element to duplicate obs and remove dones.
    if last_step.interrupted:
        last_step_obs = last_step.obs
        for i, obs in enumerate(last_step_obs):
            agent_buffer_trajectory[ObsUtil.get_name_at_next(i)][-1] = obs
        agent_buffer_trajectory[BufferKey.DONE][-1] = False
    self._append_to_update_buffer(agent_buffer_trajectory)
    if trajectory.done_reached:
        self._update_end_episode_stats(agent_id, self.optimizer)