Create Workflow¶
Use the AI Studio SDK to deploy a workflow definition to a specified workspace. The caller provides the workflow ID during deployment; upon successful deployment, a workflow reference bound to that ID is returned, which can subsequently be used to launch runs.
Task workflow¶
Prepare the workspace, workflow name, DSL YAML, and workflow ID. Save the workflow reference after deployment submission; the return of the deployment request does not mean that the workflow has executed. When execution is required, launch a run using the same workflow ID on the execution page.
Prerequisites¶
Required item |
How to obtain |
Role on this page |
|---|---|---|
Authenticated client and workspace ID |
Determine the resource scope of deployment. |
|
Workflow name, DSL YAML, and workflow ID |
Provided by workflow designers and callers. |
Create workflow definitions and define identifiers for future runs. |
This page only submits workflow definitions; it does not interpret DSL semantics or trigger runs.
Submit deployment¶
The following example deploys a workflow and retains the returned workflow reference. The workflow ID must be provided by the caller; subsequent reads or runs continue using this same identifier.
import os
import moi_product_sdk as sdk
client = sdk.new_with_personal_access_token(
os.environ["PRODUCT_API_BASE_URL"],
os.environ["PRODUCT_API_KEY"],
)
workspace = client.workspace("<workspace-id>")
workflow, deployment = workspace.deploy_workflow(
"<workflow-name>",
"<workflow-dsl-yaml>",
"<workflow-id>",
sdk.with_workflow_description("<workflow-description>"),
)
print(workflow.id)
print(deployment)
package main
import (
"context"
"fmt"
"os"
sdk "github.com/matrixorigin/matrixflow/sdk/go-sdk"
)
func main() {
ctx := context.Background()
client, err := sdk.NewWithPersonalAccessToken(
os.Getenv("PRODUCT_API_BASE_URL"),
os.Getenv("PRODUCT_API_KEY"),
)
if err != nil {
panic(err)
}
workspace, err := client.Workspace("<workspace-id>")
if err != nil {
panic(err)
}
workflow, deployment, err := workspace.DeployWorkflow(
ctx,
"<workflow-name>",
"<workflow-dsl-yaml>",
"<workflow-id>",
sdk.WithWorkflowDescription("<workflow-description>"),
)
if err != nil {
panic(err)
}
fmt.Println(workflow.ID())
fmt.Println(deployment)
}
Next steps¶
The deployed workflow reference and workflow ID can be passed to Run and track workflows to launch an execution. Prior to running, prepare runtime inputs according to the workflow’s input schema.