Manage Ascend runtimes, flows, and flow runs from Python.
Requires uv (see Installation for setup).
uv add ascend-toolsUpgrade to the latest version:
uv add --upgrade ascend-toolsfrom ascend_tools import Client
client = Client() # reads ASCEND_SERVICE_ACCOUNT_ID, etc. from envSee Quickstart for the full service account creation walkthrough.
client = Client(
service_account_id="<YOUR_SERVICE_ACCOUNT_ID>",
service_account_key="<YOUR_SERVICE_ACCOUNT_KEY>",
instance_api_url="<YOUR_INSTANCE_API_URL>",
)All parameters are keyword-only.
runtimes = client.list_runtimes()Filter by ID, kind, project, or environment:
client.list_runtimes(id="my-runtime")
client.list_runtimes(kind="deployment")
client.list_runtimes(project_uuid="...", environment_uuid="...")Returns list[dict].
runtime = client.get_runtime(uuid="<RUNTIME_UUID>")Returns dict with fields: uuid, id, title, kind, project_uuid, environment_uuid, build_uuid, created_at, updated_at, health, paused.
client.pause_runtime(uuid="<RUNTIME_UUID>")
client.resume_runtime(uuid="<RUNTIME_UUID>")flows = client.list_flows(runtime_uuid="<RUNTIME_UUID>")Returns list[dict], each with a name field.
result = client.run_flow(runtime_uuid="<RUNTIME_UUID>", flow_name="sales")Resume a paused runtime before running:
result = client.run_flow(
runtime_uuid="<RUNTIME_UUID>",
flow_name="sales",
resume=True,
)Pass a spec dict for advanced options:
result = client.run_flow(
runtime_uuid="<RUNTIME_UUID>",
flow_name="sales",
spec={"full_refresh": True},
)result = client.run_flow(
runtime_uuid="<RUNTIME_UUID>",
flow_name="sales",
spec={
"components": ["transform_orders", "transform_customers"],
"parameters": {"date": "2025-01-01"},
"run_tests": False,
},
resume=True,
)Returns dict with event_uuid and event_type.
See CLI guide for the full spec options reference.
result = client.list_flow_runs(runtime_uuid="<RUNTIME_UUID>")
runs = result["items"] # list[dict]
truncated = result["truncated"] # boolFilter by status, flow name, time range, or paginate:
client.list_flow_runs(runtime_uuid="...", status="running")
client.list_flow_runs(runtime_uuid="...", flow_name="sales")
client.list_flow_runs(runtime_uuid="...", since="2025-01-01T00:00:00Z")
client.list_flow_runs(runtime_uuid="...", limit=10, offset=20)run = client.get_flow_run(runtime_uuid="<RUNTIME_UUID>", name="fr-...")Returns dict with fields: name, flow, build_uuid, runtime_uuid, status, created_at, error.
- All methods return
dictorlist[dict] - All parameters are keyword-only
- Type stubs are provided (
core.pyi) for IDE autocomplete - The package includes a
py.typedmarker (PEP 561)
The SDK raises exceptions for:
- Missing configuration (environment variables not set)
- Authentication failures (invalid or expired key)
- HTTP errors (API returns non-2xx status)
- Runtime state errors (paused, starting, error state)
try:
client.run_flow(runtime_uuid="...", flow_name="sales")
except Exception as e:
print(f"Error: {e}")