mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
Update block docs for: code_executor.md
This commit is contained in:
44
docs/content/platform/blocks/update/code_executor.md
Normal file
44
docs/content/platform/blocks/update/code_executor.md
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
## Code Execution Block
|
||||
|
||||
### What it is
|
||||
A secure sandbox environment that allows users to execute code in various programming languages with internet access while maintaining isolation for safety.
|
||||
|
||||
### What it does
|
||||
This block enables users to run code snippets in different programming languages (Python, JavaScript, Bash, R, and Java), set up the environment with custom commands, and receive execution results along with any output or error messages.
|
||||
|
||||
### How it works
|
||||
The block creates an isolated sandbox environment using E2B's infrastructure. It first runs any setup commands to prepare the environment, then executes the provided code in the specified programming language. The system captures all outputs, including standard output, error messages, and execution results, and returns them to the user.
|
||||
|
||||
### Inputs
|
||||
- Credentials: E2B API key required to access the sandbox environment
|
||||
- Setup Commands: Optional shell commands to prepare the environment before code execution (e.g., installing packages or downloading resources)
|
||||
- Code: The actual code to be executed in the sandbox
|
||||
- Programming Language: Choice of language to execute the code (Python, JavaScript, Bash, R, or Java)
|
||||
- Timeout: Maximum time in seconds allowed for code execution (default: 300 seconds)
|
||||
- Template ID: Optional E2B sandbox template ID for customized environments with specific CPU and memory configurations
|
||||
|
||||
### Outputs
|
||||
- Response: The main output or return value from the code execution
|
||||
- Standard Output Logs: Any text output generated during code execution (printed messages, status updates, etc.)
|
||||
- Standard Error Logs: Any error messages or warnings generated during execution
|
||||
- Error: Detailed error message if the code execution fails
|
||||
|
||||
### Possible use cases
|
||||
- Educational platforms where students can practice coding in a safe environment
|
||||
- Technical interviews where candidates need to write and test code
|
||||
- Development teams testing code snippets in isolation
|
||||
- Automated code testing systems
|
||||
- Interactive coding tutorials and workshops
|
||||
- API testing and prototyping
|
||||
- Script automation with different programming languages
|
||||
- Security testing in an isolated environment
|
||||
|
||||
### Additional Notes
|
||||
- The sandbox environment comes with pre-installed package managers (pip and npm)
|
||||
- Users can customize the environment using Debian-based package managers
|
||||
- The environment has internet access for downloading dependencies
|
||||
- Custom templates can be used for specific resource requirements
|
||||
- The system automatically kills the sandbox if an error occurs
|
||||
- All executions are isolated to prevent security issues
|
||||
|
||||
Reference in New Issue
Block a user