The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore(integrations): remove Apify integration
Steven Enamakelfad530e56006
diff --git a/src/openhuman/config/schema/tools/integrations.rs b/src/openhuman/config/schema/tools/integrations.rsindex 3c36ff683f..1d06016afe 100644--- a/src/openhuman/config/schema/tools/integrations.rs+++ b/src/openhuman/config/schema/tools/integrations.rs@@ -182,10 +182,6 @@ impl Default for IntegrationToggle {#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Default)]#[serde(default)]pub struct IntegrationsConfig {- /// Apify actor execution and scraper integration.- #[serde(default)]- pub apify: IntegrationToggle,-/// Twilio phone-call integration.#[serde(default)]pub twilio: IntegrationToggle,diff --git a/src/openhuman/integrations/tools.rs b/src/openhuman/integrations/tools.rsindex 63d2f34e44..6c108f8d2d 100644--- a/src/openhuman/integrations/tools.rs+++ b/src/openhuman/integrations/tools.rs@@ -1,11 +1,9 @@use super::IntegrationClient;-mod apify;mod google_places;mod stock_prices;mod twilio;-pub use apify::{ApifyGetRunResultsTool, ApifyGetRunStatusTool, ApifyRunActorTool};pub use google_places::{GooglePlacesDetailsTool, GooglePlacesSearchTool};pub use stock_prices::{StockCommodityTool, StockCryptoSeriesTool, StockExchangeRateTool, StockOptionsTool,diff --git a/src/openhuman/integrations/tools/apify.rs b/src/openhuman/integrations/tools/apify.rsdeleted file mode 100644index d8d4c1de2e..0000000000--- a/src/openhuman/integrations/tools/apify.rs+++ /dev/null@@ -1,468 +0,0 @@-//! Apify actor execution and dataset retrieval integration tools.-//!-//! **Scope**: All (agent loop + CLI/RPC).-//!-//! **Endpoints**:-//! - `POST /agent-integrations/apify/run`-//! - `GET /agent-integrations/apify/runs/{runId}`-//! - `GET /agent-integrations/apify/runs/{runId}/results`-//!-//! Apify runs can be synchronous or asynchronous. The run tool starts an actor-//! and can optionally wait for completion; the status/results tools let the-//! caller poll long-running jobs and fetch the final dataset.--use super::IntegrationClient;-use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolCategory, ToolResult};-use async_trait::async_trait;-use serde::Deserialize;-use serde_json::json;-use std::sync::Arc;--#[derive(Debug, Deserialize)]-struct ApifyRunResponse {- #[serde(rename = "runId", default)]- run_id: String,- #[serde(rename = "actorId", default)]- actor_id: String,- #[serde(default)]- status: String,- #[serde(rename = "datasetId", default)]- dataset_id: Option<String>,- #[serde(default)]- items: Option<Vec<serde_json::Value>>,- #[serde(rename = "costUsd", default)]- cost_usd: f64,-}--#[derive(Debug, Deserialize)]-struct ApifyGetRunResultsResponse {- #[serde(default)]- items: Vec<serde_json::Value>,- #[serde(default)]- total: u64,-}--fn summarize_json_array(items: &[serde_json::Value], max_items: usize) -> String {- items- .iter()- .take(max_items)- .enumerate()- .map(|(idx, item)| format!("{}. {}", idx + 1, item))- .collect::<Vec<_>>()- .join("\n")-}--fn format_run_actor_response(resp: &ApifyRunResponse, sync: bool) -> String {- let mut lines = vec![- format!("Apify run started for actor: {}", resp.actor_id),- format!("Status: {}", resp.status),- ];-- if let Some(items) = resp.items.as_ref() {- lines.push(format!("Returned {} result item(s).", items.len()));- if !items.is_empty() {- lines.push("Sample results:".to_string());- lines.push(summarize_json_array(items, 3));- }- } else {- let follow_up = if sync {- "No inline result items were returned. Poll with apify_get_run_status or fetch results with apify_get_run_results."- } else {- "This run is still in progress. Poll with apify_get_run_status."- };- lines.push(follow_up.to_string());- lines- .push("Use the structured reference below for follow-up Apify tool calls.".to_string());- lines.push(format!(- "[apify_run_ref]\n{}\n[/apify_run_ref]",- format_apify_run_ref(resp)- ));- }-- lines.push(format!("Cost: ${:.4}", resp.cost_usd));- lines.join("\n")-}--fn format_run_status_response(resp: &ApifyRunResponse) -> String {- let mut lines = vec![- format!("Actor ID: {}", resp.actor_id),- format!("Status: {}", resp.status),- ];-- lines.push("Use the structured reference below for follow-up Apify tool calls.".to_string());- lines.push(format!(- "[apify_run_ref]\n{}\n[/apify_run_ref]",- format_apify_run_ref(resp)- ));- lines.push(format!("Cost: ${:.4}", resp.cost_usd));- lines.join("\n")-}--fn format_apify_run_ref(resp: &ApifyRunResponse) -> String {- serde_json::to_string(&json!({- "run_id": resp.run_id,- "dataset_id": resp.dataset_id,- "status": resp.status,- }))- .unwrap_or_else(|_| "{}".to_string())-}--fn run_actor_payload(resp: &ApifyRunResponse, display: &str) -> serde_json::Value {- json!({- "display": display,- "run_id": resp.run_id,- "actor_id": resp.actor_id,- "status": resp.status,- "dataset_id": resp.dataset_id,- "items": resp.items,- "cost_usd": resp.cost_usd,- })-}--fn run_status_payload(resp: &ApifyRunResponse, display: &str) -> serde_json::Value {- json!({- "display": display,- "run_id": resp.run_id,- "actor_id": resp.actor_id,- "status": resp.status,- "dataset_id": resp.dataset_id,- "cost_usd": resp.cost_usd,- })-}--/// Start an Apify actor run for scraping or data-collection workflows.-pub struct ApifyRunActorTool {- client: Arc<IntegrationClient>,-}--impl ApifyRunActorTool {- pub fn new(client: Arc<IntegrationClient>) -> Self {- Self { client }- }-}--#[async_trait]-impl Tool for ApifyRunActorTool {- fn name(&self) -> &str {- "apify_run_actor"- }-- fn description(&self) -> &str {- "Run an Apify actor with a JSON input payload. Use this for hosted \- scrapers, crawlers, and data-collection jobs. Set `sync=true` to wait \- for completion or `sync=false` for long-running jobs, then poll with \- apify_get_run_status and fetch results with apify_get_run_results."- }-- fn parameters_schema(&self) -> serde_json::Value {- json!({- "type": "object",- "properties": {- "actor_id": {- "type": "string",- "description": "Apify actor ID or actor slug to execute"- },- "input": {- "type": "object",- "description": "Actor input JSON object passed through to Apify"- },- "sync": {- "type": "boolean",- "description": "Wait for the actor to finish before returning (default true)",- "default": true- },- "timeout_secs": {- "type": "integer",- "description": "Max seconds to wait when sync=true (1-3600, default 120)",- "minimum": 1,- "maximum": 3600,- "default": 120- },- "memory_mbytes": {- "type": "integer",- "description": "Optional Apify memory allocation in MB (128-32768)",- "minimum": 128,- "maximum": 32768- }- },- "required": ["actor_id", "input"]- })- }-- fn permission_level(&self) -> PermissionLevel {- PermissionLevel::Execute- }-- fn category(&self) -> ToolCategory {- ToolCategory::Workflow- }-- async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {- let actor_id = args- .get("actor_id")- .and_then(|v| v.as_str())- .ok_or_else(|| anyhow::anyhow!("Missing required parameter: actor_id"))?;- if actor_id.trim().is_empty() {- return Ok(ToolResult::error("actor_id cannot be empty"));- }-- let Some(input) = args.get("input") else {- return Err(anyhow::anyhow!("Missing required parameter: input"));- };- if !input.is_object() {- return Ok(ToolResult::error("input must be a JSON object"));- }-- let sync = args.get("sync").and_then(|v| v.as_bool()).unwrap_or(true);- let timeout_secs = args- .get("timeout_secs")- .and_then(|v| v.as_u64())- .unwrap_or(120)- .clamp(1, 3600);- let memory_mbytes = args- .get("memory_mbytes")- .and_then(|v| v.as_u64())- .map(|v| v.clamp(128, 32768));-- let mut body = json!({- "actorId": actor_id,- "input": input,- "sync": sync,- "timeoutSecs": timeout_secs,- });- if let Some(memory_mbytes) = memory_mbytes {- body["memoryMbytes"] = json!(memory_mbytes);- }-- tracing::info!(- actor_id = actor_id,- sync = sync,- timeout_secs = timeout_secs,- has_memory_override = memory_mbytes.is_some(),- "[apify_run_actor] starting actor run"- );-- match self- .client- .post::<ApifyRunResponse>("/agent-integrations/apify/run", &body)- .await- {- Ok(resp) => {- tracing::debug!(- run_id = %resp.run_id,- dataset_id = resp.dataset_id.as_deref().unwrap_or(""),- status = %resp.status,- cost_usd = resp.cost_usd,- "[apify_run_actor] actor run accepted"- );- let display = format_run_actor_response(&resp, sync);- Ok(ToolResult::success_with_markdown(- run_actor_payload(&resp, &display),- display,- ))- }- Err(e) => Ok(ToolResult::error(format!("Apify actor run failed: {e}"))),- }- }-}--/// Fetch the current status for an existing Apify actor run.-pub struct ApifyGetRunStatusTool {- client: Arc<IntegrationClient>,-}--impl ApifyGetRunStatusTool {- pub fn new(client: Arc<IntegrationClient>) -> Self {- Self { client }- }-}--#[async_trait]-impl Tool for ApifyGetRunStatusTool {- fn name(&self) -> &str {- "apify_get_run_status"- }-- fn description(&self) -> &str {- "Get the status of a previously started Apify run. Use this to poll \- long-running actor jobs until they reach SUCCEEDED, FAILED, TIMED-OUT, \- or ABORTED."- }-- fn parameters_schema(&self) -> serde_json::Value {- json!({- "type": "object",- "properties": {- "run_id": {- "type": "string",- "description": "Apify run ID returned by apify_run_actor"- }- },- "required": ["run_id"]- })- }-- fn category(&self) -> ToolCategory {- ToolCategory::Workflow- }-- async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {- let run_id = args- .get("run_id")- .and_then(|v| v.as_str())- .ok_or_else(|| anyhow::anyhow!("Missing required parameter: run_id"))?;- if run_id.trim().is_empty() {- return Ok(ToolResult::error("run_id cannot be empty"));- }-- let path = format!("/agent-integrations/apify/runs/{run_id}");- tracing::debug!(- run_id = run_id,- "[apify_get_run_status] fetching run status"- );-- match self.client.get::<ApifyRunResponse>(&path).await {- Ok(resp) => {- tracing::debug!(- run_id = %resp.run_id,- dataset_id = resp.dataset_id.as_deref().unwrap_or(""),- status = %resp.status,- cost_usd = resp.cost_usd,- "[apify_get_run_status] fetched run status"- );- let display = format_run_status_response(&resp);- Ok(ToolResult::success_with_markdown(- run_status_payload(&resp, &display),- display,- ))- }- Err(e) => Ok(ToolResult::error(format!(- "Apify get run status failed: {e}"- ))),- }- }-}--/// Fetch dataset items for a completed Apify actor run.-pub struct ApifyGetRunResultsTool {- client: Arc<IntegrationClient>,-}--impl ApifyGetRunResultsTool {- pub fn new(client: Arc<IntegrationClient>) -> Self {- Self { client }- }-}--#[async_trait]-impl Tool for ApifyGetRunResultsTool {- fn name(&self) -> &str {- "apify_get_run_results"- }-- fn description(&self) -> &str {- "Fetch dataset items from a completed Apify run. Supports optional \- pagination with `limit` and `offset`."- }-- fn parameters_schema(&self) -> serde_json::Value {- json!({- "type": "object",- "properties": {- "run_id": {- "type": "string",- "description": "Apify run ID returned by apify_run_actor"- },- "limit": {- "type": "integer",- "description": "Max dataset items to return (1-1000)",- "minimum": 1,- "maximum": 1000- },- "offset": {- "type": "integer",- "description": "Pagination offset (0-100000)",- "minimum": 0,- "maximum": 100000- }- },- "required": ["run_id"]- })- }-- fn category(&self) -> ToolCategory {- ToolCategory::Workflow- }-- async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {- let run_id = args- .get("run_id")- .and_then(|v| v.as_str())- .ok_or_else(|| anyhow::anyhow!("Missing required parameter: run_id"))?;- if run_id.trim().is_empty() {- return Ok(ToolResult::error("run_id cannot be empty"));- }-- let limit = args- .get("limit")- .and_then(|v| v.as_u64())- .map(|v| v.clamp(1, 1000));- let offset = args- .get("offset")- .and_then(|v| v.as_u64())- .map(|v| v.clamp(0, 100000));-- let mut path = format!("/agent-integrations/apify/runs/{run_id}/results");- if limit.is_some() || offset.is_some() {- let mut query = Vec::new();- if let Some(limit) = limit {- query.push(format!("limit={limit}"));- }- if let Some(offset) = offset {- query.push(format!("offset={offset}"));- }- path.push('?');- path.push_str(&query.join("&"));- }-- tracing::debug!(- run_id = run_id,- limit = limit,- offset = offset,- "[apify_get_run_results] fetching dataset items"- );-- match self.client.get::<ApifyGetRunResultsResponse>(&path).await {- Ok(resp) => {- if resp.items.is_empty() {- tracing::debug!(- run_id = run_id,- total = resp.total,- "[apify_get_run_results] no dataset items found"- );- return Ok(ToolResult::success("No dataset items found.".to_string()));- }-- let mut lines = vec![- format!("Fetched {} dataset item(s).", resp.items.len()),- format!("Total available: {}", resp.total),- "Sample results:".to_string(),- summarize_json_array(&resp.items, 5),- ];-- if resp.items.len() > 5 {- lines.push("Output truncated to the first 5 items.".to_string());- }-- Ok(ToolResult::success(lines.join("\n")))- }- Err(e) => Ok(ToolResult::error(format!(- "Apify get run results failed: {e}"- ))),- }- }-}--#[cfg(test)]-#[path = "apify_tests.rs"]-mod tests;diff --git a/src/openhuman/integrations/tools/apify_tests.rs b/src/openhuman/integrations/tools/apify_tests.rsdeleted file mode 100644index d7a17c1490..0000000000--- a/src/openhuman/integrations/tools/apify_tests.rs+++ /dev/null@@ -1,209 +0,0 @@-use super::*;--fn test_client() -> Arc<IntegrationClient> {- Arc::new(IntegrationClient::new(- "http://test.example".into(),- "tok".into(),- ))-}--#[test]-fn run_tool_metadata() {- let tool = ApifyRunActorTool::new(test_client());- assert_eq!(tool.name(), "apify_run_actor");- assert_eq!(tool.permission_level(), PermissionLevel::Execute);- assert_eq!(tool.category(), ToolCategory::Workflow);- assert!(tool.description().contains("Apify actor"));-}--#[test]-fn run_tool_schema_has_required_fields() {- let tool = ApifyRunActorTool::new(test_client());- let schema = tool.parameters_schema();- let required = schema["required"].as_array().unwrap();- assert!(required.iter().any(|v| v == "actor_id"));- assert!(required.iter().any(|v| v == "input"));-}--#[tokio::test]-async fn run_tool_rejects_missing_actor_id() {- let tool = ApifyRunActorTool::new(test_client());- let result = tool.execute(json!({"input": {}})).await;- assert!(result.is_err());-}--#[tokio::test]-async fn run_tool_rejects_empty_actor_id() {- let tool = ApifyRunActorTool::new(test_client());- let result = tool- .execute(json!({"actor_id": "", "input": {}}))- .await- .unwrap();- assert!(result.is_error);- assert!(result.output().contains("actor_id"));-}--#[tokio::test]-async fn run_tool_rejects_non_object_input() {- let tool = ApifyRunActorTool::new(test_client());- let result = tool- .execute(json!({"actor_id": "apify/web-scraper", "input": []}))- .await- .unwrap();- assert!(result.is_error);- assert!(result.output().contains("input must be a JSON object"));-}--#[test]-fn status_tool_metadata() {- let tool = ApifyGetRunStatusTool::new(test_client());- assert_eq!(tool.name(), "apify_get_run_status");- assert_eq!(tool.category(), ToolCategory::Workflow);-}--#[tokio::test]-async fn status_tool_rejects_empty_run_id() {- let tool = ApifyGetRunStatusTool::new(test_client());- let result = tool.execute(json!({"run_id": ""})).await.unwrap();- assert!(result.is_error);- assert!(result.output().contains("run_id"));-}--#[test]-fn results_tool_schema_supports_pagination() {- let tool = ApifyGetRunResultsTool::new(test_client());- let schema = tool.parameters_schema();- assert!(schema["properties"]["limit"].is_object());- assert!(schema["properties"]["offset"].is_object());-}--#[tokio::test]-async fn results_tool_rejects_empty_run_id() {- let tool = ApifyGetRunResultsTool::new(test_client());- let result = tool.execute(json!({"run_id": ""})).await.unwrap();- assert!(result.is_error);- assert!(result.output().contains("run_id"));-}--#[test]-fn run_response_deserializes() {- let json = r#"{- "runId":"run-123",- "actorId":"apify/web-scraper",- "status":"SUCCEEDED",- "datasetId":"dataset-123",- "items":[{"url":"https://example.com"}],- "costUsd":0.3- }"#;- let resp: ApifyRunResponse = serde_json::from_str(json).unwrap();- assert_eq!(resp.run_id, "run-123");- assert_eq!(resp.actor_id, "apify/web-scraper");- assert_eq!(resp.status, "SUCCEEDED");- assert_eq!(resp.dataset_id.as_deref(), Some("dataset-123"));- assert_eq!(resp.items.unwrap().len(), 1);- assert!((resp.cost_usd - 0.3).abs() < f64::EPSILON);-}--#[test]-fn run_actor_output_hides_internal_ids() {- let resp = ApifyRunResponse {- run_id: "run-123".to_string(),- actor_id: "apify/web-scraper".to_string(),- status: "SUCCEEDED".to_string(),- dataset_id: Some("dataset-123".to_string()),- items: Some(vec![json!({"url": "https://example.com"})]),- cost_usd: 0.3,- };-- let output = format_run_actor_response(&resp, true);-- assert!(output.contains("Apify run started for actor: apify/web-scraper"));- assert!(output.contains("Status: SUCCEEDED"));- assert!(!output.contains("Run ID:"));- assert!(!output.contains("Dataset ID:"));- assert!(!output.contains("run-123"));- assert!(!output.contains("dataset-123"));-}--#[test]-fn run_actor_async_output_shows_polling_instruction() {- let resp = ApifyRunResponse {- run_id: "run-456".to_string(),- actor_id: "apify/crawler".to_string(),- status: "RUNNING".to_string(),- dataset_id: None,- items: None,- cost_usd: 0.05,- };-- let output = format_run_actor_response(&resp, false);- let prose = output- .split("[apify_run_ref]")- .next()- .expect("prose before ref");-- assert!(output.contains("This run is still in progress. Poll with apify_get_run_status."));- assert!(!prose.contains("run-456"));- assert!(output.contains("[apify_run_ref]"));- assert!(output.contains("\"run_id\":\"run-456\""));-}--#[test]-fn run_actor_sync_without_items_shows_follow_up_ref() {- let resp = ApifyRunResponse {- run_id: "run-789".to_string(),- actor_id: "apify/crawler".to_string(),- status: "RUNNING".to_string(),- dataset_id: Some("dataset-789".to_string()),- items: None,- cost_usd: 0.05,- };-- let output = format_run_actor_response(&resp, true);- let prose = output- .split("[apify_run_ref]")- .next()- .expect("prose before ref");-- assert!(output.contains("Poll with apify_get_run_status"));- assert!(!prose.contains("run-789"));- assert!(output.contains("[apify_run_ref]"));- assert!(output.contains("\"run_id\":\"run-789\""));- assert!(output.contains("\"dataset_id\":\"dataset-789\""));-}--#[test]-fn run_status_output_hides_internal_ids() {- let resp = ApifyRunResponse {- run_id: "run-123".to_string(),- actor_id: "apify/web-scraper".to_string(),- status: "RUNNING".to_string(),- dataset_id: Some("dataset-123".to_string()),- items: None,- cost_usd: 0.1,- };-- let output = format_run_status_response(&resp);- let prose = output- .split("[apify_run_ref]")- .next()- .expect("prose before ref");-- assert!(output.contains("Actor ID: apify/web-scraper"));- assert!(output.contains("Status: RUNNING"));- assert!(!prose.contains("Run ID:"));- assert!(!prose.contains("Dataset ID:"));- assert!(!prose.contains("run-123"));- assert!(!prose.contains("dataset-123"));- assert!(output.contains("[apify_run_ref]"));- assert!(output.contains("\"run_id\":\"run-123\""));- assert!(output.contains("\"dataset_id\":\"dataset-123\""));-}--#[test]-fn results_response_deserializes() {- let json = r#"{"items":[{"foo":"bar"}],"total":42}"#;- let resp: ApifyGetRunResultsResponse = serde_json::from_str(json).unwrap();- assert_eq!(resp.items.len(), 1);- assert_eq!(resp.total, 42);-}diff --git a/src/openhuman/platform/about_app/catalog_data.rs b/src/openhuman/platform/about_app/catalog_data.rsindex a5821cae18..f2c2f9e659 100644--- a/src/openhuman/platform/about_app/catalog_data.rs+++ b/src/openhuman/platform/about_app/catalog_data.rs@@ -785,16 +785,6 @@ pub(super) const CAPABILITIES: &[Capability] = &[status: CapabilityStatus::Beta,privacy: DERIVED_TO_BACKEND,},- Capability {- id: "workflows.run_apify_actors",- name: "Run Apify Actors",- domain: "workflows",- category: CapabilityCategory::Workflows,- description: "Launch Apify scrapers and automation actors, then inspect run status and collected results.",- how_to: "Conversations > Ask the assistant to run an Apify actor",- status: CapabilityStatus::Beta,- privacy: None,- },Capability {id: "workflows.tinyfish_web_automation",name: "TinyFish Web Automation",diff --git a/src/openhuman/tools/ops.rs b/src/openhuman/tools/ops.rsindex 66de19b0cc..e4b2a312e4 100644--- a/src/openhuman/tools/ops.rs+++ b/src/openhuman/tools/ops.rs@@ -1130,20 +1130,6 @@ pub fn all_tools_with_runtime(// ── Agent integration tools (backend-proxied) ─────────────────if let Some(client) = crate::openhuman::integrations::build_client(root_config) {tracing::debug!("[integrations] client built successfully");- if root_config.integrations.apify.is_active() {- tools.push(Box::new(crate::openhuman::tools::ApifyRunActorTool::new(- Arc::clone(&client),- )));- tools.push(Box::new(- crate::openhuman::tools::ApifyGetRunStatusTool::new(Arc::clone(&client)),- ));- tools.push(Box::new(- crate::openhuman::tools::ApifyGetRunResultsTool::new(Arc::clone(&client)),- ));- tracing::debug!("[integrations] registered apify tools");- } else {- tracing::debug!("[integrations] apify disabled — skipping");- }if root_config.integrations.google_places.is_active() {tools.push(Box::new(crate::openhuman::tools::GooglePlacesSearchTool::new(Arc::clone(&client)),