Docs

Parallel calls

Fan one function out over many inputs with .map(), each input in its own container.

For agents: this page as markdown

Fan out with .map()

from klio_compute import function

@function(cpu=1, memory="1Gi")
def square(x: int) -> int:
    return x * x

if __name__ == "__main__":
    for result in square.map([1, 2, 3, 4]):
        print(result)

.map() sends every input to its own container and gives back the results. With @function, results arrive as calls finish; a failed input is reported and yields None. Each container is billed for the seconds it runs.

© 2026 Klio