The economic, environmental, and energetic performance of direct air capture (DAC) processes based on solid sorbents depends significantly on ambient air conditions and the availability of renewable resources. High ambient temperature or low humidity leads to higher energy consumption and lower CO2 productivity; lack of renewable resources may make the direct air capture process not viable. With this work, we investigated how the performance of sorbent-based direct air capture plants varies when changing ambient conditions and how the system should be optimally designed and operated to match the time-dependent variations. To this end, we formulated a new modeling framework, where thermodynamic modeling of adsorption processes is bridged to mixed integer linear optimization via a portable linear model of DAC. The process is based on a vacuum-temperature swing cycle, whose performance was obtained with a rate-based thermodynamic model at varying ambient conditions for an exemplary sorbent representative of different amine-functionalized materials. The optimal design and operation were investigated for (i) a stand-alone DAC system installed at three different geographical locations and (ii) a DAC system embedded in a multi-energy hub aimed at supplying the DAC energy demand from renewable resources. We found that DAC performance is optimal when the process can adjust the operating variables according to the weather profile and when CO2 can be produced flexibly over time, for example, by adopting a buffer storage tank. Other operation strategies are suboptimal but might require less sophisticated control systems. Moreover, the results suggest that capturing costs are significantly smaller in cold and humid conditions. This conclusion holds for both the stand-alone and the integrated DAC systems. However, for the latter, cold and humid conditions are favorable only when abundant renewable energy is available and can be supplied at low costs, for example, via wind farms. These conclusions remain true over a wide range of technical and cost assumptions.