Browse documentation
aner.agent · Reference

Review a scientific agent prediction

Connect a local language model to a fitted building energy predictor, inspect a proposed call and decide when it may run.

Released in Aner 0.1.2Aner 0.1.2 or newer

For building energy observation 401, the fitted linear model predicts 108 kWh. It supplies no 95% prediction interval. In Aner 0.1.2, a scientist can review a language model’s proposal, save the decision, restart Aner and dispatch the authorized prediction. This native workflow uses a private run directory on a local macOS or Linux filesystem.

A local language model proposes an observation, a scientist authorizes it, and the fitted scientific model computes its energy.

Start a run and inspect the proposal

Open the building energy example. Download the Aner source, the scientist notebook and the energy CSV. Put the CSV at examples/fixtures/contextual/energy.csv beneath the project root. Start Ollama locally with qwen2.5:14b-instruct installed.

Run aner run examples/agent_energy.aner --prod once from that root, or use the notebook’s preparation and proposal cells. Both create energy-401.run in the working directory and leave it awaiting approval. Use a fresh directory name for each independent run. The example fits its scaler and model on training buildings B0: B3. Only the requested row in the B4: B5 validation split is eligible. Its measured energy stays outside the language model’s context. Fitted data and observation identities

aner
let proposal = llm.prediction_turn(local, "Predict energy for validation observation 401.")
let run = agent.start_run("energy-401.run", proposal, 401, fit, scaler, split.validation())
print(run.row_id())
print(run.state())
print(run.replay())

Inspect the journal before deciding. It identifies the run, the proposing model, the native runtime version, the tool, the exact row, the scientific input fingerprint and the approval window. The row ID travels as a decimal string on the model wire. A validated native tool call is required to create the run.

Approve, deny, pause or cancel

Choose one decision while the run is awaiting approval. run.approve() authorizes a later dispatch. run.deny() closes the pending decision with zero predictions. run.cancel() stops further scheduling. To save an approved run for another session, run these cells in order.

aner
print(run.approve())
print(run.pause())

Restart and resume

Restart the Aner notebook kernel or open a new process in the same project directory under the same local account. With Ollama offline, you can open the run, inspect its history, resume it or cancel it.

aner
import aner.agent
let saved = agent.open_run("energy-401.run")
print(saved.state())
print(saved.resume())

To dispatch, run the notebook’s fitted inputs cell again. That cell rebuilds fit, scaler and split from the trusted fixture. Skip the proposal cell when reopening. Dispatch checks the fitted inputs, row, units and runtime build identity against the reviewed binding. Use the same native build when resuming an unexecuted approval. If the binding has changed, restore the reviewed inputs and inspect the run before giving a new approval. New runs have a seven day review window.

aner
print(saved.step(fit, scaler, split.validation()))
print(saved.value())
print(saved.unit())

On the completed pilot these reads return 107.99999999999999 and kWh. A later session can call saved.replay() to read the recorded timeline and receipt, or use saved.value() and saved.unit() to read the saved measurement. These operations need only the run directory. For an in memory notebook experiment, agent.review_prediction(...) continues to provide a single session review that predicts immediately on approval.

What happens if the process dies?

The run grants one dispatch. Aner durably records intent before entering the predictor and saves the scientific receipt before marking the run complete. Reopening preserves the evidence. Calling resume() reconciles an interrupted dispatch. An intent with no complete receipt leaves the outcome uncertain, even when the predictor had time to finish. The run enters reconciliation_required and stops automatic execution. A damaged or incomplete journal record prevents further dispatch and requires manual investigation. A new computation requires a separate, deliberately created run.

A restart recovers the stored measurement when a receipt exists. With intent and no receipt, it preserves the uncertainty and stops.

Decision or interruptionNative predictions in the testReopened outcome
Approve, pause, reopen and race two workers1One energy prediction
Deny the pending proposal0Denied
Cancel before dispatch0Cancelled
Kill the process before dispatch intent1The approval survived. A later step made the first prediction.
Kill the process after dispatch intent and before prediction0Reconciliation required
Kill it after prediction and before saving the receipt1Reconciliation required
Kill it after saving the receipt and before recording completion1Completed from the saved receipt

Observed predictions per row-401 scenario, including approved restart, recovered receipt and two different interruptions with missing receipts.

The native tests exercised 11 scenarios, including four process kills. All 22 replays were identical within their respective runs and added zero predictions. Five saved receipts matched the enrolled Phase 0 value, row and unit. Cancelling during an outstanding computation retained its eventual receipt. Changing the training fit or validation inputs revoked approval before prediction.

The scientist notebook also ran with real local Qwen across three Aner kernel processes. The two reopened kernels ran with networking disabled. The final kernel read the result and history after the CSV had been removed from its expected location. These results cover abrupt process termination on one machine and one original journal. Keep the run directory together on its local filesystem. Independently copied or rolled back journals cannot coordinate with each other.

Register your own prediction tool

To make the approved observation available to a client outside Aner, follow the external notebook and MCP guide.

The next building study uses a scientist authored function, two fitted predictors and six unseen buildings. The guide walks through the function’s read only contract, the local model’s proposed call and the independently scored result. Compare energy predictors with a typed tool

To give a second agent the current approval and a shared call budget, follow the specialist delegation guide.

See the Scientific agents in Aner module reference for the shared API.

Aner documentation · Reference and guides