Skip to content

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

refactor(tinyagents): drop precomposed root context composer

Steven Enamakel7d799eeffcfc
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
index 3ed96781d9..f53e8b1941 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
@@ -8,10 +8,11 @@
//! finalize the run into a [`TinyagentsTurnOutcome`].
use std::collections::{BTreeSet, HashSet};
-use std::sync::Arc;
+use std::sync::{Arc, LazyLock};
use anyhow::Result;
use tinyagents_harness::runtime::{AgentInvocation, AgentTurnRequest, InvocationRuntime};
+use tinyagents_harness::runtime::AgentHarness;
use tinyagents_harness::store::{InMemoryStore as ToolResultArtifactIndexStore, StoreRegistry};
use tinyagents_harness::turn_policy::effective_max_iterations;
use tinyagents_runtime::turn_driver::{
@@ -50,7 +51,12 @@ use super::ToolPolicyEnforcement;
/// security or workspace state on a shared harness.
#[path = "turn_exec_hosted.rs"]
mod turn_exec_hosted;
-use turn_exec_hosted::{root_hosted_harness, PrecomposedRootContext};
+static ROOT_HOSTED_HARNESS: LazyLock<AgentHarness<(), OpenHumanRunContext>> =
+ LazyLock::new(AgentHarness::new);
+
+fn root_hosted_harness() -> &'static AgentHarness<(), OpenHumanRunContext> {
+ &ROOT_HOSTED_HARNESS
+}
#[cfg(test)]
#[path = "turn_exec_tests.rs"]
@@ -596,12 +602,6 @@ async fn drive_turn(
},
&run_context,
);
- // The root session has already assembled its exact system prompt,
- // learned context and history before this graph runs. Keep those bytes
- // as the hosted request rather than composing/recalling a second copy;
- // the host still owns definition resolution, security, model routing,
- // budgets, progress and outcome classification for this invocation.
- host_bundle.capabilities.context = Arc::new(PrecomposedRootContext);
host_bundle.capabilities.memory = None;
host_bundle.capabilities.experience = None;
// Session finalization owns the full-fidelity hook payload (including
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec_hosted.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec_hosted.rs
deleted file mode 100644
index 8063f3323b..0000000000
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec_hosted.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-//! Process-shared hosted harness used only for root agent invocations.
-
-use async_trait::async_trait;
-use std::sync::LazyLock;
-use tinyagents_harness::host::{ContextComposer, TurnContextRequest};
-use tinyagents_harness::runtime::AgentHarness;
-
-use crate::agent::tinyagents::host::OpenHumanRunContext;
-
-static ROOT_HOSTED_HARNESS: LazyLock<AgentHarness<(), OpenHumanRunContext>> =
- LazyLock::new(AgentHarness::new);
-
-pub(super) fn root_hosted_harness() -> &'static AgentHarness<(), OpenHumanRunContext> {
- &ROOT_HOSTED_HARNESS
-}
-
-/// Keeps the session's already-built system/context ladder authoritative when
-/// crossing the hosted invocation boundary.
-pub(super) struct PrecomposedRootContext;
-
-#[async_trait]
-impl ContextComposer for PrecomposedRootContext {
- async fn compose_system_prompt(
- &self,
- _: &TurnContextRequest,
- ) -> tinyagents_harness::Result<String> {
- Ok(String::new())
- }
-
- async fn preamble(
- &self,
- _: &TurnContextRequest,
- ) -> tinyagents_harness::Result<Vec<tinyinference_llm::message::Message>> {
- Ok(Vec::new())
- }
-}
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs
index aab0253902..b73ece8b8d 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs
@@ -2,7 +2,6 @@ use super::*;
use crate::agent::tinyagents::TurnModelSource;
use async_trait::async_trait;
use std::sync::Arc;
-use tinyagents_harness::host::{ContextComposer, TurnContextRequest};
use tinyinference_llm::model::{ChatModel, ModelProfile, ModelRequest, ModelResponse};
use tinyinference_llm::tool::ToolCall;
use tinytools::{Tool, ToolResult};
@@ -316,29 +315,6 @@ async fn hosted_root_screens_only_the_new_input_not_replayed_history() {
.expect_err("the new input is still screened as user input");
}
-#[tokio::test]
-async fn precomposed_root_context_does_not_duplicate_the_session_prompt_or_preamble() {
- let request =
- TurnContextRequest::new("main", tinyagents_harness::ids::ThreadId::new("t"), "hi");
-
- assert_eq!(
- PrecomposedRootContext
- .compose_system_prompt(&request)
- .await
- .expect("precomposed root context composes"),
- "",
- "the frozen session system/context ladder stays in the invocation request"
- );
- assert!(
- PrecomposedRootContext
- .preamble(&request)
- .await
- .expect("precomposed root context builds preamble")
- .is_empty(),
- "host preparation must not insert a second root preamble"
- );
-}
-
#[test]
fn hosted_roots_share_only_an_unconfigured_process_harness() {
let first = root_hosted_harness() as *const _;
diff --git a/vendor/tinyagents b/vendor/tinyagents
index b183617638..603e846f49 160000
--- a/vendor/tinyagents
+++ b/vendor/tinyagents
@@ -1 +1 @@
-Subproject commit b183617638e5121e8b5941dae29673f574656177
+Subproject commit 603e846f4982fa5d3fc36d03c1a4c1859bfcd4c3