def _are_agricultural_resources_pooled(
      game_master_memory: associative_memory.AssociativeMemory,
      timepoint: str) -> bool:
    """Check if villagers have agreed to pool agricultural resources."""
    retrieved = game_master_memory.retrieve_by_regex(
        regex=r'\[' + timepoint + r'\].*',
        sort_by_time=True,
    )
    result = False
    if retrieved:
      retrieved_str = '\n'.join(retrieved)
      villager_names_str = ', '.join(supporting_player_names)
      chain_of_thought = interactive_document.InteractiveDocument(model)
      chain_of_thought.statement(f'Record of events:\n{retrieved_str}')
      result = chain_of_thought.yes_no_question(
          question=('Is there evidence in the above record of events that '
                    'there is an agreement in place for pooling '
                    'agricultural products between villages such that a '
                    'village with less food can be resupplied by a village '
                    'with more food? Only consider the following villagers: '
                    f'{villager_names_str}. If there is no evidence of a '
                    'particular villager\'s opinion, then assume that villager '
                    'is against sharing agricultural resources.')
      )
    return result
Check if villagers have agreed to pool agricultural resources.
examples/deprecated/modular/environment/state_formation.py