Skip to content

Rename deprecated WorkerOptions to ServerOptions in examples #870

@nukopy

Description

@nukopy

Summary

In PR #713, WorkerOptions was renamed to ServerOptions as part of the Worker → AgentServer renaming. However, the examples still use the deprecated WorkerOptions alias.

This issue proposes updating all examples to use the new ServerOptions class name for consistency and to follow best practices.

Current State

The WorkerOptions is marked as deprecated in agents/src/worker.ts:

/**
 * @deprecated Use {@link ServerOptions} instead. This alias is provided for backward compatibility.
 */
export const WorkerOptions = ServerOptions;

However, all 21 example files still use WorkerOptions:

  • examples/src/anam_realtime_agent.ts
  • examples/src/background_audio.ts
  • examples/src/basic_agent.ts
  • examples/src/basic_eou.ts
  • examples/src/basic_tool_call_agent.ts
  • examples/src/bey_avatar.ts
  • examples/src/cartersia_tts.ts
  • examples/src/comprehensive_test.ts
  • examples/src/custom_text_handler.ts
  • examples/src/drive-thru/drivethru_agent.ts
  • examples/src/frontdesk/frontdesk_agent.ts
  • examples/src/gemini_realtime_agent.ts
  • examples/src/idle_user_timeout_example.ts
  • examples/src/multi_agent.ts
  • examples/src/play_local_audio_file.ts
  • examples/src/push_to_talk.ts
  • examples/src/raw_function_description.ts
  • examples/src/realtime_agent.ts
  • examples/src/realtime_turn_detector.ts
  • examples/src/restaurant_agent.ts
  • examples/src/tool_call_disfluency.ts

Proposed Changes

Update all example files to:

  1. Change import from WorkerOptions to ServerOptions
  2. Change instantiation from new WorkerOptions(...) to new ServerOptions(...)

Before:

import { WorkerOptions, cli, defineAgent } from '@livekit/agents';

cli.runApp(new WorkerOptions({ agent: fileURLToPath(import.meta.url) }));

After:

import { ServerOptions, cli, defineAgent } from '@livekit/agents';

cli.runApp(new ServerOptions({ agent: fileURLToPath(import.meta.url) }));

I'd like to contribute by fixing this issue. It seems straightforward - updating the imports and class names across the example files. May I take this on?

If someone is already working on this, feel free to close this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions