Part I / The Two Loops

The investigation as an episode

One ambiguous incident contains the core RL vocabulary. The engine does not receive "the state of the world." It receives clues, acts through tools, and discovers consequences over time.

02
Stored

A versioned trace of observations, actions, tool results, and final answer.

Hidden

The actual fault and facts the engine has not queried.

Failure

A plausible answer that skips disconfirming evidence.

The detective does not see the crime

Suppose a detective enters a room after an event. The full physical history exists, but the detective sees only a partial view: a broken glass, an open window, conflicting witnesses. Each question or test changes what the detective knows. The quality of the investigation depends on the final guess, the evidence the detective chose to obtain, the alternatives that stayed alive, and the point at which confidence became justified.

An incident-reasoning engine is similar. The underlying network, causal fault, topology, recent changes, and telemetry constitute the world's hidden state. The initial alert is an observation produced from that state. A tool call is an action. The environment returns a new observation. The entire sequence is a trajectory. The model plus prompt, memory, tools, and orchestration is the policy that chooses actions from what it can currently observe.

Mental model

State is what is true. Observation is what the agent currently gets to see. A tool-using agent exists because those are not the same thing.

A seeded outage with an attractive distraction

Concrete example

At 14:03, clients behind the western site report intermittent packet loss. Gateway A and Gateway B both advertise reachability. A configuration change touched Gateway B at 13:58. That recent change is salient. The seeded cause, however, is a degrading uplink on Gateway A. A sound investigation must inspect both paths and resist treating recency as causality.

The first observation contains an alert, scope, and timestamp. It does not contain the correct cause. The engine can query interface errors, compare path health, fetch topology, inspect configuration history, ask for packet-loss correlation, or conclude. Each action has a cost and an opportunity cost. A query that retrieves everything may eventually find the answer, but a disciplined policy selects evidence that separates live hypotheses.

After querying both gateways, the engine sees rising input errors on Gateway A's upstream interface aligned with the incident window. Gateway B's configuration change did not alter forwarding and its path remains clean. The strongest conclusion is now Gateway A's uplink degradation, with evidence and a note that a physical or provider-side test is still required. The engine should not claim a replaced cable, a specific transceiver defect, or a completed remediation unless the environment exposed those facts.

The episode has a contract

An episode needs a start, transition interface, termination condition, and evaluation. Here it starts when the initial alert and tool catalog are delivered. At step t, the policy receives an observation o_t and emits an action a_t. The environment applies the action to its hidden state and returns the next observation. The episode terminates when the policy submits a final diagnosis, exceeds a tool or token budget, reaches a time limit, or violates an unrecoverable gate.

tau = (o0, a0, r0, o1, a1, r1, ... , oT, aT, rT) Read tau as the investigation tape: everything the agent saw, did, and received as feedback.

In many agent environments, intermediate reward is zero and the meaningful score arrives at the end. That makes the learning problem hard: the policy must discover which earlier tool choices, hypotheses, and stopping decisions contributed to the result. A process rubric can add diagnostic step-level feedback, but dense rewards introduce their own risk. If the rubric rewards "number of evidence sources," the agent may query redundant tools. If it rewards mentioning alternatives, the agent may list implausible causes to collect points.

Trace fieldWhy it matters for learningWhy it matters for inference
Policy and prompt versionDetermines which behavior distribution produced the dataSupports reproducibility and rollback
Environment seed and versionSeparates policy change from world changeExplains tool outputs and sandbox behavior
Token and tool timingEnables cost-aware reward and failure analysisReveals queueing, prefill, decode, and tool bottlenecks
Evidence provenanceAllows process grading and leak detectionPrevents untrusted or stale context from masquerading as truth
Termination reasonDistinguishes deliberate stopping from timeoutConnects quality to operational SLOs

Reward is a scorecard, not truth

A useful evaluation might combine final-cause correctness, coverage of both gateways, evidence alignment, calibrated uncertainty, tool cost, and a hard non-fabrication gate. A deterministic oracle can check facts encoded in the scenario. A rubric can inspect the trace. A learned judge can grade natural-language qualities that are hard to encode. These signals differ in reliability. The final reward is a designed proxy for the behavior we want, not the behavior itself.

The gate in the interactive is intentionally severe. If the engine fabricates an unobserved remediation, a high correctness subscore should not teach it that confident invention is acceptable. In production, some violations may reject the trajectory entirely; others may subtract reward or route to human review. The right choice depends on whether the behavior is unacceptable, merely inefficient, or genuinely ambiguous.

Misconception: the prompt is the state

The prompt is part of the observation. It may include stale, lossy, or adversarially selected evidence. The environment state includes facts that were never rendered into tokens. Confusing the two encourages evaluation that gives the model the answer and then congratulates it for retrieval.

Replayable does not mean perfectly realistic

A seeded environment is valuable because two policies can face the same initial incident and evaluators can know the intended causal structure. But fidelity has several layers: tool schemas, response latency, error behavior, access permissions, data correlations, background noise, and consequences of actions. If training tools always succeed instantly while production tools time out or return partial data, the policy learns a world that does not exist.

Environment design is therefore part of model design. A policy cannot learn to recover from a 429 response it never sees. It cannot learn that a destructive remediation requires approval if the sandbox allows it freely. It cannot learn calibrated abstention if every scenario has exactly one clean answer. Later, the agent-RL systems chapter turns this observation into an infrastructure contract.

References