All examples
Machine learning

Serve a delegated energy prediction through MCP

Let a notebook call a named specialist and use the original prediction receipt.

agent_energy_delegated_mcp.aner
// The scientist configures the existing handoff ID before starting this local service.
import aner.agent
import aner.data
import aner.ml
import aner.tensor

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 task = agent.open_delegation("energy-401.run", "energy-specialist", "REPLACE_WITH_DELEGATION_ID")
task.serve_delegation(fit, scaler, split.validation())

Make it your experiment.

Use Aner 0.1.2 or newer. Save this program as examples/agent_energy_delegated_mcp.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/agent_energy_delegated_mcp.aner
aner run examples/agent_energy_delegated_mcp.aner --prod

The 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. Save the CSV as examples/fixtures/contextual/energy.csv and replace REPLACE_WITH_DELEGATION_ID with the identifier for the existing energy specialist handoff. Launch the service from the external notebook in the guide.

Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner