execute • AI Agent SDK

execute: Execute code in the sandbox.

execute

Async

Method

</div>

This is a method of the SandboxProtocol class in the protocols module.

Execute code in the sandbox.

Signature

python
async def execute(code: str, language: str, limits: Optional[ResourceLimits], env: Optional[Dict[str, str]], working_dir: Optional[str]) -> SandboxResult

Parameters

ParamField str

Code to execute

ParamField str

Programming language (python, bash, etc.)

ParamField Optional[ResourceLimits]

Resource limits for execution

ParamField Optional

Environment variables

ParamField Optional[str]

Working directory for execution

Returns

ResponseField SandboxResult

Execution result

Used By

Source

View on GitHub

praisonaiagents/sandbox/protocols.py at line 234