docstr: This unit test runs a more concise version of the
  code in the `agent_demo.ipynb` tutorial Jupyter notebook and the `agent_demo` Python script 
  to make sure the code works whenever we change something.
docstr_tok: ["This","unit","test","runs","a","more","concise","version","of","the","code","in","the","`","agent_demo.ipynb","`","tutorial","Jupyter","notebook","and","the","`","agent_demo","`","Python","script","to","make","sure","the","code","works","whenever","we","change","something","."]
code: def test_agent_demo(self):
      """
      This unit test runs a more concise version of the
      code in the `agent_demo.ipynb` tutorial Jupyter notebook and the `agent_demo` Python script
      to make sure the code works whenever we change something.
      """
  
      (
          A,
          B,
          C,
          control_fac_idx,
      ) = default_models.generate_epistemic_MAB_model()
  
      (
          num_obs,
          num_states,
          num_modalities,
          num_factors,
      ) = utils.get_model_dimensions(A=A, B=C)
  
      agent = Agent(A=A, B=B, C=C, control_fac_idx=control_fac_idx)
  
      # transition/observation matrices characterising the generative process
      A_gp = copy.deepcopy(A)
      B_gp = copy.deepcopy(B)
  
      # initial state
      T = 5  # number of timesteps in the simulation
      observation = [
          2,
          2,
          0,
      ]  # initial observation -- no evidence for which arm is rewarding, neutral reward observation, and see themselves in the starting state
      state = [
          0,
          0,
      ]  # initial (true) state -- the reward condition is highly rewarding, and the true position in the 'start' position
  
      action_history = []
  
      for t in range(T):
          # update agent
          belief_state = agent.infer_states(observation)
          agent.infer_policies()
          action = agent.sample_action()
  
          action_history.append(action)
  
          # update environment
          for f, s in enumerate(state):
              state[f] = utils.sample(B_gp[f][:, s, int(action[f])])
  
          for g, _ in enumerate(observation):
              observation[g] = utils.sample(
                  A_gp[g][:, state[0], state[1]]
              )
  
file_path: pymdp/test/test_demos.py
imports: import unittest
  import numpy
  import copy
  import seaborn
  import matplotlib.pyplot
  from pymdp.agent import Agent
  from pymdp.utils import plot_beliefs, plot_likelihood
  from pymdp import utils, maths, default_models
  from pymdp import control
  from pymdp.envs import TMazeEnv, TMazeEnvNullOutcome
  from copy import deepcopy
label_desc: Use image node_id 1 for calling the TestDemos obj's underlying member method code with example usage: obj.test_agent_demo() without return types