Using functions or classes for node definition

Hello! I’ve been using LangGraph for some time, but I’m unsure about the best practice: should nodes and agents be implemented with function definitions or with classes?