Skip to content

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

feat(network): add host tool for network operations

Steven Enamakelc7fd6d9a10f3
diff --git a/crates/openhuman-core/src/tools/impl/network/host.rs b/crates/openhuman-core/src/tools/impl/network/host.rs
index 668c5f9dd8..fc752f12d2 100644
--- a/crates/openhuman-core/src/tools/impl/network/host.rs
+++ b/crates/openhuman-core/src/tools/impl/network/host.rs
@@ -10,7 +10,7 @@ use std::sync::Arc;
#[cfg(feature = "web3")]
use tinytools::{PermissionLevel, Tool, ToolResult};
use tinytools_std::network::{
- AsyncHtmlExtractor, HttpLimits, HttpRequestTool, NetGate, WebFetchTool,
+ AsyncHtmlExtractor, CurlTool, HttpLimits, HttpRequestTool, NetGate, WebFetchTool,
};
use super::gate::RoutedGate;
@@ -176,6 +176,28 @@ impl Tool for X402RequestTool {
}
}
+/// `curl` for chat turns: built for each call around that call's chat, so its
+/// egress disclosure reaches that chat.
+pub fn routed_curl_tool(
+ policy: Arc<SecurityPolicy>,
+ allowed_domains: Vec<String>,
+ action_dir: std::path::PathBuf,
+ dest_subdir: String,
+ max_download_bytes: u64,
+ timeout_secs: u64,
+) -> PerCallTool<CurlTool> {
+ PerCallTool::new(move |chat| {
+ CurlTool::new(
+ Arc::new(RoutedGate::new(Arc::clone(&policy), chat)),
+ allowed_domains.clone(),
+ action_dir.clone(),
+ dest_subdir.clone(),
+ max_download_bytes,
+ timeout_secs,
+ )
+ })
+}
+
/// `web_fetch` for chat turns: built for each call around that call's chat, so
/// its egress disclosure reaches that chat.
pub fn routed_web_fetch_tool(
diff --git a/crates/openhuman-core/src/tools/impl/network/mod.rs b/crates/openhuman-core/src/tools/impl/network/mod.rs
index d9a52507d1..9c9bea8eb8 100644
--- a/crates/openhuman-core/src/tools/impl/network/mod.rs
+++ b/crates/openhuman-core/src/tools/impl/network/mod.rs
@@ -23,7 +23,10 @@ pub use gitbooks::{GitbooksGetPageTool, GitbooksSearchTool};
pub use gmail_unsubscribe::GmailUnsubscribeTool;
#[cfg(feature = "web3")]
pub(crate) use host::x402_request_tool;
-pub use host::{http_request_tool, routed_http_request_tool, routed_web_fetch_tool, web_fetch_tool};
+pub use host::{
+ http_request_tool, routed_curl_tool, routed_http_request_tool, routed_web_fetch_tool,
+ web_fetch_tool,
+};
#[cfg(feature = "mcp")]
pub use mcp::{mcp_call_tool, McpListServersTool, McpListToolsTool};
#[cfg(feature = "mcp")]
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index 9998e42101..97a19bfe3a 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -337,25 +337,14 @@ pub fn all_tools_with_runtime(
// curl — always registered. Shares `http_request.allowed_domains`,
// adds streaming-to-disk with a hard byte ceiling. Writes land
// under `<workspace>/<curl.dest_subdir>`.
- tools.push(Box::new(PerCallTool::new({
- let security = security.clone();
- let allowed_domains = http_config.allowed_domains.clone();
- let action_dir = action_dir.to_path_buf();
- let dest_subdir = root_config.curl.dest_subdir.clone();
- let max_download_bytes = root_config.curl.max_download_bytes;
- let timeout_secs = root_config.curl.timeout_secs;
- // Built per call so the disclosure reaches that call's chat.
- move |chat| {
- CurlTool::new(
- Arc::new(RoutedGate::new(security.clone(), chat)),
- allowed_domains.clone(),
- action_dir.clone(),
- dest_subdir.clone(),
- max_download_bytes,
- timeout_secs,
- )
- }
- })));
+ tools.push(Box::new(routed_curl_tool(
+ security.clone(),
+ http_config.allowed_domains.clone(),
+ action_dir.to_path_buf(),
+ root_config.curl.dest_subdir.clone(),
+ root_config.curl.max_download_bytes,
+ root_config.curl.timeout_secs,
+ )));
// gitbooks — answers questions about OpenHuman by calling the
// GitBook MCP server. Two tools mirroring the upstream MCP tools.