피드로 돌아가기
I opened my first PR to LiveKit's agents repo — here's the bug I found
Dev.toDev.to
Backend

LiveKit Agents의 item_id 누락 해결을 통한 Event Deduplication 구현

I opened my first PR to LiveKit's agents repo — here's the bug I found

Diya2026년 6월 21일2beginner

Context

Realtime 모델의 스트리밍 특성으로 인해 단일 발화당 다수의 UserInputTranscribedEvent가 발생함. 프레임워크 내부에서 item_id가 누락되어 Consumer 단계에서 서로 다른 Provider 간 이벤트 중복 제거 및 상관관계 분석이 불가능한 구조임.

Technical Solution

  • Event Lifecycle 추적을 통한 데이터 유실 지점 파악
  • UserInputTranscribedEvent 모델에 item_id 필드를 추가하여 데이터 스키마 확장
  • llm.InputTranscriptionCompleted 이벤트의 item_id를 UserInputTranscribedEvent로 전달하는 Forwarding 로직 구현
  • AgentActivity와 AgentSession을 거쳐 상위 레이어로 전달되는 데이터 파이프라인의 정합성 확보
  • Provider별 상이한 전송 방식(Token 단위 또는 Blob 단위)에 관계없이 일관된 식별자 제공

이벤트 기반 아키텍처 설계 시 하위 레이어의 식별자(ID)가 상위 추상화 레이어로 전달되는 과정에서 누락되지 않는지 검증하고, 분산 환경의 이벤트 중복 제거를 위한 Correlation ID 체계를 점검하십시오.

원문 읽기