Workflow Management¶
The current Python and Go SDKs support creation only for workflow definitions. They do not expose workflow list, detail, update, or delete methods. If automation needs full lifecycle management, first verify the Product API published by the target MOI instance and use a supported API client. Permission constants are not evidence that an endpoint is implemented by the SDK.
Use the built-in document pipeline¶
The high-level helper takes a workflow name, source volume ID, and target volume ID, then returns the workflow ID. It creates this fixed chain:
RootNode → DocumentParseNode → ChunkNode → EmbeddingNode/EmbeddingNodeV2 → WriteNode
The current Python implementation uses EmbeddingNodeV2; the Go implementation uses EmbedNode. Both set interval = -1, which triggers processing when a file is loaded into the source volume.
from moi import RawClient, SDKClient
raw = RawClient("https://api.example.com", "your-api-key")
client = SDKClient(raw)
workflow_id = client.create_document_processing_workflow(
"contract-processing",
"source-volume-id",
"target-volume-id",
)
print(workflow_id)
package main
import (
"context"
"fmt"
"log"
sdk "github.com/matrixorigin/moi-go-sdk"
)
func main() {
raw, err := sdk.NewRawClient("https://api.example.com", "your-api-key")
if err != nil {
log.Fatal(err)
}
client := sdk.NewSDKClient(raw)
workflowID, err := client.CreateDocumentProcessingWorkflow(
context.Background(),
"contract-processing",
sdk.VolumeID("source-volume-id"),
sdk.VolumeID("target-volume-id"),
)
if err != nil {
log.Fatal(err)
}
fmt.Println(workflowID)
}
The helper enables the text, PDF, Office, CSV, and HTML formats listed in its source. It is a fixed template: it does not accept node substitutions, model selection, or chunking options. Use the raw creation method when those details must change.
Create a custom graph¶
Python’s RawClient.create_workflow(request) accepts a dictionary. Go’s RawClient.CreateWorkflow(ctx, *WorkflowMetadata) uses these public types:
WorkflowMetadataholds the name, source and target volumes,ProcessMode, file types, and graph.CatalogWorkflowcontainsNodesandConnections.CatalogWorkflowNodecontainsID,Type, andInitParameters.CatalogWorkflowConnectioncontains sender and receiver nodes plus optional ports.
source_volume_names, source_volume_ids, process_mode, and each node’s init_parameters must not serialize as null. Both raw clients initialize missing collections to empty collections and default a missing process_mode to {"interval": -1, "offset": 0}.
Do not copy node types from the SDK helper and assume the target instance supports them. The target instance’s live WorkItem catalog is authoritative; the current SDKs do not wrap that catalog.
The create response contains metadata such as id, version, source and target volumes, timestamps, and flow interval. Persist at least the returned id, which is required for later job queries.
Update and delete boundaries¶
The SDKs do not currently expose workflow read, update, or delete methods. Validate the graph and target write behavior in a test workspace before creation rather than relying on a follow-up configuration call. For changes, use an explicitly documented Product API or the UI for the target instance. Do not use the private _request_json/postJSON helpers to guess unsupported paths.