Skip to content

AGT-2669: Add turn detection and interruption protobufs#1485

Open
chenghao-mou wants to merge 16 commits intomainfrom
chenghao/feat/turn-detection-proto
Open

AGT-2669: Add turn detection and interruption protobufs#1485
chenghao-mou wants to merge 16 commits intomainfrom
chenghao/feat/turn-detection-proto

Conversation

@chenghao-mou
Copy link
Copy Markdown
Member

Add protobuf messages for both client <-> Inference and Inference <-> GPU host.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 8, 2026

🦋 Changeset detected

Latest commit: 9670cbd

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

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

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "github.com/livekit/protocol" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

@chenghao-mou chenghao-mou requested a review from a team April 8, 2026 03:18
Comment on lines +130 to +142
message TdServerMessage {
oneof message {
TdSessionCreated session_created = 1;
TdInferenceStarted inference_started = 2;
TdInferenceStopped inference_stopped = 3;
TdEouPrediction eou_prediction = 4;
TdSessionClosed session_closed = 5;
TdError error = 6;
}
optional string request_id = 7;
google.protobuf.Timestamp server_created_at = 8;
optional google.protobuf.Timestamp client_created_at = 9;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we split this into a Request/Response message?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the RemoteSession, I have Request/Response and events
https://github.com/livekit/protocol/blob/main/protobufs/agent/livekit_agent_session.proto

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nit tho

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it depends on how you look at them: e.g. TdInferenceStart and TdInferenceStarted is a Request-and-Response pair, we just wrap all the requests and responses in TdClientMessage and TdServerMessage.

Copy link
Copy Markdown
Member

@davidzhao davidzhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this only for the turn detector? or more designed to be the generic websocket protocol?

@chenghao-mou
Copy link
Copy Markdown
Member Author

is this only for the turn detector? or more designed to be the generic websocket protocol?

They are only for the turn detector. Barge-in or STT have somewhat different control messages or different formats:

Bargein (ws binary+json): in: audio frame (pcm), inference start/end, out: prediction
STT (json): in: audio frame (pcm), out: transcripts
Turn detection (protobuf binary): audio frame (opus), chat messages, inference start/end, out: prediction

Do you think we should try to unify them?

@chenghao-mou chenghao-mou changed the title Add turn detection protobufs AGT-2669: Add turn detection protobufs Apr 20, 2026
@chenghao-mou chenghao-mou changed the title AGT-2669: Add turn detection protobufs AGT-2669: Add turn detection and interruption protobufs Apr 20, 2026
Comment thread protobufs/agent/livekit_agent_inference.proto Outdated
Comment on lines +141 to +154
message InferenceStats {
// server-side e2e latency (server input to server output)
google.protobuf.Duration e2e_latency = 1;
google.protobuf.Duration preprocessing_duration = 2;
google.protobuf.Duration inference_duration = 3;
}

message ProcessingStats {
google.protobuf.Timestamp earliest_client_created_at = 1;
google.protobuf.Timestamp latest_client_created_at = 2;
// client-side e2e latency (client send to client receive)
google.protobuf.Duration e2e_latency = 3;
InferenceStats inference_stats = 4;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe?

Suggested change
message InferenceStats {
// server-side e2e latency (server input to server output)
google.protobuf.Duration e2e_latency = 1;
google.protobuf.Duration preprocessing_duration = 2;
google.protobuf.Duration inference_duration = 3;
}
message ProcessingStats {
google.protobuf.Timestamp earliest_client_created_at = 1;
google.protobuf.Timestamp latest_client_created_at = 2;
// client-side e2e latency (client send to client receive)
google.protobuf.Duration e2e_latency = 3;
InferenceStats inference_stats = 4;
}
message ProcessingStats {
message InferenceStats {
// server-side e2e latency (server input to server output)
google.protobuf.Duration e2e_latency = 1;
google.protobuf.Duration preprocessing_duration = 2;
google.protobuf.Duration inference_duration = 3;
}
google.protobuf.Timestamp earliest_client_created_at = 1;
google.protobuf.Timestamp latest_client_created_at = 2;
// client-side e2e latency (client send to client receive)
google.protobuf.Duration e2e_latency = 3;
InferenceStats inference_stats = 4;
}

Copy link
Copy Markdown
Member Author

@chenghao-mou chenghao-mou Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The model-to-Inference response needs to include InferenceStats but not ProcessingStats (EotInferenceResponse and InterruptionInferenceResponse)

Comment on lines +44 to +50
message Error {
string message = 1;
// error code follows the HTTP status code convention
// 4xx for client errors
// 5xx for server errors
uint32 code = 2;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Error message is too generic. Can we have another name?

Fwiw, we only do a string error in other services

Copy link
Copy Markdown
Member Author

@chenghao-mou chenghao-mou Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code here is the convention from Inference. We use that for the status_code in APIStatusError.

Renamed it to InferenceError.

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.

3 participants