OpenSAI v1.0.0 · Materials v1.1.0
OpenSAI Usage Skill Specification
Translate the user's natural-language computing request into a controlled distributed execution using the connected opensai_* MCP tools, and return the domain output, measured duration, and key scheduling choices (the MCP connection itself is configured in the client beforehand).
1. Choose the Right Execution Entry Point
- Prefer registered applications: Call
opensai_list_appsfirst to inspect available applications, theirinputs, tunableknobs, and defaultqos. When an application matches the task, invokeopensai_run_app. - Fall back to DAGs or single tasks: If no registered application fits, inspect available step implementations via
opensai_catalogand compose a multi-step workflow (opensai_submit_dag), or callopensai_submit_taskfor a single algorithm. Queryopensai_list_devicesandopensai_list_dataas needed and reuse discovery results while they remain valid. - Match tool scope to user intent: An explicit request to run or benchmark a task authorizes that execution—proceed directly without redundant confirmation prompts. When the user only asks to inspect cluster state or explain a past run, use read-only tools exclusively.
2. Map User Goals into Tool Arguments
| User Intent | Tool Settings |
|---|---|
| Domain input values for this run (points, frame, scene) | Pass in inputs |
| Parameters that must stay locked for business correctness | Pin in knobs; leave remaining knobs open for platform adaptation |
| "Finish within N seconds" (meet deadline at highest feasible quality) | mode: "deadline", deadline_s: N |
| "Finish as fast as possible" (with optional quality floor) | mode: "fastest", plus optional min_quality |
| "Meet the deadline while minimizing resource usage" | mode: "efficient", deadline_s: N (optional min_quality) |
- Argument layout: MCP tools take
mode,deadline_s, andmin_qualityas top-level fields, whereas the Python SDK nests them insideqos={...}. Unspecified fields inherit the application manifest's defaults. Always interpret quality scores on the scale declared by that specific application.
Standard opensai_run_app invocation when cluster_analytics is registered:
json
{
"app": "cluster_analytics",
"inputs": {"points": 30000, "seed": 1},
"deadline_s": 3,
"wait": true,
"wait_timeout": 60
}3. Submit Once and Track Idempotently
- Record the returned
job_idimmediately and track completion viaopensai_wait_resultor inspect snapshots viaopensai_get_result. - A response with
done=falsemeans the client wait window elapsed while the job is still running—continue polling the samejob_idrather than submitting a duplicate job. - When retrying an uncertain submission after a transient transport error, reuse the same
idempotency_keyto prevent duplicate execution. OnRATE_LIMITED, wait forretry_after_sbefore retrying.
4. Compose a DAG or Register an Application Package
- DAG specification (
dag_spec): Providenameandnodes, where each node defines a unique positive integerid, a catalogalgorithm, domainparams, and predecessor IDs inbefore_nodes. Always runopensai_validate_dagprior to submission. Specify resource requests inresources(coresas integer count,mem_mbandstorage_mbin MiB, and note thatbw_mbpscurrently takes MB/s); to pin a worker, pass itsallocation_indexasdirect_allocation_id. - Application packages: Combine an
app.yamlmanifest with self-containedsteps/Algorithm_*.pymodules exporting__all__and implementing__init__(self, param_dict, data_dict)andrun(self). OpenSAI injects_artifact_in,_artifact_out,_alloc, and_data_dirat runtime—never pass underscore-prefixed keys from the caller. Return domain output fromrun(), and report normalized quality (0–1) and numeric metrics viaself.qualityandself.metrics. - Safe registration: Validate with
opensai_validate_appbefore executing an explicitly authorized registration; ask for clarification only when an operation would overwrite an application from a different owner or expand scope beyond the user's request. Registration distributes step Python code only—third-party libraries, model weights, and large datasets must be prepared on eligible workers.
5. Verify Data Locality and Transfer Paths
- Check dataset locations with
opensai_list_data. Declare strict data affinity via stepdatain manifests orrequires_datain DAG nodes. Specify target worker indices inopensai_upload_data(devices), as omittingdevicesuploads to every online worker. - In remote deployments,
patharguments resolve on the MCP server host; supplymanifestandfilesas inline text when registering remotely without host filesystem access. - Cross-device artifacts move automatically over direct QUIC by default. Relay multipath is controlled at hub startup via
OPENSAI_MULTIPATH=1; inspect job transfer path records to explain whether a run used direct or relay paths.
6. Report Actionable, Verifiable Results
- Lead with the outcome: State job status (
SUCCEEDED/FAILED) and domain output first, followed by wall-clockduration_s, measured quality, and key placement/resource/knob choices fromopensai_explain_job(clearly distinguishing predicted estimates from measured outcomes). - Interpret metrics accurately:
duration_sis end-to-end job wall time;compute_s,fetch_s, andqueue_ssum across nodes and must not be added together when parallel branches overlap.core_secondsmeasures allocated CPU core-time, whilebytes_movedcounts useful payload bytes fetched (check path records for multi-hop relay traffic). - Handle failures and long outputs: On failure, inspect the failing node's error message—refresh discovery if an app/algorithm is missing, or check
opensai_list_datafor missing datasets. If output text is truncated, increasemax_result_charsinopensai_get_result(up to4000) or save full results via the Python SDK.