proud-lawyer-39815
12/24/2025, 7:16 PMtall-airline-16756
12/24/2025, 7:16 PMtall-airline-16756
12/24/2025, 7:16 PMtall-airline-16756
12/24/2025, 7:17 PMsession.userdata after a participant disconnects.
Yes. Shutdown hooks run during session teardown before the session's resources are fully cleared, so session.userdata remains available inside those callbacks. You can read (and persist) userdata in the shutdown hook to perform final cleanup or save state.
If you plan to modify userdata in the hook, confirm your hook runs synchronously (or await async cleanup) so changes complete before the session fully closes. Do you want an example in your language (Go/JS/Rust) or details about registering the shutdown callback?
Sources: Job lifecycle | LiveKit docsproud-lawyer-39815
12/24/2025, 7:24 PMtall-airline-16756
12/24/2025, 7:25 PMuserdata when the agent is not running.
You cannot access an agent's userdata once the agent/session has stopped. userdata lives in the AgentSession/JobProcess during the agent's lifecycle and is cleared when the session ends. If you need the data after shutdown, persist it before the agent stops (for example, in a shutdown hook that saves to a database or file).
Would you like a short example in your preferred language showing how to persist userdata in a shutdown hook?
Sources: Agents (Node.js) | livekit/livekit_composite | DeepWiki | Job lifecycle | LiveKit docsproud-lawyer-39815
12/24/2025, 7:25 PMtall-airline-16756
12/24/2025, 7:25 PMsession.userdata and agent.userdata are the same.
Yes — they refer to the same userdata object. When an AgentSession is created, the userdata is attached to the session and is accessible from the agent via the session (e.g., self.session.userdata or agent.session.userdata). Any data stored there is shared between the session and the agent during the session's lifecycle.
Sources: Agents and handoffs | LiveKit docsproud-lawyer-39815
12/24/2025, 7:26 PMtall-airline-16756
12/24/2025, 7:26 PMsession.userdata remains accessible even when no agent is currently running. userdata is attached to the session (not the agent), so it persists across agent handoffs and while the session is live.
If you need the data after the session ends, save it to external storage in a shutdown hook before the session stops.
Sources: Agents and handoffs | LiveKit docs | Agent session | LiveKit docs