Execute Code Safely and Efficiently
Code Execution Toolkit is a Python-based skill that executes code in configurable sandboxes with security controls, import whitelisting, and timeout management
Why it matters
This toolkit enables the secure and controlled execution of code within various environments. It provides options for sandboxing, confirmation prompts, and import whitelisting to manage execution risks.
Outcomes
What it gets done
Execute Python code in a controlled environment.
Configure security settings like import whitelisting.
Manage code execution with optional confirmation prompts.
Set timeouts for code execution operations.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/camel-codeexecution | bash Capabilities
What this skill does
Writes source code or scripts from a description.
Traces errors to their root cause and suggests fixes.
Analyzes code for bugs, style issues, and improvements.
Creates unit, integration, or end-to-end test cases.
Overview
Code Execution Toolkit
What it does
The Code Execution Toolkit is a Python-based skill that executes code in configurable sandbox environments. It supports subprocess and microsandbox execution modes, with security features including import whitelisting, confirmation prompts, timeout controls, and an optional unsafe_mode that bypasses security checks via eval().
How it connects
Use this toolkit when your AI assistant needs to execute code with safety boundaries-whether limiting imports, requiring user confirmation, or isolating execution in remote microsandbox servers. It's ideal for scenarios requiring controlled code execution with configurable security levels and timeout protection.
Source code
A toolkit for code execution.
Args:
sandbox (str): The environment type used to execute code.
(default: subprocess)
verbose (bool): Whether to print the output of the code execution.
(default: :obj:False)
unsafe_mode (bool): If True, the interpreter runs the code
by eval() without any security check. (default: :obj:False)
import_white_list (Optional[List[str]]): A list of allowed imports.
(default: :obj:None)
require_confirm (Optional[bool]): Whether to require confirmation
before executing code. If None, subprocess execution requires
confirmation by default. (default: :obj:None)
timeout (Optional[float]): General timeout for toolkit operations.
(default: :obj:None)
microsandbox_config (Optional[dict]): Configuration for microsandbox
interpreter. Available keys: 'server_url', 'api_key',
'namespace', 'sandbox_name', 'timeout'.
If None, uses default configuration. (default: :obj:None)
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.