Skip to main content

atomr_agents_harness/
state.rs

1use atomr_agents_core::{TokenBudget, Value};
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct StepEvent {
6    pub iteration: u64,
7    pub outcome: String,
8    pub timestamp_ms: i64,
9}
10
11/// Mutable state shared between iterations of a harness loop. Used to
12/// be `Box<dyn Any>` in the architecture doc; in v0 it's just a
13/// `serde_json::Value` so persistence is trivial.
14#[derive(Debug, Clone, Serialize, Deserialize)]
15pub struct HarnessState {
16    pub iteration: u64,
17    pub history: Vec<StepEvent>,
18    pub working_memory: Value,
19    pub remaining_tokens: u32,
20}
21
22impl HarnessState {
23    pub fn new(initial_budget: TokenBudget) -> Self {
24        Self {
25            iteration: 0,
26            history: Vec::new(),
27            working_memory: Value::Null,
28            remaining_tokens: initial_budget.remaining,
29        }
30    }
31}