Skip to main content

Documentation Index

Fetch the complete documentation index at: https://arize-ax.mintlify.dev/docs/llms.txt

Use this file to discover all available pages before exploring further.

The tasks functions are currently in ALPHA. The API may change without notice. A one-time warning is emitted on first use.

List Tasks

import { listTasks } from "@arizeai/ax-client";

const { data: tasks, pagination } = await listTasks({
  space: "my-space",    // space name or ID (optional)
  name: "quality",      // substring filter on task name (optional)
  type: "template_evaluation",  // optional
  limit: 10,
});

Create a Task

Tasks run LLM-as-judge evaluators over project spans (online monitoring) or dataset examples (offline batch evaluation). Exactly one of project or dataset must be provided.

Project-scoped task (continuous monitoring)

import { createTask } from "@arizeai/ax-client";

const task = await createTask({
  name: "Production Quality Monitor",
  type: "template_evaluation",
  space: "my-space",    // required when project is a name
  project: "my-project",
  isContinuous: true,
  samplingRate: 0.1,    // sample 10% of spans
  evaluators: [
    {
      evaluatorId: "your_evaluator_id",
      columnMappings: { input: "question", output: "answer" },
    },
  ],
});

Dataset-scoped task (batch evaluation)

import { createTask, triggerTaskRun, waitForTaskRun } from "@arizeai/ax-client";

const task = await createTask({
  name: "Weekly Quality Check",
  type: "template_evaluation",
  space: "my-space",
  dataset: "my-dataset",
  evaluators: [
    {
      evaluatorId: "your_evaluator_id",
      columnMappings: { input: "question", output: "answer" },
    },
  ],
});

// Immediately trigger a run and wait for it to finish
const run = await triggerTaskRun({ task: task.id });
const finalRun = await waitForTaskRun({ runId: run.id });
console.log(finalRun.status); // "completed" | "failed" | "cancelled"

Get a Task

import { getTask } from "@arizeai/ax-client";

// By task ID
const task = await getTask({ task: "your_task_id" });

// By task name (requires space)
const task = await getTask({ task: "My Task", space: "my-space" });

Trigger a Task Run

import { triggerTaskRun } from "@arizeai/ax-client";

const run = await triggerTaskRun({
  task: "My Task",     // task name or ID
  space: "my-space",  // required when task is a name
  dataStartTime: new Date("2026-03-01T00:00:00Z"),
  dataEndTime: new Date("2026-03-08T00:00:00Z"),
  maxSpans: 5000,
  overrideEvaluations: false,  // skip already-evaluated spans
});

List Task Runs

import { listTaskRuns } from "@arizeai/ax-client";

const { data: runs, pagination } = await listTaskRuns({
  task: "My Task",     // task name or ID
  space: "my-space",  // required when task is a name
  status: "completed",  // optional status filter
  limit: 10,
});

for (const run of runs) {
  console.log(run.id, run.numSuccesses, run.numErrors);
}

Get a Task Run

import { getTaskRun } from "@arizeai/ax-client";

const run = await getTaskRun({ runId: "your_run_id" });
console.log(run.status);       // e.g. "running"
console.log(run.numSuccesses); // spans evaluated so far

Wait for a Task Run

Poll until the run reaches a terminal status (completed, failed, or cancelled).
import { triggerTaskRun, waitForTaskRun } from "@arizeai/ax-client";

const run = await triggerTaskRun({ task: "your_task_id" });
const finalRun = await waitForTaskRun({
  runId: run.id,
  pollInterval: 3_000,      // poll every 3 seconds (default: 5000)
  timeout: 5 * 60_000,      // give up after 5 minutes (default: 10 minutes)
});

if (finalRun.status === "completed") {
  console.log(`${finalRun.numSuccesses} spans evaluated successfully`);
} else {
  console.error(`Run ended with status: ${finalRun.status}`);
}

Cancel a Task Run

Only valid for runs with status pending or running.
import { cancelTaskRun } from "@arizeai/ax-client";

const run = await cancelTaskRun({ runId: "your_run_id" });
console.log(run.status); // "cancelled"