united-states
In U.S. law, most of the time, the courts treat all federal agencies, divisions, and personnel as a single person for purposes of litigation, with third-parties and does not allow litigation between them. The same approach is taken vis-à-vis state governments, and vis-à-vis particular local governments.
Agencies with delegated authority are generally sued separately only when they are corporations owned by the government (in whole or in part) with limited liability that protects the governmental owners (e.g. the Federal Deposit Insurance Corporation (FDIC)).
Sometimes individual government officials are named as defendants in public law litigation in their official capacity, in an action seeking a writ to judicially review a decision. This remains the norm in federal court practice.
In habeas corpus litigation, the nominal defendant is generally the warden of the jail or prison where the person seeking habeas corpus relief is detained in their official capacity. Some states, however, have departed from the traditional rule and treat what would be called a habeas corpus petition at common law, a post-trial motion in an original criminal cases when it seeks to collaterally attack a conviction.
In cases seeking to compel or prevent or review official action, in a mandamus or prohibition or certioari writ case, the nominal defendant is generally someone with the legal authority to take the action requested, or who actually took the action, in their official capacity.
But many states have replaced this approach with a special proceeding against the entity with the authority to act, discarding the legal fiction that the official sued in their official capacity is being sued. See, e.g., Colorado Rule of Civil Procedure 106 (Forms of Writs Abolished).
When a court order directed at an entity's behavior is ignored, the lowest level public official who is capable of complying with the order can be held in contempt of court.
Individual officials can also be sued personally for wrongdoing in which they personally participated while serving a government, either personally, or under color of law. When the wrongdoing is committed by a state or local official, the lawsuit is brought under 42 U.S.C. § 1983 if a federal right is violated. When the wrongdoing is committed by a federal official (in a narrow subset of violations of federal rights), the lawsuit is called a Bivens action.
In these cases, the personal participation of the official in the wrong doing determines who is a defendant, and there is no true vicarious liability. Everyone held liable must have some personal fault from their own actions. There is no vicarious liability and no concept of respondeat superior in these cases.