> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anchorbrowser.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Tasks

> TypeScript SDK reference for the Tasks resource

## runTask

`POST /v2/tasks/{taskId}/run` — Run a Task

```typescript theme={null}
import { client, Tasks } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await Tasks.runTask({
  path: {
    taskId: 'your-taskId'
  },
  body: {
    input_params: {}
  }
});
console.log(result);
```

## getTaskRunStatus

`GET /v2/tasks/runs/{runId}/status` — Get Task Run Status

```typescript theme={null}
import { client, Tasks } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await Tasks.getTaskRunStatus({
  path: {
    runId: 'your-runId'
  }
});
console.log(result);
```

## generateTask

`POST /v2/tasks/generate` — Generate a Task

```typescript theme={null}
import { client, Tasks } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await Tasks.generateTask({
  body: {
    taskName: 'string',
    taskPrompt: 'string'
  }
});
console.log(result);
```

## getTaskGenerationStatus

`GET /v2/tasks/{taskId}/generation-status` — Get Task Generation Status

```typescript theme={null}
import { client, Tasks } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await Tasks.getTaskGenerationStatus({
  path: {
    taskId: 'your-taskId'
  }
});
console.log(result);
```

***

# Legacy task methods

The methods below call the legacy v1 task API and are exposed through the `TasksLegacy` class. Prefer the `Tasks` methods above for new integrations.

## createTask

`POST /v1/task` — Create Task (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.createTask({
  body: {
    name: 'string',
    language: 'typescript'
  }
});
console.log(result);
```

## listTasks

`GET /v1/task` — List Tasks (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.listTasks();
console.log(result);
```

## runAdhocTask

`POST /v1/task/run` — Run Task (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.runAdhocTask({
  body: {
    taskId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'
  }
});
console.log(result);
```

## runTaskByName

`POST /v1/task/run/{taskName}` — Run Task by Name (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.runTaskByName({
  path: {
    taskName: 'your-taskName'
  },
  body: {}
});
console.log(result);
```

## getTask

`GET /v1/task/{taskId}` — Get Task Metadata (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.getTask({
  path: {
    taskId: 'your-taskId'
  }
});
console.log(result);
```

## updateTask

`PUT /v1/task/{taskId}` — Update Task Metadata (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.updateTask({
  path: {
    taskId: 'your-taskId'
  },
  body: {}
});
console.log(result);
```

## deleteTask

`DELETE /v1/task/{taskId}` — Delete Task (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.deleteTask({
  path: {
    taskId: 'your-taskId'
  }
});
console.log(result);
```

## listTaskVersions

`GET /v1/task/{taskId}/versions` — List Task Versions (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.listTaskVersions({
  path: {
    taskId: 'your-taskId'
  }
});
console.log(result);
```

## getLatestTaskVersion

`GET /v1/task/{taskId}/latest` — Get Latest Task Version (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.getLatestTaskVersion({
  path: {
    taskId: 'your-taskId'
  }
});
console.log(result);
```

## getTaskDraft

`GET /v1/task/{taskId}/draft` — Get Task Draft (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.getTaskDraft({
  path: {
    taskId: 'your-taskId'
  }
});
console.log(result);
```

## saveTaskDraft

`POST /v1/task/{taskId}/draft` — Create or Update Task Draft (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.saveTaskDraft({
  path: {
    taskId: 'your-taskId'
  },
  body: {
    code: 'string'
  }
});
console.log(result);
```

## deployTask

`POST /v1/task/{taskId}/deploy` — Deploy Task (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.deployTask({
  path: {
    taskId: 'your-taskId'
  },
  body: {}
});
console.log(result);
```

## listTaskExecutions

`GET /v1/task/{taskId}/executions` — List Task Executions (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.listTaskExecutions({
  path: {
    taskId: 'your-taskId'
  }
});
console.log(result);
```

## getTaskExecution

`GET /v1/task/{taskId}/executions/{executionId}` — Get Task Execution Result (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.getTaskExecution({
  path: {
    taskId: 'your-taskId',
    executionId: 'your-executionId'
  }
});
console.log(result);
```

## getTaskVersion

`GET /v1/task/{taskId}/{taskVersion}` — Get Task Version (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.getTaskVersion({
  path: {
    taskId: 'your-taskId',
    taskVersion: 'your-taskVersion'
  }
});
console.log(result);
```

## publishTaskVersion

`POST /v1/task/{taskId}/{taskVersion}` — Publish Task Version (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.publishTaskVersion({
  path: {
    taskId: 'your-taskId',
    taskVersion: 'your-taskVersion'
  },
  body: {}
});
console.log(result);
```

## deleteTaskVersion

`DELETE /v1/task/{taskId}/{taskVersion}` — Delete Task Version (Legacy)

```typescript theme={null}
import { client, TasksLegacy } from 'anchorbrowser';

// ANCHORBROWSER_API_KEY is read from the environment by default;
// set it explicitly like this:
client.setConfig({ auth: () => 'your-api-key' });

const result = await TasksLegacy.deleteTaskVersion({
  path: {
    taskId: 'your-taskId',
    taskVersion: 'your-taskVersion'
  }
});
console.log(result);
```
