fixing run_agent_on method