In many Agentic use case when no massive data processing is involved we just want to run durable functions in the same container.
The initial idea about the UX is the following:
@function(sandbox=True, cpu=10)
def func_in_separate_container():
pass
@function() # sanbox=False by default
def func_in_same_container():
pass
@application()
@function()
def app_function() -> None:
func_in_same_container() # runs in the same container
func_in_separate_container() # runs in a different container
This approach is simple but before finalizing on it let's make sure we address the following:
- @function(image=...) attribute is semi-redundant with this approach. We probably need to add a pre-deployment validation step where fail if a function defines an image=... attribute or any custom resources.
- Users might want to call the same function in sandbox and without sandbox. So we might want to allow choosing how to run a function in runtime (not statically in function attributes). Let's see if this is important or not.
- Let's make sure that the approach we choose also looks good for applications that are doing massive data processing.
I think in general it is safe to assume that if a function specifies a non-default image or non-default resources then it runs not locally.
On top of this we can allow people to force this by adding a sandbox flag which is False by default. Maybe we'd want this forced sandboxing done at call site, i.e.:
@application()
@function()
def my_app() -> None:
result = other_func.sandbox(1, 2, 3) # sync call
future = other_func.awaitable.sandbox(1,2,3).run() # async call
This will require people writing more boilerplate, i.e.:
@function()
def run_code(code: str) -> Any
...
@my_agentic_sdk_tool_function
def run_code_tool(code: str) -> Any:
return run_code.sandbox(code)
So one way or another we're forcing people to add boilerplate: either when sandbox is a function decorator attribute or if sandbox is a mode of running a particular function call.
In many Agentic use case when no massive data processing is involved we just want to run durable functions in the same container.
The initial idea about the UX is the following:
This approach is simple but before finalizing on it let's make sure we address the following:
I think in general it is safe to assume that if a function specifies a non-default image or non-default resources then it runs not locally.
On top of this we can allow people to force this by adding a sandbox flag which is False by default. Maybe we'd want this forced sandboxing done at call site, i.e.:
This will require people writing more boilerplate, i.e.:
So one way or another we're forcing people to add boilerplate: either when
sandboxis a function decorator attribute or ifsandboxis a mode of running a particular function call.