# Class WaveScheduler

Wave scheduler for bounded parallel task execution.

Executes tasks in waves respecting concurrency limits, dependency order, output budgets, and token budgets. Each wave waits for all tasks to complete before the next wave launches.

#### Example

    const scheduler = createWaveScheduler({ maxConcurrency: 3 });
    const result = await scheduler.execute(tasks, async (task) => {
      return await runAgent(task.input);
    });
    console.log(`Completed in ${result.waves.length} waves`);

- Defined in packages/nexus-agents/src/agents/wave-scheduler.ts:60

##### Index

### Constructors

constructor

### Methods

execute
buildWaves
getConfig

## Constructors

### constructor

- new WaveScheduler(
  config?: Partial<WaveSchedulerConfig>,
  logger?: ILogger,
  ): WaveScheduler

  #### Parameters

  - config: Partial<WaveSchedulerConfig> = {}
  - `Optional` logger: ILogger

  #### Returns WaveScheduler

  - Defined in packages/nexus-agents/src/agents/wave-scheduler.ts:64

## Methods

### execute

- execute<T>(
  tasks: readonly WaveTask<T>[],
  executor: WaveTaskExecutor<T>,
  ): Promise<WaveExecutionResult>

  Execute tasks in waves respecting dependencies and concurrency limits.

  #### Type Parameters

  - T

  #### Parameters

  - tasks: readonly WaveTask<T>[]
  - executor: WaveTaskExecutor<T>

  #### Returns Promise<WaveExecutionResult>

  - Defined in packages/nexus-agents/src/agents/wave-scheduler.ts:72

### buildWaves

- buildWaves<T>(tasks: readonly WaveTask<T>[]): WaveTask<T>[][]

  Build waves from tasks respecting dependency ordering.

  Tasks with no unresolved dependencies go in the earliest possible wave. Within each wave, tasks are further split into sub-waves of maxConcurrency size.

  #### Type Parameters

  - T

  #### Parameters

  - tasks: readonly WaveTask<T>[]

  #### Returns WaveTask<T>[][]

  - Defined in packages/nexus-agents/src/agents/wave-scheduler.ts:116

### getConfig

- getConfig(): Readonly<WaveSchedulerConfig>

  Get the scheduler configuration.

  #### Returns Readonly<WaveSchedulerConfig>

  - Defined in packages/nexus-agents/src/agents/wave-scheduler.ts:157