put global state into atom, agent