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
feat(tools): add Twilio integration tools
Steven Enamakel97eb3e642ec3
diff --git a/crates/openhuman-core/src/integrations/tools.rs b/crates/openhuman-core/src/integrations/tools.rsindex 6c108f8d2d..4cb3d10d6a 100644--- a/crates/openhuman-core/src/integrations/tools.rs+++ b/crates/openhuman-core/src/integrations/tools.rs@@ -2,11 +2,9 @@ use super::IntegrationClient;mod google_places;mod stock_prices;-mod twilio;pub use google_places::{GooglePlacesDetailsTool, GooglePlacesSearchTool};pub use stock_prices::{StockCommodityTool, StockCryptoSeriesTool, StockExchangeRateTool, StockOptionsTool,StockQuoteTool,};-pub use twilio::TwilioCallTool;diff --git a/crates/openhuman-core/src/integrations/tools/twilio.rs b/crates/openhuman-core/src/integrations/tools/twilio.rsdeleted file mode 100644index 25b131720d..0000000000--- a/crates/openhuman-core/src/integrations/tools/twilio.rs+++ /dev/null@@ -1,154 +0,0 @@-//! Twilio phone-call integration tool.-//!-//! **Scope**: CLI/RPC only — phone calls require explicit user action.-//!-//! **Endpoint**: `POST /agent-integrations/twilio/call`-//!-//! **Pricing** (fetched from backend):-//! - Outbound calls: ~$0.03/min-//! - Inbound calls: ~$0.017/min-//!-//! The backend handles Twilio API credentials, billing, and rate limiting.--use super::IntegrationClient;-use async_trait::async_trait;-use serde::Deserialize;-use serde_json::json;-use std::sync::Arc;-use tinytools::{PermissionLevel, Tool, ToolResult, ToolScope};--/// Makes outbound phone calls via the backend Twilio integration.-pub struct TwilioCallTool {- client: Arc<IntegrationClient>,-}--#[derive(Debug, Deserialize)]-struct TwilioCallResponse {- #[serde(rename = "callSid")]- call_sid: String,- status: String,- #[serde(rename = "costUsd", default)]- cost_usd: f64,-}--impl TwilioCallTool {- pub fn new(client: Arc<IntegrationClient>) -> Self {- Self { client }- }-}--#[async_trait]-impl Tool for TwilioCallTool {- fn name(&self) -> &str {- "twilio_call"- }-- fn description(&self) -> &str {- "Make an outbound phone call via Twilio. Requires at least one of: \- a text message to speak, raw TwiML markup, or a TwiML URL. \- The call is placed immediately and the result includes the call SID \- and initial status. Cost is billed per minute by the backend."- }-- fn parameters_schema(&self) -> serde_json::Value {- json!({- "type": "object",- "properties": {- "to": {- "type": "string",- "description": "Phone number to call in E.164 format (e.g. +14155551234)"- },- "message": {- "type": "string",- "description": "Plain text message to speak on the call (uses TTS)"- },- "twiml": {- "type": "string",- "description": "Raw TwiML XML to control call flow (advanced)"- },- "url": {- "type": "string",- "description": "URL that returns TwiML for call flow (advanced)"- }- },- "required": ["to"]- })- }-- fn permission_level(&self) -> PermissionLevel {- PermissionLevel::Execute- }-- fn scope(&self) -> ToolScope {- ToolScope::CliRpcOnly- }-- async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {- let to = args- .get("to")- .and_then(|v| v.as_str())- .ok_or_else(|| anyhow::anyhow!("Missing required parameter: to"))?;-- if to.trim().is_empty() {- return Ok(ToolResult::error("Phone number 'to' cannot be empty"));- }-- let message = args.get("message").and_then(|v| v.as_str());- let twiml = args.get("twiml").and_then(|v| v.as_str());- let url = args.get("url").and_then(|v| v.as_str());-- if message.is_none() && twiml.is_none() && url.is_none() {- return Ok(ToolResult::error(- "At least one of 'message', 'twiml', or 'url' must be provided",- ));- }-- let mut body = json!({ "to": to });- if let Some(m) = message {- body["message"] = json!(m);- }- if let Some(t) = twiml {- body["twiml"] = json!(t);- }- if let Some(u) = url {- body["url"] = json!(u);- }-- let redacted = if to.len() > 4 {- format!(- "{}***{}",- &to[..to.char_indices().nth(2).map_or(2, |(i, _)| i)],- &to[to- .char_indices()- .rev()- .nth(3)- .map_or(to.len().saturating_sub(4), |(i, _)| i)..]- )- } else {- "****".to_string()- };- tracing::info!("[twilio_call] calling {}", redacted);-- match self- .client- .post::<TwilioCallResponse>("/agent-integrations/twilio/call", &body)- .await- {- Ok(resp) => {- let output = format!(- "Call placed successfully.\n\- Call SID: {}\n\- Status: {}\n\- Cost: ${:.4}",- resp.call_sid, resp.status, resp.cost_usd- );- Ok(ToolResult::success(output))- }- Err(e) => Ok(ToolResult::error(format!("Twilio call failed: {e}"))),- }- }-}--#[cfg(test)]-#[path = "twilio_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/integrations/tools/twilio_tests.rs b/crates/openhuman-core/src/integrations/tools/twilio_tests.rsdeleted file mode 100644index 9cc21f29e0..0000000000--- a/crates/openhuman-core/src/integrations/tools/twilio_tests.rs+++ /dev/null@@ -1,57 +0,0 @@-use super::*;--#[test]-fn tool_metadata() {- let client = Arc::new(IntegrationClient::new("http://test".into(), "tok".into()));- let tool = TwilioCallTool::new(client);- assert_eq!(tool.name(), "twilio_call");- assert_eq!(tool.permission_level(), PermissionLevel::Execute);- assert_eq!(tool.scope(), ToolScope::CliRpcOnly);- assert!(tool.description().contains("phone call"));-}--#[test]-fn schema_has_required_to() {- let client = Arc::new(IntegrationClient::new("http://test".into(), "tok".into()));- let tool = TwilioCallTool::new(client);- let schema = tool.parameters_schema();- assert_eq!(schema["type"], "object");- assert!(schema["properties"]["to"].is_object());- let required = schema["required"].as_array().unwrap();- assert!(required.iter().any(|v| v == "to"));-}--#[tokio::test]-async fn execute_rejects_missing_to() {- let client = Arc::new(IntegrationClient::new("http://test".into(), "tok".into()));- let tool = TwilioCallTool::new(client);- let result = tool.execute(json!({})).await;- assert!(result.is_err());-}--#[tokio::test]-async fn execute_rejects_empty_to() {- let client = Arc::new(IntegrationClient::new("http://test".into(), "tok".into()));- let tool = TwilioCallTool::new(client);- let result = tool.execute(json!({"to": ""})).await.unwrap();- assert!(result.is_error);- assert!(result.output().contains("empty"));-}--#[tokio::test]-async fn execute_rejects_no_content() {- let client = Arc::new(IntegrationClient::new("http://test".into(), "tok".into()));- let tool = TwilioCallTool::new(client);- let result = tool.execute(json!({"to": "+14155551234"})).await.unwrap();- assert!(result.is_error);- assert!(result.output().contains("message"));-}--#[test]-fn twilio_response_deserializes() {- let json = r#"{"callSid":"CA123","status":"queued","costUsd":0.03}"#;- let resp: TwilioCallResponse = serde_json::from_str(json).unwrap();- assert_eq!(resp.call_sid, "CA123");- assert_eq!(resp.status, "queued");- assert!((resp.cost_usd - 0.03).abs() < f64::EPSILON);-}diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rsindex 51c8ab8a7b..f4a6151ef0 100644--- a/crates/openhuman-core/src/tools/ops.rs+++ b/crates/openhuman-core/src/tools/ops.rs@@ -882,14 +882,6 @@ pub fn all_tools_with_runtime(} else {tracing::debug!("[integrations] stock_prices disabled — skipping");}- if root_config.integrations.twilio.is_active() {- tools.push(Box::new(crate::tools::TwilioCallTool::new(Arc::clone(- &client,- ))));- tracing::debug!("[integrations] registered twilio tools");- } else {- tracing::debug!("[integrations] twilio disabled — skipping");- }} else {tracing::debug!("[integrations] build_client returned None — integration tools not registered"diff --git a/crates/openhuman-core/src/tools/ops_tool_groups.rs b/crates/openhuman-core/src/tools/ops_tool_groups.rsindex bf00e0809e..1cb97379a7 100644--- a/crates/openhuman-core/src/tools/ops_tool_groups.rs+++ b/crates/openhuman-core/src/tools/ops_tool_groups.rs@@ -195,7 +195,6 @@ pub(crate) fn tool_group(name: &str) -> crate::core::all::DomainGroup {|| name.starts_with("stock_")|| name.starts_with("storage_")|| name.starts_with("task_source_")- || name == "twilio_call"// Hosting: `hosting_` is a domain-exclusive prefix, so a NEW hosting// tool auto-gates rather than falling through to Platform and staying// callable under a custom DomainSet. `hosting_launch_site` uploads a