fix agent and policy implementation (need to finish)