*If during tool execution I realize the call was a...
# ask-ai
h
If during tool execution I realize the call was a mistake — how can I skip saving
FunctionCall
and
FunctionCallOutput
to history and immediately continue the call?
For context: •
raise agents.StopResponse()
stops the bot’s speech, so it doesn’t work for me •
return ""
,
return None
, or
return self
— all behave the same and still log
FunctionCallOutput
with
output=''
, which I don’t want
t
Thanks for reaching out, Владислав. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To skip saving
FunctionCall
and
FunctionCallOutput
to history during tool execution, you can use the
copy()
method of the ChatContext class with the
exclude_function_call
parameter set to
True
. This will filter out items of type "function_call" and "function_call_output" from the copied context. Here's an example:
Copy code
def copy(
    self,
    *,
    exclude_function_call: bool = False,
    exclude_instructions: bool = False,
    tools: NotGivenOr[list[FunctionTool | RawFunctionTool | str | Any]] = NOT_GIVEN,
) -> ChatContext:
When you set
exclude_function_call=True
, it ensures these items are not included in the copied context. Sources: Tree View: | dse-workbench
h
How can I do this during tool execution? And I don’t want to discard all tools — just the one currently running
t
I'm sorry, but I don't have the information you need at the moment. If you would like a member of the LiveKit team to respond, please ask your question in one of the other channels.
h
👀🫠