• Resume an incomplete experiment by running only the missing or failed runs.

    This function identifies which (example, repetition) pairs have not been completed (either missing or failed) and re-runs the task only for those pairs. Optionally, evaluators can be run on the completed runs after task execution.

    The function processes incomplete runs in batches using pagination to minimize memory usage.

    Parameters

    Returns Promise<void>

    Throws different error types based on failure:

    • "TaskFetchError": Unable to fetch incomplete runs from the server. Always thrown regardless of stopOnFirstError, as it indicates critical infrastructure failure.
    • "TaskAbortedError": stopOnFirstError=true and a task failed. Original error preserved in cause property.
    • Generic Error: Other task execution errors or unexpected failures.
    import { resumeExperiment } from "@arizeai/phoenix-client/experiments";

    // Resume an interrupted experiment
    try {
    await resumeExperiment({
    experimentId: "exp_123",
    task: myTask,
    });
    } catch (error) {
    // Handle by error name (no instanceof needed)
    if (error.name === "TaskFetchError") {
    console.error("Failed to connect to server:", error.cause);
    } else if (error.name === "TaskAbortedError") {
    console.error("Task stopped due to error:", error.cause);
    } else {
    console.error("Unexpected error:", error);
    }
    }

    // Resume with evaluators
    await resumeExperiment({
    experimentId: "exp_123",
    task: myTask,
    evaluators: [correctnessEvaluator, relevanceEvaluator],
    });

    // Stop on first error (useful for debugging)
    await resumeExperiment({
    experimentId: "exp_123",
    task: myTask,
    stopOnFirstError: true, // Exit immediately on first task failure
    });