Skip to content

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

feat(flows): add get_flow_run copilot tool and long-deadline invoke proxy

Steven Enamakel655dcf426788
diff --git a/crates/openhuman-core/src/flows/copilot_bus.rs b/crates/openhuman-core/src/flows/copilot_bus.rs
index 38ea499d44..57243f0eed 100644
--- a/crates/openhuman-core/src/flows/copilot_bus.rs
+++ b/crates/openhuman-core/src/flows/copilot_bus.rs
@@ -114,7 +114,7 @@ impl BusCopilotTool {
)
.await
.map_err(anyhow::Error::msg)?;
- let proxy = crate::modules::tinyflows::copilot_proxy(&self.config)
+ let proxy = crate::modules::tinyflows::copilot_invoke_proxy(&self.config)
.await
.map_err(anyhow::Error::msg)?;
let request = tinyflows_bus::copilot::InvokeToolRequest {
diff --git a/crates/openhuman-core/src/flows/registration.rs b/crates/openhuman-core/src/flows/registration.rs
index 52986b8dca..fdf000f49e 100644
--- a/crates/openhuman-core/src/flows/registration.rs
+++ b/crates/openhuman-core/src/flows/registration.rs
@@ -50,6 +50,7 @@ pub(crate) fn tools(config: Arc<Config>, security: &Arc<SecurityPolicy>) -> Vec<
"duplicate_flow",
"list_flows",
"get_flow",
+ "get_flow_run",
] {
push_copilot_tool(&mut tools, copilot.as_ref(), name);
}
diff --git a/crates/openhuman-core/src/modules/tinyflows.rs b/crates/openhuman-core/src/modules/tinyflows.rs
index 4f6ee6b3ca..ce91b598aa 100644
--- a/crates/openhuman-core/src/modules/tinyflows.rs
+++ b/crates/openhuman-core/src/modules/tinyflows.rs
@@ -112,6 +112,22 @@ mod imp {
.map_err(|error| format!("the tinyflows copilot object is unreachable: {error}"))
}
+ async fn copilot_invoke_interface_proxy(config: &Config) -> Result<Proxy, String> {
+ ensure(config).await?;
+ let runtime = runtime::runtime()
+ .await
+ .map_err(|error| format!("the module bus is unavailable: {error}"))?;
+ runtime
+ .connection()
+ .proxy(
+ tinyflows_bus::BUS_NAME,
+ tinyflows_bus::OBJECT_PATH,
+ tinyflows_bus::copilot::INTERFACE,
+ )
+ .map(|proxy| proxy.with_timeout(RUN_TIMEOUT))
+ .map_err(|error| format!("the tinyflows copilot object is unreachable: {error}"))
+ }
+
/// A proxy for the module's `Schedule` object (store, maths and
/// validation members, which answer quickly).
pub(crate) async fn proxy(config: &Config) -> Result<Proxy, String> {
@@ -128,6 +144,11 @@ mod imp {
copilot_interface_proxy(config).await
}
+ /// A long-deadline Copilot proxy for module-owned tool execution.
+ pub(crate) async fn copilot_invoke_proxy(config: &Config) -> Result<Proxy, String> {
+ copilot_invoke_interface_proxy(config).await
+ }
+
/// Serve `object` at `path` on the module bus, on the module runtime, and
/// own the host bus name. Idempotent per path only if `path` is unserved
/// first ([`unserve`]).
@@ -188,7 +209,7 @@ mod imp {
mod fixture;
#[cfg(feature = "modules")]
-pub(crate) use imp::{copilot_proxy, proxy, run_proxy, serve, unserve};
+pub(crate) use imp::{copilot_invoke_proxy, copilot_proxy, proxy, run_proxy, serve, unserve};
#[cfg(not(feature = "modules"))]
mod imp {
@@ -216,6 +237,12 @@ mod imp {
Err(unavailable(config))
}
+ pub(crate) async fn copilot_invoke_proxy(
+ config: &Config,
+ ) -> Result<tinybus::Proxy, String> {
+ Err(unavailable(config))
+ }
+
pub(crate) async fn serve(
_path: String,
_object: impl tinybus::service::Interface + 'static,
@@ -227,7 +254,7 @@ mod imp {
}
#[cfg(not(feature = "modules"))]
-pub(crate) use imp::{copilot_proxy, proxy, run_proxy, serve, unserve};
+pub(crate) use imp::{copilot_invoke_proxy, copilot_proxy, proxy, run_proxy, serve, unserve};
/// Whether the module can serve in this build and configuration (the switch
/// is on and the loader exists). Does not load anything.