mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
Update block docs for: block.md
This commit is contained in:
41
docs/content/platform/blocks/block.md
Normal file
41
docs/content/platform/blocks/block.md
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
## Code Execution Block
|
||||
|
||||
### What it is
|
||||
A secure sandbox environment that allows users to execute code in various programming languages with internet access.
|
||||
|
||||
### What it does
|
||||
This block provides a safe and isolated environment where users can run code in different programming languages (Python, JavaScript, Bash, R, and Java), install packages, and execute setup commands. It captures the code's output, standard logs, and any potential errors.
|
||||
|
||||
### How it works
|
||||
The block creates an isolated sandbox environment using the E2B platform. It first runs any specified setup commands (like installing packages), then executes the provided code in the chosen programming language. The system captures all outputs and logs, and automatically terminates the sandbox after completion or if an error occurs.
|
||||
|
||||
### Inputs
|
||||
- Credentials: E2B API key required to access the sandbox environment
|
||||
- Setup Commands: Optional shell commands to prepare the environment (e.g., installing packages or downloading files)
|
||||
- Code: The actual code to be executed in the sandbox
|
||||
- Programming Language: Choice of language to run the code (Python, JavaScript, Bash, R, or Java)
|
||||
- Timeout: Maximum time in seconds allowed for code execution (default: 300 seconds)
|
||||
- Template ID: Optional ID for using a pre-configured sandbox template with custom CPU and memory settings
|
||||
|
||||
### Outputs
|
||||
- Response: The main output or result from the code execution
|
||||
- Standard Output Logs: Regular output messages generated during code execution
|
||||
- Standard Error Logs: Error messages and warnings generated during code execution
|
||||
- Error: Any error message if the execution failed
|
||||
|
||||
### Possible use cases
|
||||
1. Educational platforms where students can safely experiment with different programming languages
|
||||
2. Testing code snippets in a secure environment before deployment
|
||||
3. Running data analysis scripts that require specific package installations
|
||||
4. Automated code testing systems
|
||||
5. Interactive coding tutorials and workshops
|
||||
6. API testing and integration testing
|
||||
7. Running potentially risky code in a sandboxed environment
|
||||
|
||||
### Important Notes
|
||||
- The sandbox provides internet access for downloading packages or accessing online resources
|
||||
- The environment is Debian-based with pre-installed package managers like pip and npm
|
||||
- Users can customize CPU and memory resources by using pre-configured sandbox templates
|
||||
- All executions are automatically terminated after the specified timeout period
|
||||
- The environment is completely isolated, ensuring secure code execution
|
||||
Reference in New Issue
Block a user