E2b sandbox
E2BInterpreterInputSchema
Bases: BaseModel
Source code in dynamiq/nodes/tools/e2b_sandbox.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
validate_execution_commands()
Validate that either shell command or python code is specified
Source code in dynamiq/nodes/tools/e2b_sandbox.py
120 121 122 123 124 125 |
|
E2BInterpreterTool
Bases: ConnectionNode
A tool for executing code and managing files in an E2B sandbox environment.
This tool provides a secure execution environment for running Python code, shell commands, and managing file operations.
Attributes:
Name | Type | Description |
---|---|---|
group |
Literal[TOOLS]
|
The node group identifier. |
name |
str
|
The unique name of the tool. |
description |
str
|
Detailed usage instructions and capabilities. |
connection |
E2B
|
Configuration for E2B connection. |
installed_packages |
List[str]
|
Pre-installed packages in the sandbox. |
files |
Optional[List[Union[BytesIO, bytes]]]
|
Files to be uploaded. |
persistent_sandbox |
bool
|
Whether to maintain sandbox between executions. |
is_files_allowed |
bool
|
Whether file uploads are permitted. |
_sandbox |
Optional[Sandbox]
|
Internal sandbox instance for persistent mode. |
Source code in dynamiq/nodes/tools/e2b_sandbox.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
|
to_dict_exclude_params: set
property
Get parameters to exclude from dictionary representation.
Returns:
Name | Type | Description |
---|---|---|
set |
set
|
Set of parameters to exclude. |
close()
Closes the persistent sandbox if it exists.
Source code in dynamiq/nodes/tools/e2b_sandbox.py
344 345 346 347 348 349 |
|
execute(input_data, config=None, **kwargs)
Executes the requested action based on the input data.
Source code in dynamiq/nodes/tools/e2b_sandbox.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
|
to_dict(**kwargs)
Convert instance to dictionary format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**kwargs |
Additional keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
dict[str, Any]
|
Dict[str, Any]: Dictionary representation of the instance. |
Source code in dynamiq/nodes/tools/e2b_sandbox.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
generate_fallback_filename(file)
Generate a unique fallback filename for uploaded files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file |
bytes | BytesIO
|
File content as bytes or BytesIO object. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A unique filename based on the object's id. |
Source code in dynamiq/nodes/tools/e2b_sandbox.py
50 51 52 53 54 55 56 57 58 59 60 |
|
generate_file_description(file, length=20)
Generate a description for a file based on its content.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file |
bytes | BytesIO
|
File content as bytes or BytesIO object. |
required |
length |
int
|
Maximum number of bytes to include in the description. |
20
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A description of the file's content or existing description. |
Source code in dynamiq/nodes/tools/e2b_sandbox.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
handle_file_upload(files)
Handles file uploading with additional metadata.
Source code in dynamiq/nodes/tools/e2b_sandbox.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|