orchestrate_local
One-shot local execution of a code string in the Monty sandbox.
Warning: Experimental feature: alpha — APIs may change without notice.
Sends the code + inputs to Monty and returns the result directly,
without creating a `TaskTemplate` or going through the controller.
The **last expression** in *source* becomes the return value::
result = await sandbox.orchestrate_local(
"add(x, y) * 2",
inputs=\{"x": 1, "y": 2\},
tasks=[add],
)
# → 6
Parameters
----------
source:
Python code string to execute in the sandbox.
inputs:
Mapping of input names to their values.
tasks:
List of external functions (tasks, durable ops) available inside the
sandbox. Each item's `__name__` is used as the key.
timeout_ms:
Sandbox execution timeout in milliseconds.
async def orchestrate_local(
source: str,
*,
inputs: Dict[str, Any],
tasks: Optional[List[Any]] = None,
timeout_ms: int = 30_000,
) -> Any: ...
One-shot local execution of a code string in the Monty sandbox. Sends the code + inputs to Monty and returns the result directly, without creating a TaskTemplate or going through the controller.
Parameters
| Name | Type | Description |
|---|---|---|
| source | str | Python code string to execute in the sandbox. |
| inputs | Dict[str, Any] | Mapping of input names to their values. |
| tasks | Optional[List[Any]] = None | List of external functions (tasks, durable ops) available inside the sandbox. Each item's name is used as the key. |
| timeout_ms | int = 30000 | Sandbox execution timeout in milliseconds. |
Returns
| Type | Description |
|---|---|
Any | The evaluated result of the last expression in the provided source code. |