Skip to content

agent: add CloseReason enum for agent session close reasons - #1887

Merged
jmcclanahan merged 3 commits into
mainfrom
jakemcclanahan/agent-session-close-reason
Oct 23, 2026
Merged

jmcclanahan merged 3 commits into
mainfrom
jakemcclanahan/agent-session-close-reason

Conversation

@jmcclanahan

Copy link
Copy Markdown
Contributor

What

  • New enum livekit.agent.CloseReason in agent/livekit_agent_session.proto: CR_UNKNOWN, CR_ERROR, CR_JOB_SHUTDOWN, CR_PARTICIPANT_DISCONNECTED, CR_USER_INITIATED, CR_TASK_COMPLETED.
  • Changeset (patch) for the Go module and @livekit/protocol.

Why

The agents SDKs send a session summary (JSON) in MetricsRecordingHeader.session_summary (#1884), and agent evals filter on its close_reason. Today the Python and JS SDKs each define their own CloseReason, and they already differ (agents-js has no task_completed). Writing the proto value name into the JSON keeps one list of names for Python, JS and Go.

How

  • No message uses the enum; the SDKs map their own CloseReason to it and write the value name (e.g. CR_PARTICIPANT_DISCONNECTED). A unit test in each SDK checks every SDK reason has a mapping.
  • CR_UNKNOWN (0) covers a missing reason and agents-js custom shutdown strings.
  • Value prefix follows the file's other enums (AS_, TC_, AMD_).

🤖 Generated with Claude Code

Agent evals read the session's close reason from the recording upload's session summary;
the enum keeps the value names the same across the Python, JS and Go code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d7442f4

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

Comment thread protobufs/agent/livekit_agent_session.proto Outdated
jmcclanahan and others added 2 commits October 23, 2026 15:52
Co-authored-by: Théo Monnom <theo.monnom@outlook.com>
@jmcclanahan
jmcclanahan merged commit b20af9b into main Oct 23, 2026
6 checks passed
@jmcclanahan
jmcclanahan deleted the jakemcclanahan/agent-session-close-reason branch October 23, 2026 20:59
@github-actions github-actions Bot mentioned this pull request Oct 23, 2026
jmcclanahan added a commit to livekit/agents that referenced this pull request Oct 23, 2026
…ol#1887)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jmcclanahan added a commit to livekit/agents-js that referenced this pull request Oct 23, 2026
…ol#1887)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants