Skip to content

fix basic_agent example#1003

Merged
lukasIO merged 1 commit intomainfrom
lukas/fix-example
Jan 29, 2026
Merged

fix basic_agent example#1003
lukasIO merged 1 commit intomainfrom
lukas/fix-example

Conversation

@lukasIO
Copy link
Contributor

@lukasIO lukasIO commented Jan 29, 2026

Description

npm package linked in the example isn't available currently

Summary by CodeRabbit

  • Chores
    • Updated noise cancellation implementation in the example agent to use an alternative backend technology for audio processing.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Jan 29, 2026

⚠️ No Changeset found

Latest commit: 1ae347f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

The pull request replaces the noise-cancellation library used in the example agent from @livekit/plugins-ai-coustics to @livekit/noise-cancellation-node. The outdated dependency is removed from package.json, and the corresponding import and implementation are updated in the example code.

Changes

Cohort / File(s) Summary
Noise Cancellation Library Migration
examples/package.json, examples/src/basic_agent.ts
Removed @livekit/plugins-ai-coustics dependency and replaced noise cancellation implementation from aic to BackgroundVoiceCancellation from @livekit/noise-cancellation-node.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • 1egoman
  • toubatbrian

Poem

🐰 Out with the old noise, in with the new,
A whisper-soft cancellation, tried and true,
Dependencies dusted off the shelf,
The agent now sings pure—itself! 🎵

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete; it only provides a brief one-line explanation without following the required template structure, and the Changes Made section contains only placeholder bullets. Complete the description using the template: fill in detailed changes made (dependency removal and noise-cancellation replacement), mark pre-review checklist items, and describe testing performed.
Title check ❓ Inconclusive The title 'fix basic_agent example' is vague and generic; it doesn't specify what problem is being fixed or which dependency/feature change is involved. Clarify the title to be more specific, such as 'Replace ai-coustics with BackgroundVoiceCancellation in basic_agent example' or 'Remove unavailable ai-coustics dependency from example'.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

🧹 Recent nitpick comments
examples/src/basic_agent.ts (1)

20-24: Missing logger initialization before LLM usage.

This example file uses LLM functionality but does not initialize the logger. As per coding guidelines for example files, add initializeLogger({ pretty: true }) before using any LLM functionality.

🔧 Suggested fix

Import initializeLogger from @livekit/agents:

 import {
   type JobContext,
   type JobProcess,
   WorkerOptions,
   cli,
   defineAgent,
+  initializeLogger,
   llm,
   metrics,
   voice,
 } from '@livekit/agents';

Then initialize it at the start of the entry function or before defineAgent:

 export default defineAgent({
   prewarm: async (proc: JobProcess) => {
     proc.userData.vad = await silero.VAD.load();
   },
   entry: async (ctx: JobContext) => {
+    initializeLogger({ pretty: true });
+
     const agent = new voice.Agent({
📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0bb2745 and 1ae347f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • examples/package.json
  • examples/src/basic_agent.ts
💤 Files with no reviewable changes (1)
  • examples/package.json
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/agent-core.mdc)

Add SPDX-FileCopyrightText and SPDX-License-Identifier headers to all newly added files with '// SPDX-FileCopyrightText: 2025 LiveKit, Inc.' and '// SPDX-License-Identifier: Apache-2.0'

Files:

  • examples/src/basic_agent.ts
**/*.{ts,tsx}?(test|example|spec)

📄 CodeRabbit inference engine (.cursor/rules/agent-core.mdc)

When testing inference LLM, always use full model names from agents/src/inference/models.ts (e.g., 'openai/gpt-4o-mini' instead of 'gpt-4o-mini')

Files:

  • examples/src/basic_agent.ts
**/*.{ts,tsx}?(test|example)

📄 CodeRabbit inference engine (.cursor/rules/agent-core.mdc)

Initialize logger before using any LLM functionality with initializeLogger({ pretty: true }) from '@livekit/agents'

Files:

  • examples/src/basic_agent.ts
🧠 Learnings (1)
📚 Learning: 2026-01-16T14:33:39.551Z
Learnt from: CR
Repo: livekit/agents-js PR: 0
File: .cursor/rules/agent-core.mdc:0-0
Timestamp: 2026-01-16T14:33:39.551Z
Learning: Applies to **/*.{ts,tsx}?(test|example) : Initialize logger before using any LLM functionality with `initializeLogger({ pretty: true })` from 'livekit/agents'

Applied to files:

  • examples/src/basic_agent.ts
🔇 Additional comments (2)
examples/src/basic_agent.ts (2)

16-16: LGTM!

Import change for the new noise cancellation library is correct.


85-85: LGTM!

Usage of BackgroundVoiceCancellation() for the noiseCancellation option is correct and aligns with the library's functional API.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@lukasIO lukasIO requested a review from a team January 29, 2026 10:43
@lukasIO lukasIO merged commit 5c02ff2 into main Jan 29, 2026
8 checks passed
@lukasIO lukasIO deleted the lukas/fix-example branch January 29, 2026 19:22
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