@@ -124,13 +124,17 @@ class FunctionCallRegistryItem:
124124 function_name: The name of the function (None for catch-all handler).
125125 handler: The handler for processing function call parameters.
126126 cancel_on_interruption: Whether to cancel the call on interruption.
127+ is_async: Whether this function call runs asynchronously. When True,
128+ the LLM continues the conversation immediately without waiting for
129+ the result. The result is injected later via a developer message.
127130 timeout_secs: Optional per-tool timeout in seconds. Overrides the global
128131 ``function_call_timeout_secs`` for this specific function.
129132 """
130133
131134 function_name : Optional [str ]
132135 handler : FunctionCallHandler | "DirectFunctionWrapper"
133136 cancel_on_interruption : bool
137+ is_async : bool = False
134138 timeout_secs : Optional [float ] = None
135139
136140
@@ -578,6 +582,7 @@ def register_function(
578582 handler : Any ,
579583 * ,
580584 cancel_on_interruption : bool = True ,
585+ is_async : bool = False ,
581586 timeout_secs : Optional [float ] = None ,
582587 ):
583588 """Register a function handler for LLM function calls.
@@ -589,6 +594,10 @@ def register_function(
589594 parameter.
590595 cancel_on_interruption: Whether to cancel this function call when an
591596 interruption occurs. Defaults to True.
597+ is_async: Whether this function call runs asynchronously. When True,
598+ the LLM continues the conversation immediately without waiting for
599+ the result. The result is injected later via a developer message.
600+ Defaults to False.
592601 timeout_secs: Optional per-tool timeout in seconds. Overrides the global
593602 ``function_call_timeout_secs`` for this specific function. Defaults to
594603 None, which uses the global timeout.
@@ -599,6 +608,7 @@ def register_function(
599608 function_name = function_name ,
600609 handler = handler ,
601610 cancel_on_interruption = cancel_on_interruption ,
611+ is_async = is_async ,
602612 timeout_secs = timeout_secs ,
603613 )
604614
@@ -607,6 +617,7 @@ def register_direct_function(
607617 handler : DirectFunction ,
608618 * ,
609619 cancel_on_interruption : bool = True ,
620+ is_async : bool = False ,
610621 timeout_secs : Optional [float ] = None ,
611622 ):
612623 """Register a direct function handler for LLM function calls.
@@ -619,6 +630,10 @@ def register_direct_function(
619630 handler: The direct function to register. Must follow DirectFunction protocol.
620631 cancel_on_interruption: Whether to cancel this function call when an
621632 interruption occurs. Defaults to True.
633+ is_async: Whether this function call runs asynchronously. When True,
634+ the LLM continues the conversation immediately without waiting for
635+ the result. The result is injected later via a developer message.
636+ Defaults to False.
622637 timeout_secs: Optional per-tool timeout in seconds. Overrides the global
623638 ``function_call_timeout_secs`` for this specific function. Defaults to
624639 None, which uses the global timeout.
@@ -628,6 +643,7 @@ def register_direct_function(
628643 function_name = wrapper .name ,
629644 handler = wrapper ,
630645 cancel_on_interruption = cancel_on_interruption ,
646+ is_async = is_async ,
631647 timeout_secs = timeout_secs ,
632648 )
633649
@@ -766,6 +782,7 @@ async def _run_function_call(self, runner_item: FunctionCallRunnerItem):
766782 tool_call_id = runner_item .tool_call_id ,
767783 arguments = runner_item .arguments ,
768784 cancel_on_interruption = item .cancel_on_interruption ,
785+ is_async = item .is_async ,
769786 )
770787
771788 timeout_task : Optional [asyncio .Task ] = None
0 commit comments