pub struct WorkbenchExecutor { /* private fields */ }Expand description
Workbench executor
Implementations§
Source§impl WorkbenchExecutor
impl WorkbenchExecutor
Sourcepub fn new(client: Arc<ComposioClient>, session_id: impl Into<String>) -> Self
pub fn new(client: Arc<ComposioClient>, session_id: impl Into<String>) -> Self
Create a new workbench executor
§Arguments
client- Composio client instancesession_id- Session ID for workbench context
§Example
use composio_sdk::{ComposioClient, meta_tools::WorkbenchExecutor};
use std::sync::Arc;
let client = ComposioClient::builder()
.api_key("your-api-key")
.build()?;
let executor = WorkbenchExecutor::new(Arc::new(client), "session_123");Sourcepub async fn execute_python(
&self,
code: &str,
) -> Result<WorkbenchResult, ComposioError>
pub async fn execute_python( &self, code: &str, ) -> Result<WorkbenchResult, ComposioError>
Execute Python code in the workbench
§Arguments
code- Python code to execute
§Returns
Workbench execution result
§Example
let executor = WorkbenchExecutor::new(client, "session_123");
let code = r#"
import pandas as pd
df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
print(df.describe())
"#;
let result = executor.execute_python(code).await?;
println!("Output: {}", result.output);Sourcepub fn generate_pandas_code(&self, operation: PandasOperation) -> String
pub fn generate_pandas_code(&self, operation: PandasOperation) -> String
Generate Python code for pandas operations
§Arguments
operation- Pandas operation to generate code for
§Returns
Python code string
§Example
let executor = WorkbenchExecutor::new(client, "session_123");
let code = executor.generate_pandas_code(PandasOperation::ReadCsv {
url: "https://example.com/data.csv".to_string(),
});
let result = executor.execute_python(&code).await?;Sourcepub fn generate_excel_code(&self, operation: ExcelOperation) -> String
pub fn generate_excel_code(&self, operation: ExcelOperation) -> String
Generate Python code for Excel operations
§Arguments
operation- Excel operation to generate code for
§Returns
Python code string
§Example
let executor = WorkbenchExecutor::new(client, "session_123");
let code = executor.generate_excel_code(ExcelOperation::Read {
s3_url: "https://s3.amazonaws.com/bucket/file.xlsx".to_string(),
});
let result = executor.execute_python(&code).await?;Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Get session ID
Auto Trait Implementations§
impl Freeze for WorkbenchExecutor
impl !RefUnwindSafe for WorkbenchExecutor
impl Send for WorkbenchExecutor
impl Sync for WorkbenchExecutor
impl Unpin for WorkbenchExecutor
impl UnsafeUnpin for WorkbenchExecutor
impl !UnwindSafe for WorkbenchExecutor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more