Skip to content

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

feat(session): filter thread-goal tools from non-thread sessions

Steven Enamakel5e8163560ec9
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
index 860690a138..98f7ece158 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -364,6 +364,12 @@ impl OpenHumanTurnPrelude {
let specs = surface
.visible_tool_specs
.iter()
+ .filter(|spec| {
+ self.thread_id.is_some()
+ || !crate::agent::tinyagents::harness_tool_registration::is_thread_goal_tool(
+ &spec.name,
+ )
+ })
.map(|spec| spec.as_ref().clone())
.collect::<Vec<_>>();
let instructions = self.tool_dispatcher.prompt_instructions(&specs);
@@ -371,10 +377,21 @@ impl OpenHumanTurnPrelude {
.tools
.iter()
.chain(surface.synthesized_tools.iter())
+ .filter(|tool| {
+ self.thread_id.is_some()
+ || !crate::agent::tinyagents::harness_tool_registration::is_thread_goal_tool(
+ tool.name(),
+ )
+ })
.map(|tool| tool.as_ref())
.collect::<Vec<_>>();
let mut prompt_tools = PromptTool::from_tool_refs(tool_refs.iter().copied());
let mut visible_tool_names = surface.tool_policy_session.visible_tool_names_for_prompt();
+ if self.thread_id.is_none() {
+ visible_tool_names.retain(|name| {
+ !crate::agent::tinyagents::harness_tool_registration::is_thread_goal_tool(name)
+ });
+ }
crate::agent::prompts::swap_deferred_for_discovery_bridge(
&mut prompt_tools,
&mut visible_tool_names,
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_tool_registration.rs b/crates/openhuman-core/src/agent/tinyagents/harness_tool_registration.rs
index 1c39dcf748..c5b958551c 100644
--- a/crates/openhuman-core/src/agent/tinyagents/harness_tool_registration.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/harness_tool_registration.rs
@@ -69,7 +69,7 @@ pub(crate) fn typed_dispatch_for(
/// Whether `name` is one of the model-facing per-thread goal tools
/// (`goal_get` / `goal_set` / `goal_complete`), named by their owner.
-fn is_thread_goal_tool(name: &str) -> bool {
+pub(crate) fn is_thread_goal_tool(name: &str) -> bool {
GoalToolKind::MODEL_FACING
.iter()
.any(|kind| kind.name() == name)