Expand description
Deterministic, zero-dependency decision engine for agents and control logic.
reliakit-decide answers one question well: given the current signals,
which action should I take? It scores each candidate action with
utility-based reasoning and picks the best — deterministically, with no
floating point and no third-party dependencies. Reasoner::decide
allocates nothing; Reasoner::rank and Reasoner::explain allocate only
the result they return. The same signals always produce the same decision, so
the choice is reproducible and testable.
It is not a language model and does not understand text; it decides what to do, not what to say. In an agent it is the fast, explainable “judgment” layer next to a model that generates language.
§Model
- A
Scoreis a fixed-point value in0.0..=1.0(stored as0..=10_000). - A
Curvemaps a raw signal to a score (e.g. “low health” → high score). - A
Considerationis one signal run through a curve. - An
Actionmultiplies its considerations together (product-veto: any near-zero consideration vetoes the action) to get a utility. - A
Reasonerholds the candidate actions and selects the best.
§Example
use reliakit_decide::{Action, Curve, Reasoner, Score};
// A bot chooses between fleeing and fighting based on its health.
let health = Score::from_ratio(20, 100); // 20% health
let mut brain = Reasoner::new();
brain.add(Action::new("flee").consider(Curve::Inverse, health)); // strong when health is low
brain.add(Action::new("fight").consider(Curve::Linear, health)); // strong when health is high
let choice = brain.decide().unwrap();
assert_eq!(choice.id, "flee"); // low health -> flee wins§no_std
The crate is no_std-compatible (default-features = false) and always
requires alloc. The default std feature currently adds nothing beyond
core + alloc.
Structs§
- Action
- A candidate decision: the value returned if chosen, plus the considerations that score it.
- Consideration
- A single weighted input: a raw signal run through a
Curve. - Contribution
- One line of an explanation: a consideration’s label and the score it produced for the chosen action.
- Decision
- The outcome of a decision: the chosen id and the utility it won with.
- Explanation
- Why an action was chosen: its id, final utility, and the per-consideration breakdown (in declaration order) that produced it.
- Policy
- A persistent table of learned weights, one per key, nudged by feedback.
- Reasoner
- Holds candidate
Actions and selects among them by utility. - Score
- A fixed-point score in the inclusive range
0.0..=1.0, stored as an integer in0..=10_000(steps of0.0001).