How does an agent maintain state across multiple steps within a single task session?