pub struct Agent {
pub config: DecisionConfig,
pub persist: bool,
/* private fields */
}Expand description
The orchestrator.
The trait objects carry Send + Sync because scema-daemon shares one Arc<Agent>
across connection threads. Constructing an agent per request would reload the Deep Q*
checkpoint every time, and a Mutex would serialise every observation behind whichever
request is currently walking a large tree. Every implementation in this workspace is
already thread-safe — they hold plain data and take no locks.
Fields§
§config: DecisionConfig§persist: boolWhen false, cycle computes and returns everything but writes nothing. The default
for scema simulate, which is explicitly a counterfactual and must not leave a
trace that reads like a decision the agent made.
Implementations§
Source§impl Agent
impl Agent
Sourcepub fn new(root: impl Into<PathBuf>, dqstar_checkpoint: Option<String>) -> Self
pub fn new(root: impl Into<PathBuf>, dqstar_checkpoint: Option<String>) -> Self
An agent rooted at a state directory, with the default observers and evaluators.
dqstar_checkpoint is the sniper’s scematica-nn-agent.json when there is one. A
missing file is not an error — the evaluator reports it through its applicability,
which is where an operator will actually see it.
pub fn memory(&self) -> &MemoryStore
pub fn records(&self) -> &RecordStore
pub fn observers(&self) -> &[Box<dyn Observer + Send + Sync>]
pub fn evaluators(&self) -> &[Box<dyn Evaluator + Send + Sync>]
Sourcepub fn observe(&self, locator: &str) -> Result<WorldState>
pub fn observe(&self, locator: &str) -> Result<WorldState>
Perceive an environment.
Sourcepub fn hypothesize(&self, world: &WorldState, goal: &Goal) -> Vec<Hypothesis>
pub fn hypothesize(&self, world: &WorldState, goal: &Goal) -> Vec<Hypothesis>
Propose branches from every hypothesiser, in a stable order.
Duplicate ids are dropped, first proposer wins. Two hypothesisers arriving at the same branch is a real occurrence — a memory of a procedure that a signal rule would also propose — and ranking the same branch twice would inflate its apparent support.
Sourcepub fn cycle_over(&self, world: WorldState, goal: Goal) -> Result<Cycle>
pub fn cycle_over(&self, world: WorldState, goal: Goal) -> Result<Cycle>
Run a pass over a world that was already observed.
Split out so the CLI can observe once and simulate several goals against the same world, and so a test can drive the loop over a constructed world without a filesystem.