In most states initial application, reconsideration, ALJ hearing, AC review - then district court.
In some states there is no reconsideration level.
I’ve seen - I can’t begin to guess at how many thousands of these cases over the past quarter century, and cannot think of an instance in which SSA is represented by an attorney at any stage before district court. Maybe I just missed something. 
If we want to get all complicated, we can talk about hearing officers in cessation cases and the like - but in none of them is an attorney representing the government in a matter before an ALJ or other decision-maker.
The ALJ is charged with ensuring that the record is fully and fairly developed - whether or not the clamant is represented. Generally, that means ensuring that relevant medical records have been obtained. It does not mean that the ALJ is required to send a claimant out for additional testing in every case. Different ALJs differ as to what they deem necessary.
In our office, just about every claimant - whether represented or not - has had consultative examinations by a doctor (and a mential health professional if mental impairment is alleged.) It is also common for specialized testing to be obtained, such as an EKG in a heart case, or pulmonary function testing if COPD is an issue. The entire record is generally reviewed by physical and mental health doctors at the initial and reconsideration levels. Unfortunately, in some areas this review is performed by non-doctors called single decision-makers.
The initial and recon levels are handled by the individual states. Unfortunately, some states seem to do a better job than others at this level.
One thing a lot of folk lose track of is that “In general, you have to prove to us that you are blind or disabled. Therefore, you must bring to our attention everything that shows you are blind or disabled. This means that you must furnish medical and other evidence that we can use to reach conclusions about your medical mpairment(s) and … its effect on your ability to work on a sustained basis.” 20 CFR 404.1512(a).
Moreover, “[S]tatements about your pain or other symptoms will not alone establish that you are disabled; there must be medical signs and laboratory findings which show that you have a medically determinable impairment(s) which could reasonably be expected to produce the pain or other symptoms alleged… .” 20 CFR 404.1529(a).
In short, the claimant bears the burden of proving disability, and disability CANNOT be estabished by subjective allegations lacking sufficient medical support. It should come as no surprise that many initial applications are denied, or that more represented claimants are paid, because many folk apply with few if any medical records. In fact, my understanding is that many if not most attorneys advise their claimants to apply, and only represent them when a hearing is pending. At that time, a good attorney puts forth the effort to obtain any relevant medical evidence, and may even send the claimant out for testing or may solicit medical opinions.