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:
54
docs/content/platform/blocks/update/code_executor.md
Normal file
54
docs/content/platform/blocks/update/code_executor.md
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
## Code Execution Block
|
||||
|
||||
### What it is
|
||||
A secure environment for running various programming code with internet access and customizable setup options.
|
||||
|
||||
### What it does
|
||||
Executes code in an isolated sandbox environment, allowing users to run programs in different programming languages while maintaining security and providing detailed execution feedback.
|
||||
|
||||
### How it works
|
||||
The block creates a secure sandbox environment, runs any specified setup commands, executes the provided code in the chosen programming language, and returns the results along with any output or error messages. The sandbox includes internet access and pre-installed package managers like pip and npm.
|
||||
|
||||
### Inputs
|
||||
- Credentials: E2B API key required for accessing the sandbox environment (obtainable from e2b.dev/docs)
|
||||
- Setup Commands: Optional shell commands to prepare the environment before code execution (e.g., installing packages or downloading resources)
|
||||
- Code: The actual program code to be executed
|
||||
- Programming Language: Choice of language to run the code in (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 using pre-configured environments with specific CPU and memory settings
|
||||
|
||||
### Outputs
|
||||
- Response: The main output or return value from the executed code
|
||||
- Standard Output Logs: Regular program output messages and prints
|
||||
- Standard Error Logs: Error messages and warnings from the program execution
|
||||
- Error: Any execution failure messages or system errors that occurred
|
||||
|
||||
### Possible use cases
|
||||
- Testing code snippets in different programming languages
|
||||
- Running data analysis scripts with specific package requirements
|
||||
- Executing automated tasks that require internet access
|
||||
- Teaching programming by providing a safe environment for code experimentation
|
||||
- Running resource-intensive computations in an isolated environment
|
||||
- Automated code testing and validation
|
||||
- Running development tools and utilities that require specific system configurations
|
||||
|
||||
### Key Features
|
||||
- Supports multiple programming languages
|
||||
- Isolated execution environment for security
|
||||
- Internet access enabled
|
||||
- Customizable environment setup
|
||||
- Pre-installed package managers
|
||||
- Execution timeout controls
|
||||
- Detailed execution feedback
|
||||
- Error handling and sandbox cleanup
|
||||
- Optional template-based configuration
|
||||
|
||||
### Best Practices
|
||||
- Keep setup commands minimal and specific
|
||||
- Set appropriate timeout values based on expected execution time
|
||||
- Handle potential errors in your code
|
||||
- Use template IDs for consistent environment configurations
|
||||
- Monitor standard output and error logs for debugging
|
||||
- Ensure required packages are installed via setup commands
|
||||
- Test complex setups incrementally
|
||||
Reference in New Issue
Block a user