for AgentTask, can we call self.complete(True) ins...
# ask-ai
p
for AgentTask, can we call self.complete(True) inside the llm_node? will it work
t
Thanks for reaching out, harish. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I understand that you’re trying to call
self.complete(True)
directly inside an
llm_node
for an
AgentTask
. I want to gently let you know that this isn’t a supported or recommended approach. The
llm_node
is really meant to generate output for the LLM, like text or
ChatChunk
objects, rather than managing the task lifecycle. To help things run smoothly and predictably, the best practice is to use
self.complete()
within
@function_tool
methods or the
on_enter
and
on_exit
lifecycle methods of the task. This way, you’re following the framework’s intended flow. While it might seem possible to call
self.complete(True)
in an
llm_node
, it could cause some unexpected behavior down the line. I’m here to help if you want to explore the recommended methods together! Sources: Workflows | LiveKit docs | tests/test_evals.py