The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(agent): adapt transcript usage to updated TinyAgents fields
Steven Enamakelfa55e468d896
diff --git a/crates/openhuman-core/src/agent/session_host/codec.rs b/crates/openhuman-core/src/agent/session_host/codec.rsindex 56053238ef..b388c975be 100644--- a/crates/openhuman-core/src/agent/session_host/codec.rs+++ b/crates/openhuman-core/src/agent/session_host/codec.rs@@ -162,6 +162,8 @@ impl TranscriptCodec<OpenHumanRunContext> for OpenHumanTranscriptCodec {cached_input: sidecar.cached_input_tokens,context_window: sidecar.context_window,cost_usd: sidecar.cost_usd,+ // This sidecar tracks spend across the turn, not one call.+ ..Default::default()},ts: chrono::Utc::now().to_rfc3339(),reasoning_content: None,@@ -291,6 +293,7 @@ fn attach_text_dialect_rounds(cached_input: 0,context_window: 0,cost_usd: 0.0,+ ..Default::default()},ts: chrono::Utc::now().to_rfc3339(),reasoning_content: None,diff --git a/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rsindex fb04b6d347..7f173d4b55 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs@@ -164,6 +164,10 @@ fn codec_attaches_only_this_agents_own_sidecar_usage_to_atomic_append() {"the parent's own cache reads, NOT 4");assert_eq!(usage.usage.context_window, 128_000);+ // The sidecar contains cumulative spend, not the final provider call.+ // Leave the new context-occupancy fields unknown rather than copying totals.+ assert_eq!(usage.usage.last_call_input, 0);+ assert_eq!(usage.usage.last_call_output, 0);assert!((usage.usage.cost_usd - 0.004).abs() < f64::EPSILON,"the parent's own cost, NOT 0.005"diff --git a/crates/openhuman-core/src/agent/session_import/live_tests.rs b/crates/openhuman-core/src/agent/session_import/live_tests.rsindex 3a637fd6d7..81e5c525ba 100644--- a/crates/openhuman-core/src/agent/session_import/live_tests.rs+++ b/crates/openhuman-core/src/agent/session_import/live_tests.rs@@ -85,6 +85,7 @@ fn turn_usage() -> TurnUsage {cached_input: 20,context_window: 200_000,cost_usd: 0.05,+ ..Default::default()},ts: "2024-01-01T00:00:01Z".to_string(),reasoning_content: None,diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rsindex 8f267b6979..f1ebedf7fe 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs@@ -78,6 +78,8 @@ pub(super) fn persist_subagent_transcript(cached_input: usage.cached_input_tokens,context_window,cost_usd: usage.charged_amount_usd,+ // AggregatedUsage has no final-call context measurements.+ ..Default::default()},ts: now.clone(),reasoning_content: None,diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rsindex e2ede25c3d..fa18e788c0 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rs@@ -9,6 +9,50 @@ use tinyinference_llm::tool::ToolCall;use tinytools::Tool;use tinytools::ToolResult;+#[test]+fn subagent_transcript_keeps_cumulative_spend_separate_from_unknown_last_call() {+ let workspace = tempfile::tempdir().unwrap();+ let usage = AggregatedUsage {+ input_tokens: 120,+ output_tokens: 30,+ cached_input_tokens: 40,+ charged_amount_usd: 0.01,+ };+ super::transcript::persist_subagent_transcript(+ workspace.path(),+ "root__usage",+ "worker",+ "task",+ "mock",+ "model",+ &[TranscriptMessage::assistant("done")],+ &usage,+ None,+ 200_000,+ "test",+ 2,+ );+ let root = crate::agent::session_store::transcript_root(workspace.path());+ let path = tinyagents_session::transcript::resolve_keyed_transcript_path(&root, "root__usage")+ .unwrap();+ let transcript = tinyagents_session::transcript::read_transcript(&path).unwrap();+ let recorded = &transcript+ .messages+ .last()+ .unwrap()+ .turn_usage+ .as_ref()+ .unwrap()+ .usage;+ assert_eq!(recorded.input, 120);+ assert_eq!(recorded.output, 30);+ assert_eq!(recorded.cached_input, 40);+ assert_eq!(recorded.context_window, 200_000);+ assert_eq!(recorded.cost_usd, 0.01);+ assert_eq!(recorded.last_call_input, 0);+ assert_eq!(recorded.last_call_output, 0);+}+fn native_tool_profile() -> &'static ModelProfile {static PROFILE: std::sync::LazyLock<ModelProfile> = std::sync::LazyLock::new(|| ModelProfile {provider: Some("subagent-graph-test".to_string()),diff --git a/crates/openhuman-core/src/threads/ops/edit_tests.rs b/crates/openhuman-core/src/threads/ops/edit_tests.rsindex 76efc26a0a..0cb99a2a57 100644--- a/crates/openhuman-core/src/threads/ops/edit_tests.rs+++ b/crates/openhuman-core/src/threads/ops/edit_tests.rs@@ -51,6 +51,7 @@ fn turn_usage() -> TurnUsage {cached_input: 0,context_window: 1_000_000,cost_usd: 0.0,+ ..Default::default()},ts: "2026-09-24T00:00:01Z".into(),reasoning_content: None,