Skip to content

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

feat(agent): add per-turn TurnOverrides for chat/small-talk turns\n\nIntroduce TurnOverrides { suppress_active_goal, suppress_tools,\nsuppress_memory_agent } and a pending_turn_overrides field on Agent, set\nvia Agent::set_next_turn_overrides and consumed by the next turn only.\n\nDefaults to no suppression, so every existing caller is byte-for-byte\nunchanged. The motivating case is a bare greeting / small-talk turn that\nmust run as a cheap conversational reply rather than the full agentic\ntask loop (tinyhumansai/opencompany#1725).\n\n

oxoxDev2ff3507dcf9e
diff --git a/src/openhuman/agent/harness/session/builder/setters.rs b/src/openhuman/agent/harness/session/builder/setters.rs
index 8d095966fd..ed0136a740 100644
--- a/src/openhuman/agent/harness/session/builder/setters.rs
+++ b/src/openhuman/agent/harness/session/builder/setters.rs
@@ -692,6 +692,7 @@ impl AgentBuilder {
archivist_hook: self.archivist_hook,
synthesized_tool_names: std::collections::HashSet::new(),
pending_synthesized_tools_mask: std::collections::HashSet::new(),
+ pending_turn_overrides: super::super::types::TurnOverrides::default(),
})
}
}
diff --git a/src/openhuman/agent/harness/session/mod.rs b/src/openhuman/agent/harness/session/mod.rs
index 717c58e50d..21d9dc3338 100644
--- a/src/openhuman/agent/harness/session/mod.rs
+++ b/src/openhuman/agent/harness/session/mod.rs
@@ -49,7 +49,7 @@ pub use migration::{migrate_session_layout_if_needed, MigrationOutcome};
#[cfg(test)]
mod tests;
-pub use types::{Agent, AgentBuilder};
+pub use types::{Agent, AgentBuilder, TurnOverrides};
// Re-export the duplicate-tool-spec guard for sibling harness modules
// (`session::runtime`, `subagent_runner`) so all provider call sites
diff --git a/src/openhuman/agent/harness/session/runtime.rs b/src/openhuman/agent/harness/session/runtime.rs
index b43c6c7c7e..4c0575357d 100644
--- a/src/openhuman/agent/harness/session/runtime.rs
+++ b/src/openhuman/agent/harness/session/runtime.rs
@@ -418,6 +418,19 @@ impl Agent {
self.history.clear();
}
+ /// Set the overrides applied to the **next** [`Self::turn`] call.
+ ///
+ /// The overrides are consumed at the top of the next turn (they apply to a
+ /// single turn, then reset to the default), so a caller running a chat /
+ /// small-talk turn calls this immediately before [`Self::turn`]. Callers
+ /// that never touch this get the unchanged full-agentic behaviour. See
+ /// [`TurnOverrides`](super::types::TurnOverrides) for the fields and the
+ /// motivating case (#1725: a bare greeting must not run the task loop nor
+ /// inherit a prior task's goal / tools / memory).
+ pub fn set_next_turn_overrides(&mut self, overrides: super::types::TurnOverrides) {
+ self.pending_turn_overrides = overrides;
+ }
+
/// Seed the next turn's LLM context from an authoritative message
/// log (e.g. the web channel's per-thread conversation JSONL).
///
diff --git a/src/openhuman/agent/harness/session/types.rs b/src/openhuman/agent/harness/session/types.rs
index 1b27c0d0f3..226e440681 100644
--- a/src/openhuman/agent/harness/session/types.rs
+++ b/src/openhuman/agent/harness/session/types.rs
@@ -22,6 +22,40 @@ use crate::openhuman::tools::{Tool, ToolSpec};
use std::path::PathBuf;
use std::sync::Arc;
+/// Per-turn behaviour overrides applied to a **single** [`Agent::turn`] call.
+///
+/// Defaults to all-`false`, so an agent built and driven exactly as before
+/// behaves identically — the overrides only take effect when a caller opts in
+/// via [`Agent::set_next_turn_overrides`] before dispatching a turn. The turn
+/// consumes (takes) them at its start, so they apply to exactly one turn and
+/// then reset to the default; a caller that wants a run of chat turns re-sets
+/// them each time.
+///
+/// The motivating case (opencompany issue #1725) is a bare greeting / small-talk
+/// turn that should run as a cheap conversational reply instead of the full
+/// agentic task loop: no tools to loop on, no pre-turn memory-agent retrieval,
+/// and no stale per-thread goal re-injected from a prior task. Each field is an
+/// independent, additive suppression so a caller can compose exactly the
+/// reduction it wants.
+#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
+pub struct TurnOverrides {
+ /// Skip loading, auto-resuming, and injecting this thread's durable
+ /// `[active_goal]` block for this turn (and skip arming the goal budget
+ /// stop hook). Prevents an uncompleted goal left by a prior task from
+ /// steering an unrelated chat turn.
+ pub suppress_active_goal: bool,
+ /// Run this turn with **no** tools regardless of the agent's built tool
+ /// set — the provider request carries an empty tool schema, so the model
+ /// cannot enter the tool loop and answers in one shot. The agent's durable
+ /// `tools` / `tool_specs` are left untouched, so the next (un-overridden)
+ /// turn has its full toolbelt back.
+ pub suppress_tools: bool,
+ /// Force [`TriggerMemoryAgent::Never`] behaviour for this turn — skip the
+ /// pre-turn `agent_memory` retrieval even when the agent's policy is
+ /// `Always`. The agent's built policy is left untouched for later turns.
+ pub suppress_memory_agent: bool,
+}
+
/// An autonomous or semi-autonomous AI agent.
///
/// The `Agent` is the central component that manages conversation state,
@@ -419,6 +453,14 @@ pub struct Agent {
///
/// Empty at construction time and whenever `tools` is fully reconciled.
pub(super) pending_synthesized_tools_mask: std::collections::HashSet<String>,
+ /// Overrides applied to the **next** [`Agent::turn`] call, then reset.
+ ///
+ /// Defaults to [`TurnOverrides::default`] (no suppression), so an agent
+ /// driven exactly as before is byte-for-byte unchanged. A caller sets this
+ /// via [`Agent::set_next_turn_overrides`] immediately before dispatching a
+ /// chat / small-talk turn; `turn()` takes it at the top so it applies to
+ /// one turn only. See [`TurnOverrides`] for the motivating case (#1725).
+ pub(super) pending_turn_overrides: TurnOverrides,
}
/// A builder for creating `Agent` instances with custom configuration.