User-away timer never arms while an `AgentTask` awaited from a tool is running
Los mantenedores suelen responder en 1 día
@bercedev ya está trabajando en esto.
Desde el 21/10/2026.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 53/100
Línea de trabajo
Start by reading _set_user_away_timer() and how _RunningTasks tracks tools and the current agent; the issue names no file or test. Trace a tool that awaits an AgentTask, including backend work before and after the task, and check the existing behavior for regular tools. Done means the timer runs during the task when both parties are listening, while backend tools still hold it.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug Description
Since #6937, _set_user_away_timer() returns early whenever _RunningTasks is non-empty. That is right for a tool doing backend work, because the user is waiting on the agent. But the documented way to start a task mid-conversation is to await it from a tool body (Tasks docs: "A tool function body: the tool instantiates and awaits the task"). That tool stays in _RunningTasks for the whole task, so the away timer is held for as long as the task runs.
Inside a task the next move is usually the user's, for example "please spell your e-mail address". If the user goes silent there, user_state never becomes away, and any idle handling built on user_state_changed never fires.
In a production call (STT-LLM-TTS over SIP), the user went silent inside an e-mail collection task right after the agent's question. Both user and agent were listening for 84 s with no away, though user_away_timeout=10. The tool that awaited the task ran for 2 min 07 s.
Expected Behavior
While a task is running, the away timer works as it does in a plain agent: it arms when both user and agent are listening. The tool that awaits the task should not hold the timer during that time, because the task itself is talking to the user.
Regular tools keep today's behaviour. A tool doing backend work, such as a slow lookup or an async job, still holds the away timer, so that a user waiting for its result is never marked away (#6904, #6883).
Reproduction Steps
class AskEmail(AgentTask[str]):
def __init__(self):
super().__init__(instructions="Ask for the user's e-mail address.")
async def on_enter(self):
self.session.generate_reply()
@function_tool
async def save(self, email: str):
self.complete(email)
class Main(Agent):
@function_tool
async def collect_email(self):
return await AskEmail()
session = AgentSession(..., user_away_timeout=5)
session.on("user_state_changed", lambda ev: print(ev.new_state))
1. Get the agent to call `collect_email`.
2. The task asks for the e-mail; stay silent.
3. `away` never prints. The same silence outside the task prints `away` after 5 s.
Operating System
Linux (LiveKit Cloud agent)
Models Used
STT-LLM-TTS pipeline over SIP telephony
Package Versions
livekit-agents==1.8.6
Session/Room/Call IDs
No response
Proposed Solution
In `_set_user_away_timer`, count only the running tools that belong to the current agent, not every entry in `_RunningTasks`. While an inline `AgentTask` is the current agent, the tool that awaits it belongs to the paused parent and is waiting on the user, so it should not hold the timer. The task's own tools still count.
This has to follow the current agent, not the kind of tool. One tool can do backend work, await a task, and then do more backend work:
@function_tool
async def handle_return(self):
order = await self.orders.lookup(...) # backend: hold the timer
email = await AskEmail() # task: do not hold it
await self.returns.create(order, email) # backend: hold the timer
The timer should be held during both backend parts and released only while the task is running. A per-tool marker, such as a separate decorator for tools that start a task, could not express that.
The change should apply only while a task is running. The hold added in #6937 is correct for regular tools and should stay as it is for them.
Additional Context
No response
Screenshots and Recordings
No response
- Lenguaje dominante
- Python
- Estrellas
- 14.6k
- Forks
- 3.9k
- Merge medio
- 3 d 19 h
- PR fusionados (30 d)
- 204
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de livekit/agents
-
Assistant markup is stripped from chat history when expressive mode is offPosiblemente ocupada @ShivamSharma43 la tomó hace 16 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
docs: openai.LLM vs openai.responses.LLM for HTTP OpenAI-compat hostsQuizá libre de nuevo @AbarnaaSree la tomó hace 56 días y no hay ningún pull request abierto. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
livekit/agents#7022 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Python AgentServer health check (GET /) returns 200 before the worker has registered with LiveKitPosiblemente ocupada @ninglinLiu la tomó hace 1 día. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
OpenAI Realtime engine: expose the WebSocket close code and reason to subclassesPosiblemente ocupada @ninglinLiu la tomó hace 1 día. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
Los mantenedores suelen responder en 1 día
Todos los issues de livekit/agents
Issues similares
-
Project submission:Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
slavakurilyak/awesome-ai-agents#845 ·
Los mantenedores suelen responder en 1 día
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directoryPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertodifficulty:2 enhancement good first issue
Dificultad 1/5 1-3 horas Aptitud para principiantes 92/100
MakazhanAlpamys/Soup#2178 ·
Los mantenedores suelen responder en 1 día
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
scverse/rapids-singlecell#854 ·
Los mantenedores suelen responder en 1 día
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGLPosiblemente ocupada @ninglinLiu la tomó hoy. Abiertoarea:frontend backend:slang bug direction:input
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 13 días