Skip to content

agent: add AgentSessionEvent.SessionClosed - #1888

Open
u9g wants to merge 1 commit into
mainfrom
session-closed-event
Open

u9g wants to merge 1 commit into
mainfrom
session-closed-event

Conversation

@u9g

@u9g u9g commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Why

During a simulation, when an agent ends the call itself (for example with EndCallTool), its on_simulation_end verdict is lost. The simulator sends finalize_simulation only after it has judged the transcript, and by then the agent's SessionHost has already closed with its AgentSession.

livekit/agents#7986 fixes this by keeping the host up for the whole job. After that change, an agent that hangs up stays in the room until it is finalized. The simulator then needs a signal that the call ended other than the agent leaving.

What

This adds AgentSessionEvent.SessionClosed { CloseReason reason = 1; optional string error = 2; } as session_closed = 24. The agent sends it when its session closes, and no session events follow it. It reuses the CloseReason enum from #1887.

Used by

@changeset-bot

changeset-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: aa0a910

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
github.com/livekit/protocol Patch
@livekit/protocol Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant