All examplesMachine learning Install Aner
Delegate an approved energy prediction
Give a named specialist the approved row and a shared allowance for its tool calls.
// Run after reviewing and approving the coordinator’s row 401 proposal.
import aner.agent
import aner.llm
import aner.data
import aner.ml
import aner.tensor
fn energy_specialist(task: PredictionDelegation, request: String, fit: ContextLinearModel,
scaler: FeatureLedger, observations: AdaptiveFrame) -> String {
let local = llm.client(provider: "ollama", model: "qwen2.5:14b-instruct", endpoint: "http://127.0.0.1:11434")
let proposal = local.prediction_turn(request)
print(proposal.text())
return task.predict_delegated(proposal, fit, scaler, observations)
}
let schema = data.schema()
.column("row_id", "Int64", false)
.column("building_id", "String", false)
.column("temperature", "Float64", false)
.column("occupancy", "Float64", false)
.column("energy", "Float64", false)
let table = data.scan_csv("examples/fixtures/contextual/energy.csv", schema, "NA").collect(16, 1048576, 4)
let frame = data.frame(table, "row_id", "building_id", "energy", List("", "", "degC", "1", "kWh"))
let split = frame.partition_groups(List("B0", "B1", "B2", "B3"), List("B4", "B5"), List("B6", "B7"))
let scaler = ml.fit_standardizer(split.train())
let fit = ml.fit_linear(scaler.transform(split.train()).batch(1048576))
let run = agent.open_run("energy-401.run")
let task = run.delegate_prediction("energy-specialist", max_calls: 4)
print(task.delegation_id())
print(energy_specialist(task, "Predict energy for validation observation 401.", fit, scaler, split.validation()))
Make it your experiment.
Use Aner 0.1.2 or newer. Save this program as examples/agent_energy_delegation.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/agent_energy_delegation.aner
aner run examples/agent_energy_delegation.aner --prodThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
Use Aner 0.1.2 on macOS or Linux with local Ollama serving qwen2.5:14b instruct. Approve row 401 in energy 401.run and save the CSV as examples/fixtures/contextual/energy.csv beneath the project root.
Required fixture files
energy.csv Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution