acoustic-carpenter-78188
03/18/2026, 7:05 PMimport flyte, so flyte.map is not directly available. This adds flyte_map as a bridge-level built-in that delegates to flyte.map.aio, giving sandboxed code access to parallel task execution with the same semantics as flyte.map.
Usage in sandbox code strings:
# Map a single-arg task over a list (parallel)
flyte_map("double", items)
# Multiple iterables are zipped, like flyte.map
flyte_map("add", xs, ys)
# All flyte.map kwargs are supported
flyte_map("double", items, concurrency=4, return_exceptions=True)
# Results are collected into a list for further processing
squared = flyte_map("square", items)
total = 0
for v in squared:
total = total + v
total
The first argument is always the task name as a string. The task must be registered via the tasks=[] parameter of orchestrator_from_str() or orchestrate_local().
Changes:
• _bridge.py: Handle flyte_map FunctionSnapshot in the execute loop, resolve task name from refs, delegate to flyte.map.aio, collect results
• init.py: Document flyte_map in ORCHESTRATOR_SYNTAX_PROMPT
• examples/sandbox/code_string.py: Add Examples 8-9 (batch map, map+reduce)
• examples/sandbox/dynamic_code.py: Add Pattern 5 with local execution tests
• tests/flyte/sandbox/test_map_in_sandbox.py: 16 tests covering for-loop pattern, flyte_map basics, kwargs forwarding, error handling, and templates
flyteorg/flyte-sdkacoustic-carpenter-78188
03/18/2026, 11:05 PM