
867 A.2d 346 (2005)
161 Md. App. 112
Gertrude BOND
v.
DEPARTMENT OF PUBLIC SAFETY AND CORRECTIONAL SERVICES.
No. 2400, September Term, 2003.
Court of Special Appeals of Maryland.
January 31, 2005.
*349 Jeffrey M. Ross (Keith J. Zimmerman, Kahn, Smith & Collins, P.A., on brief), Baltimore, for appellant.
Scott S. Oakley (J. Joseph Curran, Jr., Atty. Gen., on brief), for appellee.
Panel MURPHY, C.J., DAVIS and ROBERT L. KARWACKI, (retired, specially assigned), JJ.
DAVIS, J.
The appellant, Gertrude Bond, tested positive for using marijuana and was fired from her secretarial job with the Department of Public Safety and Correctional Services (DPSCS). She challenged her termination in an intra-agency appeal, and an administrative law judge (ALJ) affirmed the DPSCS's decision. When appellant sought judicial review, a Baltimore City Circuit Court judge affirmed the ALJ's decision.
Having noted a timely appeal, appellant presented three questions for our review. Our resolution of the following question, which we have rephrased, renders appellant's other two questions[1] moot:
Was the ALJ's conclusion that appellant used or possessed marijuana while at work supported by substantial evidence, when the only evidence bearing on that issue was appellant's positive drug test?
We conclude that the ALJ's decision was not supported by substantial evidence, and we shall, therefore, reverse the judgment of the circuit court.

FACTUAL BACKGROUND
According to the ALJ, the DPSCS employed appellant as a secretary at a prison in Baltimore City. Because appellant's job was classified as "non-sensitive" under the DPSCS's internal regulations, she was not subject to random drug testing. Appellant was, however, subject to drug testing if her "appointing authority"[2] had "reasonable suspicion to believe that the employee [had] illegally used drugs." COMAR 17.04.09.04(B)(1). Reasonable suspicion of drug use exists when "the appointing authority has reasonable and specific grounds to believe that a drug abuse test of an employee shall produce evidence of illegal use of drugs." COMAR 17.04.09.04(B)(2)(a).
Appellant's direct supervisor, Lisa Lewis, worked part-time at Anderson Automotive Group in Baltimore, and she recommended appellant for a job at Anderson. Appellant applied and was required to take a drug test, which she failed; she tested positive for using marijuana.
Appellant told Lewis that she did not get the job because she had tested positive *350 for using marijuana. Before then, Lewis had never suspected that appellant used illegal drugs. Lewis told her supervisor about appellant's drug test and, based on Lewis's report, the warden ordered appellant to take a drug test for the DPSCS. Appellant failed that drug test. Appellant later admitted that she had smoked marijuana on a Saturday afternoon two or three weeks before the drug tests.
Under S.P.P. § 11-105(3), the "illegal sale, use, or possession of drugs on the job" is "cause[ ] for automatic termination of employment." In accord with S.P.P. § 11-106, the DPSCS met with appellant to discuss her drug test and to consider mitigating circumstances before determining the appropriate disciplinary action. The DPSCS ultimately fired appellant based on her positive drug test.
State employees and the State are encouraged to enter into settlement agreements to resolve their disputes when the employees contest disciplinary actions. See S.P.P. § 11-108(a)-(d); see also McKay v. Dep't of Pub. Safety and Corr. Servs., 150 Md.App. 182, 819 A.2d 1088, cert. denied, 376 Md. 50, 827 A.2d 113 (2003). In accordance with § 11-108, while appellant pursued her intra-agency appeal, she continued negotiating with the DPSCS for a less severe discipline. Before the ALJ, appellant contended that she and a personnel representative had reached a binding settlement agreement including reinstatement; the DPSCS, however, presented evidence to the contrary, and the ALJ agreed with the DPSCS that no agreement had been reached.
Based on the positive drug tests, the ALJ concluded that appellant violated the following provisions:
 S.P.P. § 11-105;
 COMAR 17.04.09.04;
 DPSCS "Standards of Conduct and Internal Administrative Disciplinary Process," §§ IIB, IV;
 Executive Order 01.01.1991.16.
