>>510389892>>yeah the president can just fire mostly everyone working at the agency whenever he wants>does that mean a president could in theory just gut ICE/CIA/DOJ/FBI overnight?Your general understanding of how agencies work is correct. They are created by Congress, and given certain authority (called the "enabling act") to do things. For example, the department of the treasury can print dollars. They can't buy tanks and invade canada because they don't have authority for that.
The president "executes" the laws of Congress - that's why that branch of government is called the "executive" branch.
>>yeah the president can just fire mostly everyone working at the agency whenever he wants>does that mean a president could in theory just gut ICE/CIA/DOJ/FBI overnight?Probably not. Most lower-level employees are subject to both budgeting (their position is eliminated) but also the civil service act which has to be followed in order to just discharge a federal employee. Wholesale firings of worker bees are tough, unless the budget eliminates their job. Firings of higher up employees ("policy" level) is easier because the president gets to make policy, not the liberal hold-overs from the past administration.
One thing Obama/Clinton did well was pack the federal bureacracy with fellow travelers - progressives - so that at the lower levels of where the work gets done they could continue doing progressive work regardless of who the president was. Neither Bush nor Trump the first time got rid of them, and the result was things like the IRS auditing conservative groups and not auditing progressive groups.