pantheonrl.common.agents.RecordingAgentWrapper

class RecordingAgentWrapper(realagent)[source]

Bases: Agent

Wrapper for an agent that records observation-action pairs.

Users can also use SimultaneousRecorder or TurnBasedRecorder (from wrappers.py) to record the transitions in an environment.

Parameters:

realagent (Agent) – Agent that defines the behaviour of this actor

Methods

get_action

Return an action given an observation.

get_transitions

Return the transitions recorded by this agent.

update

Simply calls the realagent's update function

get_action(obs)[source]

Return an action given an observation.

The output is the same as calling get_action on the realagent, but this wrapper also stores the observation-action pair to a buffer

Parameters:

obs (Observation) – The observation to use

Returns:

The action to take

Return type:

ndarray

get_transitions()[source]

Return the transitions recorded by this agent.

Returns:

A TransitionsMinimal object representing the transitions

Return type:

TransitionsMinimal

update(reward, done)[source]

Simply calls the realagent’s update function

Parameters:
  • reward (float) – The reward receieved from the previous action step

  • done (bool) – Whether the game is done

Return type:

None