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 when no thread is active

Steven Enamakelb5ba15283ad6
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 f5ce225c6a..b57907b68e 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -270,6 +270,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);
@@ -277,10 +283,23 @@ 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());
+ prompt_tools.retain(|tool| !surface.permanent_tool_names.contains(tool.name.as_ref()));
let mut visible_tool_names = surface.tool_policy_session.visible_tool_names_for_prompt();
+ visible_tool_names.retain(|name| !surface.permanent_tool_names.contains(name));
+ 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,