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:
42
docs/content/platform/blocks/update/block.md
Normal file
42
docs/content/platform/blocks/update/block.md
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
## 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), execute setup commands, and receive the results of their code execution.
|
||||
|
||||
### How it works
|
||||
The block creates an isolated sandbox environment using E2B's infrastructure. It first runs any specified setup commands to prepare the environment, then executes the provided code in the chosen programming language. The system captures all outputs, including standard output, error messages, and execution results, and returns them to the user.
|
||||
|
||||
### Inputs
|
||||
- Credentials: Your E2B API key required to access the sandbox environment
|
||||
- Setup Commands: Optional shell commands to prepare the environment (e.g., installing packages or dependencies)
|
||||
- Code: The actual code you want to execute
|
||||
- Programming Language: Choice of language to run your code (Python, JavaScript, Bash, R, or Java)
|
||||
- Timeout: Maximum time in seconds allowed for code execution (default: 300 seconds)
|
||||
- Template ID: Optional custom sandbox template ID for specialized environments
|
||||
|
||||
### Outputs
|
||||
- Response: The main output or return value from your code execution
|
||||
- Standard Output Logs: Any text that your code printed to standard output
|
||||
- Standard Error Logs: Any error messages or warnings generated during execution
|
||||
- Error: Detailed error message if the execution failed
|
||||
|
||||
### Possible use cases
|
||||
- Testing code snippets in different programming languages
|
||||
- Running data analysis scripts in a secure environment
|
||||
- Executing system commands safely
|
||||
- Teaching programming concepts with immediate feedback
|
||||
- Prototyping solutions before implementing them in production
|
||||
- Running code that requires specific dependencies without affecting local environment
|
||||
|
||||
### Notes
|
||||
- The sandbox provides internet access, allowing for package installations and external API calls
|
||||
- Pre-installed tools include pip and npm package managers
|
||||
- The environment is Debian-based, allowing for additional package installations
|
||||
- Each execution runs in isolation, ensuring clean and consistent results
|
||||
- The sandbox is automatically cleaned up after execution
|
||||
- Resource usage is controlled through templates for CPU and memory allocation
|
||||
|
||||
Reference in New Issue
Block a user