Setting Progress

kontinue allows you to set progress indicators and status messages on Executions. Progress is displayed as a progress bar in the UI and as a fraction in the CLI (kontinue show). Messages provide additional context about what the execution is currently doing.

Automatic Progress

For the simplest case, use ExecuteParallel or ExecuteSequential to automatically track progress when running multiple child executions:

func BatchProcess(ktx *kontinue.ExecutionContext, args *BatchArgs) (*BatchResult, error) {
    specs := make([]*kontinue.ChildExecutionOptions, len(args.Items))
    for i, item := range args.Items {
        specs[i] = &kontinue.ChildExecutionOptions{
            Function:  "process-item",
            Arguments: &ProcessItemArgs{Item: item},
        }
    }

    // Progress is automatically updated as children complete
    results, err := kontinue.ExecuteParallel[ProcessResult](ktx, specs)
    if err != nil {
        return nil, err
    }

    return &BatchResult{Results: results}, nil
}

When using ExecuteParallel or ExecuteSequential, progress is automatically set to show how many child executions have completed out of the total. This only happens if progress is not already set on the execution.

Manual Progress

For more control, use SetProgress to manually update the progress indicator:

func DeployWorkflow(ktx *kontinue.ExecutionContext, args *DeployArgs) (*DeployResult, error) {
    steps := []string{"validate", "build", "test", "deploy", "verify"}

    for i, step := range steps {
        // Update progress before each step
        kontinue.SetProgress(ktx, i, len(steps))

        switch step {
        case "validate":
            // validation logic...
        case "build":
            // build logic...
        // etc.
        }
    }

    // Mark as complete
    kontinue.SetProgress(ktx, len(steps), len(steps))
    return &DeployResult{}, nil
}

The SetProgress function takes the current step (0-indexed) and the total number of steps. Progress is displayed as a fraction in the CLI and as a progress bar in the UI.

ClearProgress

To remove the progress indicator:

kontinue.ClearProgress(ktx)

Setting Messages

Use SetMessage to provide context about what the execution is currently doing:

func ProvisionCluster(ktx *kontinue.ExecutionContext, args *ProvisionArgs) (*ProvisionResult, error) {
    kontinue.SetMessage(ktx, "Creating network resources")
    // create network...

    kontinue.SetMessage(ktx, "Provisioning compute instances")
    // provision instances...

    kontinue.SetMessage(ktx, "Configuring load balancer")
    // configure LB...

    // Set final message before completion
    kontinue.SetMessage(ktx, "Cluster provisioned successfully")
    return &ProvisionResult{ClusterID: clusterID}, nil
}

Messages are displayed in the CLI output and UI details panel. They can be updated at any time during execution to reflect the current state.

Final Messages

The message set before an execution completes becomes the final status message. This is useful for providing a summary of what was accomplished:

kontinue.SetMessage(ktx, fmt.Sprintf("Deployed version %s to %d nodes", version, nodeCount))
return &DeployResult{}, nil

Error Messages

When an execution fails with an error, the message is automatically set based on the error. You don’t need to manually set the message before returning an error:

if err != nil {
    // No need to call SetMessage - the error message will be used
    return nil, fmt.Errorf("failed to connect to database: %w", err)
}

Combining Progress and Messages

For the best user experience, combine progress tracking with descriptive messages:

func MigrateData(ktx *kontinue.ExecutionContext, args *MigrateArgs) (*MigrateResult, error) {
    tables := args.Tables

    for i, table := range tables {
        kontinue.SetProgress(ktx, i, len(tables))
        kontinue.SetMessage(ktx, fmt.Sprintf("Migrating table: %s", table))

        if err := migrateTable(ktx, table); err != nil {
            return nil, err
        }
    }

    kontinue.SetProgress(ktx, len(tables), len(tables))
    kontinue.SetMessage(ktx, fmt.Sprintf("Migrated %d tables successfully", len(tables)))

    return &MigrateResult{TablesProcessed: len(tables)}, nil
}

This gives users visibility into both how far along the execution is and what it’s currently working on.

Viewing Progress

CLI

Use kontinue show to see the current progress and message:

kontinue show my-execution

The output includes progress as a fraction (e.g., 3/5) and the current message.

UI

The UI displays progress as a visual progress bar on the execution details page. The message is shown below the progress indicator.

API

Progress and message are available in the Execution status:

exec, err := client.Get(ctx, "my-execution", nil)
if err != nil {
    return err
}

if exec.Status.Progress != nil {
    fmt.Printf("Progress: %d/%d\n", exec.Status.Progress.Current, exec.Status.Progress.Max)
}
fmt.Printf("Message: %s\n", exec.Status.Message)