Skip to content

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

feat(tinyagents): add copy provider to host module

Steven Enamakel044f7497e71d
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/copy.rs b/crates/openhuman-core/src/agent/tinyagents/host/copy.rs
new file mode 100644
index 0000000000..528b19b23a
--- /dev/null
+++ b/crates/openhuman-core/src/agent/tinyagents/host/copy.rs
@@ -0,0 +1,28 @@
+//! OpenHuman copy overrides for TinyAgents' provider-neutral stop summaries.
+
+use tinyagents_harness::turn_stop::{CopyProvider, CopyRequest, TurnStopCopyKey};
+
+pub(crate) struct OpenHumanCopyProvider;
+
+impl CopyProvider for OpenHumanCopyProvider {
+ fn copy_override(&self, request: &CopyRequest<'_>) -> Option<String> {
+ match request {
+ CopyRequest::ProviderConfig { tool, last_error } => Some(format!(
+ "Stopping: the `{tool}` step failed because the configured model/provider rejected the request (e.g. an unknown model, a non-chat/embedding model, a missing credential, or a region block) — retrying will not help. Fix the model or API key in Connections → API keys → LLM. Details:\n{last_error}"
+ )),
+ CopyRequest::TurnStop {
+ key: TurnStopCopyKey::ProviderConfig,
+ ..
+ } => Some(
+ "the configured model or provider rejected the request; check the model and API key in Connections".into(),
+ ),
+ CopyRequest::TurnStop {
+ key: TurnStopCopyKey::MissingConnection,
+ ..
+ } => Some(
+ "a service this needs isn't connected; connect it in Connections, then ask me to try again".into(),
+ ),
+ _ => None,
+ }
+ }
+}
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/mod.rs b/crates/openhuman-core/src/agent/tinyagents/host/mod.rs
index 8b85865150..ab3508d2ed 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/mod.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/mod.rs
@@ -29,6 +29,7 @@
pub mod budget_gate;
mod bundle;
+mod copy;
pub mod definition_registry;
mod operation_context;
pub mod run_context;
@@ -42,6 +43,7 @@ pub use bundle::{
OpenHumanHostInvocationInputs,
};
pub use definition_registry::OpenHumanDefinitionRegistry;
+pub(crate) use copy::OpenHumanCopyProvider;
pub use run_context::{
decide_dispatch, DispatchDecision, DispatchInputs, LastTurnUsage, OpenHumanRunContext,
OpenHumanRunExt, SubagentUsageEntry, TurnDispatchState,