Skip to main content

SandboxedTaskTemplate

A task template that executes the function body in a Monty sandbox. For pure Python functions (no external calls), Monty executes the entire body without pausing. For functions that call other tasks or durable operations, run_monty_async handles async dispatch.

Attributes​

AttributeTypeDescription
task_typestring = "sandboxed-python"The identifier for the task execution environment, defaulting to "sandboxed-python".
plugin_configOptional[[SandboxedConfig](../config/sandboxedconfig.md?sid=flyte_sandbox__config_sandboxedconfig)] = nullConfiguration settings for the Monty sandbox environment, initialized to a default SandboxedConfig if not provided.

Constructor​

Signature​

def SandboxedTaskTemplate(
task_type: str = "sandboxed-python",
plugin_config: Optional[[SandboxedConfig](../config/sandboxedconfig.md?sid=flyte_sandbox__config_sandboxedconfig)] = None
) -> null

Parameters​

NameTypeDescription
task_typestr = "sandboxed-python"The type identifier for the task.
plugin_configOptional[[SandboxedConfig](../config/sandboxedconfig.md?sid=flyte_sandbox__config_sandboxedconfig)] = NoneConfiguration settings for the sandboxed execution environment.

Methods​


execute()​

async def execute(self, *args, **kwargs) -> Any: ...

Execute the function body in a Monty sandbox.

Parameters​

NameTypeDescription
argsAnyPositional arguments passed to the sandboxed function.
kwargsAnyKeyword arguments passed to the sandboxed function.

Returns​

TypeDescription
AnyThe result of the sandboxed function execution after running pre and post hooks.

forward()​

def forward(self, *args, **kwargs) -> Any: ...

Bypass Monty and call the function directly (for local/debug execution).

Parameters​

NameTypeDescription
argsAnyPositional arguments passed directly to the underlying function.
kwargsAnyKeyword arguments passed directly to the underlying function.

Returns​

TypeDescription
AnyThe direct return value of the underlying Python function.