Algebras of actions in an agent's representations of the world