package botstadia:agent@0.1.0;
/// What a bot's program may ask of the host during a turn.
interface host {
/// The fuel left in this turn's budget, and the turn number. Exact on
/// every machine, for a bot that paces its own search.
record turn-budget {
fuel-left: u64,
turn: u32,
}
budget: func() -> turn-budget;
/// One tensor, row-major.
record tensor {
name: string,
shape: list<u32>,
data: list<f32>,
}
/// Why an inference call didn't run or didn't finish.
variant inference-error {
/// The turn's remaining fuel can't pay the model's charge.
unaffordable,
/// The call was cancelled at the backstop.
cancelled,
/// The seat's inference has ended for this session.
unavailable,
/// The inputs don't match the model.
bad-input(string),
}
/// Run the bundle's model `model` (its index in the manifest) on `inputs`.
infer: func(model: u32, inputs: list<tensor>) -> result<list<tensor>, inference-error>;
}
/// A bot: one instance per seat per session.
///
/// Inputs and outputs are opaque bytes in the arena's declared payload layout.
/// Generated code reads and writes them by name.
world agent {
import host;
/// Once, before the first turn, under the arena's `init` budget.
export init: func();
/// This turn's input in, this turn's output back.
export on-tick: func(input: list<u8>) -> list<u8>;
}