The ALJ never specified which subsection of S.P.P. § 11-105 that appellant had violated, but the DPSCS agrees with appellant's assumption that the ALJ focused on subparagraph (3), prohibiting the "illegal sale, use, or possession of drugs on the job."
Strictly speaking, COMAR 17.04.09.04 does not prohibit anything; rather, the regulation implements a procedure for drug testing and disciplining employees. It does not, itself, impose a substantive prohibition of drug use beyond that of S.P.P. § 11-105. Appellant thus could not have "violated" that regulation.
The relevant portions of the DPSCS's Standards of Conduct guidelines, which we quote below, do not enlarge upon the prohibitions of S.P.P. § 11-105 and the process in COMAR 17.04.09.04. In the following section on drug use, the Standards begin with a declarative preamble:
G. Drugs.
All institutions, facilities, and offices of the Department of Public Safety and Correctional Services are drug free workplaces. As a condition of employment, an employee shall refrain from using illegal drugs and abusing legally prescribed or over-the-counter drugs on and off the work place.
The Standards then summarize the investigative and disciplinary processes for on-the-job drug violations:
1. CDS Violations at the Workplace.
a. Reporting to work under the influence of CDS, [and] being in possession of or using CDS at the workplace is forbidden. When there is reasonable *351 suspicion, (sensitive and nonsensitive employees) or [a] triggering incident has occurred (sensitive employees only)[,] the supervisor shall complete the Suspected Substance Use Observation Record and contact the IU (for employees of DOC, PATX or DPDS) or the designated ATR (for employees of all other agencies).
b. The IU or ATR shall report to the work site to arrange for a drug test. The employee shall be given two forms: Written Order to Submit to a Urine Test and CDS Test Order.
c. The IU or ATR shall direct the employee to the designated testing site.
d. An employee who tests positive for CDS shall be suspended pending termination from State service.
Finally, the Standards summarize a more lenient process for off-the-job drug violations:
2. CDS Violations Off the Workplace.
a. Non-sensitive classes or positions.
1) An employee who is arrested for a CDS violation shall be subject to action based on a review of his/her case.
2) An employee who (i) is found guilty of a CDS violation prior to 10/1/95, or (ii) is convicted of a CDS violation thereafter, or (iii) receives a PBJ disposition and for whom there is a demonstrable relationship between the offense and job duties, shall:
a) On the first occasion, be suspended for a minimum of 15 working days, be referred to the EAP, be required to participate successfully in a treatment program designated by the EAP, and in addition, be subject to other appropriate disciplinary actions, up to and including termination from State service.
b) On the second occasion, be suspended pending termination from State service.
The relevant portions of Executive Order 01.01.1991.16 are as follows:
B. General Policy. The State of Maryland establishes and adopts the following substance abuse policy for the Executive Branch of State Government:
(1) The State of Maryland is committed to making good faith efforts to insure a safe, secure, and drug-free workplace for its employees consistent with the Drug-Free Workplace Act as enacted by Congress.
* * *
(5) Employees are prohibited from:
(a) Abusing alcohol or drugs;
(b) Committing a controlled dangerous substance offense;
* * *
D. Drug Abuse Policy.
* * *
(2) Working under the influence of a controlled dangerous substance is a violation of this policy;
(3) An employee charged with a controlled dangerous substance offense shall report a finding of guilty, an acceptance of a plea of nolo contendere, or a probation before judgment to the appointing authority within 5 work days.
Appellant argues that all of these legal provisions require, as a prerequisite to appellant's automatic termination, that she used, possessed, or was under the influence of drugs while at work. The DPSCS does not dispute that argument, but contends that substantial evidence in the record supports the ALJ's conclusion that appellant used, possessed, or was under the influence of drugs at work.


*352 DISCUSSION

I

Standard of Review
We refer to the decision of the ALJ, but in judicial review actions such as this, the decision under review is the final decision of the agency. See, e.g., Mehrling v. Nationwide Ins. Co., 371 Md. 40, 57, 806 A.2d 662 (2002). Even though our mandates in administrative law cases remand, affirm, reverse, or modify the circuit court's judgment, we are reviewing the agency's decision, not that of the circuit court. Id. In this case, the final agency decision is the ALJ's decision, because S.P.P. § 11-110(b)(1) requires the DPSCS to delegate final decision-making authority to the Office of Administrative Hearings for employee discipline cases.
We may only reverse an administrative agency's decision if it prejudiced appellant because it:
(i) is unconstitutional;
(ii) exceeds the statutory authority or jurisdiction of the final decision maker;
(iii) results from an unlawful procedure;
(iv) is affected by other error of law;
(v) is unsupported by competent, material, and substantial evidence in light of the entire record as submitted; or
(vi) is arbitrary or capricious.
Md.Code (1999 Repl.Vol.), State Gov't, § 10-222(h); see also Gigeous v. Eastern Corr. Inst., 363 Md. 481, 496, 769 A.2d 912 (2001). The Court of Appeals has explained that those six specific grounds for reversal can be grouped into three levels of judicial review, depending on the amount of discretion an agency is afforded for the challenged action. See Spencer v. Md. State Bd. of Pharmacy, 380 Md. 515, 528-30, 846 A.2d 341 (2004).
First, subsections (i) through (iv) govern the agency's purely legal conclusions. Administrative agencies have no discretion to commit legal error. Therefore, we will not hesitate to overturn an agency's erroneous legal conclusions, although we generally respect the agency's expertise in its field and extend some degree of deference to an agency's interpretation of the laws it administers. See, e.g., Gigeous, 363 Md. at 496, 769 A.2d 912.
Because agencies have more discretion in making factual determinations, our review of subsection (v) is more deferential to the agency. On this level, we limit our inquiry to whether "substantial evidence" in the record supports the agency's conclusions. Spencer, 380 Md. at 529, 846 A.2d 341. More precisely stated, we decide whether "a reasoning mind could have reached the same factual conclusions reached by the agency on the record before it." Id. The Court of Appeals has emphasized that "the heart of fact-finding is drawing inferences from facts," and we may not overturn an agency's fact-finding merely because we disagree with it; "the test is reasonableness, not rightness." Bd. of Physician Quality Assurance v. Mullan, 381 Md. 157, 173, 848 A.2d 642 (2004) (emphasis added). Nevertheless, if an agency's decision depends upon an inference, it is our duty to examine the record to determine whether the inference reasonably follows from the evidence. Travers v. Baltimore Police Dep't, 115 Md.App. 395, 420-21, 693 A.2d 378 (1997). This reasonableness review also applies to mixed questions of law and fact  i.e.,"an application of law to a specific set of facts." See Charles County Dep't of Soc. Servs. v. Vann, 382 Md. 286, 296, 855 A.2d 313 (2004); Travers, 115 Md.App. at 420, 693 A.2d 378; Arnold Rochvarg, Maryland Administrative Law § 4.37 (2001).
Finally, we apply arbitrary or capricious review under subsection (vi) *353 when the agency is neither making findings of fact nor drawing conclusions of law, but is acting in a purely discretionary capacity. Spencer, 380 Md. at 529-30, 846 A.2d 341. This standard of review is most deferential to the agency. "[A]s long as an administrative agency's exercise of discretion does not violate regulations, statutes, common law principles, due process and other constitutional requirements, it is ordinarily unreviewable by the courts." Id. at 531, 846 A.2d 341 (quoting Md. State Police v. Zeigler, 330 Md. 540, 625 A.2d 914 (1993)). But, when an agency exercises its discretion in an arbitrary and capricious manner, we will intervene and reverse the agency's actions. Id.[3]

II

Analysis
At the outset, we find the written decision of the ALJ is deficient in certain respects. For example, the decision never specified which portion of S.P.P. § 11-105 appellant violated. In addition, the decision fails to acknowledge the significance of the distinction between on-the-job and off-the-job drug use. Moreover, the decision fails to specify what facts support her conclusion that appellant used or possessed drugs at work and it never expressly draws the inference, as a pure matter of fact, that based on appellant's positive drug test, it is more likely than not that appellant used or possessed marijuana at work. Nor does the decision expressly conclude, as a mixed question of fact and law, that the mere presence of detectable traces of marijuana usage in appellant's body constitutes use or possession of drugs at work under S.P.P. § 11-105(3).
Generally, this Court can only review an agency's actions on the bases actually relied upon by the agency. See, e.g., Dep't of Health & Mental Hygiene v. Campbell, 364 Md. 108, 123, 771 A.2d 1051 (2001). Our task is hampered by a lack of clarity in agency decisions, sometimes detrimentally so. See, e.g., Johnson v. Crim. Injuries Comp. Bd., 145 Md.App. 96, 112-13, 801 A.2d 1092 (2002) (remanding because of inadequate agency decision-making). Under the circumstances here, however, we will review the record for substantial evidence supporting the ALJ's decision. We do so because we can discern that the ALJ either concluded, (1) as a pure matter of fact, that one can reasonably infer, based on appellant's positive drug test, that appellant actually smoked or possessed marijuana at work, or (2) as a mixed question of fact and law, one can reasonably conclude that the presence of detectable traces of marijuana use in appellant's body constitutes use or possession of drugs at work under S.P.P. § 11-105(3).

A. Factual Inference
Giving due deference to the agency's fact-finding role, we must decide whether a reasonable inference that appellant smoked, possessed, or was under the influence of marijuana at work can be drawn from the bare fact that she tested positive for marijuana use. In this inquiry, we are mindful of how limited our role is; we "may not substitute our judgment for that of the agency concerning the appropriate *354 inferences to be drawn from the evidence." Travers, 115 Md.App. at 420, 693 A.2d 378.
The record contains no direct evidence that appellant used or possessed marijuana at work. The DPSCS theorizes that the ALJ reasonably inferred, based on appellant's failed drug test, that it is more likely than not that appellant used or possessed marijuana at work. We disagree. The inference that appellant used or possessed marijuana at work cannot reasonably be drawn from the bare fact that she tested positive for marijuana use. Rather than drawing a permissible inference, the ALJ engaged in speculation.
The drug test itself and her admission do not provide direct evidence that appellant smoked marijuana, although the test provides very strong circumstantial evidence that she did. Thus, the ALJ could reasonably infer that appellant smoked marijuana. But, the more specific conclusion that appellant smoked, possessed, or was under the influence of marijuana at work does not reasonably flow from the fact that she tested positive for using marijuana. She may have; she may not have. No evidence in the record supports the ALJ's supposition that appellant used or possessed marijuana at work. Without an evidentiary basis linking appellant's marijuana use to her job, the ALJ's "inference" is unreasonable and cannot stand.

B. Mixed Question of Fact and Law
Aside from the inference we have held to be unreasonable, the parties do not dispute the facts underlying this case. Nor is there any serious dispute as to the ALJ's statements of the applicable law. The parties' dispute, rather, is over the proper application of the law to the specific, undisputed facts. Therefore, we inquire whether the ALJ could reasonably conclude, as the DPSCS suggests, that "[t]he presence of an illegal drug in the body of a State employee while on the job at the State workplace, as revealed by an undisputed drug test result, constitutes ... evidence of use of that drug on the job, in violation of [S.P.P. §] 11-105(3)." (Emphasis added.) See Marzullo v. Kahl, 366 Md. 158, 173, 783 A.2d 169 (2001); Ramsay, Scarlett & Co. v. Comptroller, 302 Md. 825, 837-38, 490 A.2d 1296 (1985).
The salient facts are that (1) while at work, appellant had within her body detectable traces of marijuana, and (2) while at work, appellant tested positive for marijuana use. These are the totality of circumstances supporting the ALJ's conclusion that appellant "used" marijuana at work. Nothing in the record shows (directly or inferentially) that appellant smoked marijuana at work, or that, while at work, appellant remained under the influence of the marijuana she admitted smoking on a Saturday afternoon two or three weeks before the drug tests. The record does not show that appellant has previously been convicted of a drug-related offense. Appellant's direct supervisor never suspected appellant's marijuana use. Nevertheless, the DPSCS contends that the presence of traces of marijuana in appellant's body somehow constitutes "use" within the meaning of § 11-105(3).
The pertinent regulations distinguish between on-the-job and off-the-job drug use. Simply put, drug use at work warrants automatic termination; drug use away from work does not. If testing positive for marijuana usage, standing alone, amounts to substantial evidence of on-the-job drug use, then the provisions relating to off-the-job drug use would be superfluous. Every case of off-the-job drug use would amount to on-the-job drug use.
The issue then becomes whether, given these undisputed facts and the ALJ's correct statements of law, a reasoning mind *355 could conclude that appellant "used" marijuana at work based solely on evidence that appellant smoked marijuana away from work and had traces of that marijuana in her body while at work. Accordingly, we are constrained to conclude that the ALJ's application of the law to the facts was erroneous. The record lacks substantial evidence that appellant used marijuana at work, rather than away from work, within the meaning of S.P.P. § 11-105(3). We therefore reverse the judgment of the circuit court.
JUDGMENT OF THE CIRCUIT COURT FOR BALTIMORE CITY REVERSED. CASE REMANDED TO THE CIRCUIT COURT WITH INSTRUCTIONS TO REMAND TO OFFICE OF ADMINISTRATIVE HEARINGS WITH INSTRUCTIONS TO ENTER A FINDING CONSISTENT WITH THE VIEWS EXPRESSED IN THIS OPINION.
COSTS TO BE PAID BY APPELLEE.
NOTES
[1]  Appellant's three questions, as presented in her brief, were:

1. Did the [DPSCS] violate [State Personnel & Pensions Article] § 11-106 by terminating [appellant] more than thirty days after the appointing authority acquired knowledge of the misconduct for which [appellant] was terminated?
2. Did the ALJ err as a matter of law by concluding that a settlement agreement under [State Personnel & Pensions Article] § 11-108 that would allow [appellant] to return to work did not exist because there was no written evidence of the settlement agreement?
3. Was the ALJ's affirmance of [appellant's] termination arbitrary and capricious?
[2]  "Appointing authority" means "an individual or a unit of government that has the power to make appointments and terminate employment." Md.Code (1997 Repl.Vol., 2003 Supp.), State Personnel & Pensions (S.P.P.), § 1-101(b). Appellant's appointing authority was the warden at the prison where she worked. Md.Code (1999 Repl.Vol.), Corr. Servs., § 3-215(b)(3)(i).
[3]  Professor Rochvarg suggests that substantial evidence review and arbitrary or capricious review should both be thought of as reasonableness reviews, differing only in the scope of a court's review. Rochvarg, supra, § 4.38. In applying substantial evidence review, a court only looks to the record before the agency, while arbitrary or capricious review encompasses review of the record, as well as facts outside the record bearing on the reasonableness of the agency's actions. Id.
