Manage Ascend workspaces, deployments, flows, and flow runs from JavaScript/TypeScript.
npm add ascend-toolsUpgrade to the latest version:
npm update ascend-toolsThe npm package includes the full ascend-tools CLI:
npx ascend-tools workspace list
npx ascend-tools flow run "My Flow" --workspace "My Workspace"
npx ascend-tools otto tuiOr install globally:
npm install -g ascend-tools
ascend-tools workspace listSee CLI guide for all commands.
import { Client } from "ascend-tools";
const client = new Client(); // uses default instance from ~/.ascend-tools/config.toml
const client = new Client(null, null, null, "staging"); // uses a named instanceSet up instances with the CLI: ascend-tools instance add (see CLI guide).
const client = new Client(); // reads ASCEND_SERVICE_ACCOUNT_ID, etc. from envSee Quickstart for the full service account creation walkthrough.
const client = new Client(
"asc-sa-...", // serviceAccountId
"...", // serviceAccountKey
"https://api.instance.ascend.io", // instanceApiUrl
);Resolution order: explicit args > instance config > env vars.
const environments = await client.listEnvironments();const env = await client.getEnvironment("Production");const projects = await client.listProjects();const project = await client.getProject("My Project");const profiles = await client.listProfiles("My Workspace");
const profiles = await client.listProfiles(null, "My Deployment");
const profiles = await client.listProfiles(null, null, null, "My Project", "main");await client.listWorkspaces();
await client.listWorkspaces(null, null, "Production");
await client.getWorkspace("My Workspace");
await client.pauseWorkspace("My Workspace");
await client.resumeWorkspace("My Workspace");
await client.deleteWorkspace("My Workspace");const ws = await client.createWorkspace(
"My Workspace", // title
"Production", // environment
"My Project", // project
"default", // profile
"main", // gitBranch
);const ws = await client.updateWorkspace(
"My Workspace", // title
null, // uuid
"New Title", // newTitle
"feature/abc", // gitBranch
);await client.listDeployments();
await client.getDeployment("My Deployment");
await client.pauseDeploymentAutomations("My Deployment");
await client.resumeDeploymentAutomations("My Deployment");
await client.deleteDeployment("My Deployment");const dep = await client.createDeployment(
"My Deployment", // title
"Production", // environment
"My Project", // project
"default", // profile
"main", // gitBranch
);const dep = await client.updateDeployment(
"My Deployment", // title
null, // uuid
null, // newTitle
null, // gitBranch
null, // gitBranchBase
null, // profile
null, // size
null, // storageSize
true, // enableAutomations
);const flows = await client.listFlows("My Workspace");
const flows = await client.listFlows(null, "My Deployment");const result = await client.runFlow("sales", "My Workspace");Resume a paused workspace before running:
const result = await client.runFlow(
"sales", // flow
"My Workspace", // workspace
null, // deployment
null, // uuid
null, // spec
true, // resume
);Pass a spec object for advanced options:
const result = await client.runFlow(
"sales", // flow
"My Workspace", // workspace
null, // deployment
null, // uuid
{ full_refresh: true }, // spec
);| Field | Type | Description |
|---|---|---|
full_refresh |
bool | Drop all internal data and recompute from scratch. Destructive. |
components |
list | Run only these components (by name). Omit to run all. |
component_categories |
list | Run only components in these categories. |
parameters |
object | Custom parameters passed to the flow. |
run_tests |
bool | Run tests after processing data. Defaults to true. |
store_test_results |
bool | Store test results. |
halt_flow_on_error |
bool | Stop the flow on error. |
disable_optimizers |
bool | Disable optimizers. |
update_materialization_type |
bool | Update component materialization types. May drop data. |
deep_data_pruning |
bool | Full table scan for Smart Table data maintenance. |
backfill_missing_statistics |
bool | Backfill statistics for data blocks without them. |
disable_incremental_metadata_collection |
bool | Disable incremental read/transform metadata collection. |
runner_overrides |
object | Runner config overrides (e.g., {"size": "Medium"}). |
const result = await client.listFlowRuns("My Workspace");
const runs = result.items; // array
const truncated = result.truncated; // boolFilter by status, flow name, time range, or paginate:
await client.listFlowRuns("My Workspace", null, null, "running");
await client.listFlowRuns(null, "My Deployment", null, null, "sales", null, null, null, 10);
await client.listFlowRuns("My Workspace", null, null, null, null, "2025-01-01T00:00:00Z");const run = await client.getFlowRun("fr-...", "My Workspace");// List providers and models
const providers = await client.listOttoProviders();
// Chat
const response = await client.otto("What flows are running?");
const response = await client.otto("Describe the sales flow", "My Workspace");const response = await client.ottoStreaming(
"Describe the sales flow",
(err, delta) => {
if (err) console.error(err);
else process.stdout.write(delta);
},
"My Workspace",
);- All methods are async (return Promises)
- All methods return plain objects or arrays
- TypeScript type definitions are included (
index.d.cts)
The SDK throws errors for:
- Missing configuration (environment variables not set)
- Authentication failures (invalid or expired key)
- HTTP errors (API returns non-2xx status)
- State errors (paused, starting, error state)
try {
await client.runFlow("sales", "My Workspace");
} catch (e) {
console.error(`Error: ${e.message}`);
}