Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(tinyagents): add response shape tests for turn runner

Steven Enamakel243ce448cc30
diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rs
index 7da74626d8..8b6665a797 100644
--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs
@@ -50,6 +50,7 @@ pub mod run_mode;
// for rather than an exotic one.
pub mod payload_summarizer;
mod policy_denial;
+pub mod response_shape;
pub(crate) mod reaper;
pub(crate) mod reasoning;
pub(crate) mod replay;
diff --git a/crates/openhuman-core/src/agent/tinyagents/response_shape_tests.rs b/crates/openhuman-core/src/agent/tinyagents/response_shape_tests.rs
index 956bf5f82f..8412e62115 100644
--- a/crates/openhuman-core/src/agent/tinyagents/response_shape_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/response_shape_tests.rs
@@ -1,18 +1,15 @@
use super::*;
-use tinyinference_llm::message::AssistantMessage;
use tinyinference_llm::usage::Usage;
fn response(finish: &str, reasoning: u64, cached: bool) -> ModelResponse {
- ModelResponse {
- message: AssistantMessage::default(),
- usage: Some(Usage {
+ let mut response = ModelResponse::assistant("{}")
+ .with_usage(Usage {
reasoning_tokens: reasoning,
..Default::default()
- }),
- finish_reason: Some(finish.to_string()),
- served_from_cache: cached,
- ..Default::default()
- }
+ })
+ .with_finish_reason(finish);
+ response.served_from_cache = cached;
+ response
}
#[test]
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
index dfa6b3c9e5..9f274c0ef2 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
@@ -248,7 +248,7 @@ async fn run_turn_via_tinyagents_inner(
// the caller via `build_turn_models`: the seam is crate-native and names no `Provider` (#4249,
// Phase 5). The telemetry id (`{provider_id}.{model}` in Langfuse) rides in as a param.
let AssembledTurnHarness {
- harness,
+ mut harness,
cursor,
tool_names,
failure_map,