def get_inventories_component(
    model: language_model.LanguageModel,
    memory: associative_memory.AssociativeMemory,
    players: Sequence[deprecated_agent.BasicAgent],
    main_players: Sequence[deprecated_agent.BasicAgent],
    player_configs: Sequence[formative_memories.AgentConfig],
    clock_now: Callable[[], datetime.datetime] = datetime.datetime.now,
) -> tuple[
    gm_components.inventory.Inventory,
    gm_components.inventory_based_score.Score,
]:
  """Get the inventory tracking component for the game master."""
  money_config = ItemTypeConfig(name='coin')
  player_initial_endowments = {
      config.name: config.extras['initial_endowment']
      for config in player_configs
  }
  inventories = gm_components.inventory.Inventory(
      model=model,
      memory=memory,
      item_type_configs=(money_config,),
      players=players,
      player_initial_endowments=player_initial_endowments,
      clock_now=clock_now,
      financial=True,
      never_increase=True,
      name='possessions',
      verbose=True,
  )
  score = gm_components.inventory_based_score.Score(
      inventory=inventories,
      players=main_players,  # Only main players get a score.
      targets={player.name: ('coin',) for player in main_players},
      name='score',
      verbose=True,
  )
  return inventories, score
Get the inventory tracking component for the game master.
examples/deprecated/modular/environment/labor_collective_action.py