workflow.management
Modules
Module workflow.management
API
Definitions
ballerina/workflow.management Ballerina library
Functions
cancelWorkflow
Requests graceful cancellation of a running workflow. The workflow can handle the cancellation and perform cleanup before stopping.
Parameters
- workflowId string - The workflow ID to cancel
- runId string - The specific run ID to cancel (pass empty string to use latest run)
Return Type
- error? - An error if cancellation cannot be requested
completeHumanTask
function completeHumanTask(string taskWorkflowId, anydata result, [string, string...]? callerRoles, string? userId) returns error?Completes a pending human task by sending the result back to the waiting workflow.
This is the preferred API location; workflow:completeHumanTask delegates here.
check management:completeHumanTask(taskWorkflowId, {approved: true, comment: "LGTM"});
Parameters
- taskWorkflowId string - Temporal workflow ID of the human task child workflow
- result anydata - The value to return to the workflow
- callerRoles [string, string...]? (default ()) - Roles held by the caller; validated against the task's configured
userRoles
- userId string? (default ()) - Optional user identifier stored in the audit trail (from
x-user-idheader)
Return Type
- error? - An error if the task cannot be found, is already completed, or the caller is unauthorized
completeReviewActivity
function completeReviewActivity(string taskWorkflowId, ReviewDecision decision, [string, string...]? callerRoles, string? userId) returns error?Completes a pending review activity by sending the human's decision back to the
waiting workflow. The taskWorkflowId is the child workflow ID of the review
activity, available via listPendingReviewActivities or listAllReviewActivities.
// Proceed with the original arguments (run the gated call / rerun the failed one) check management:completeReviewActivity(taskId, {action: "proceed"}); // Proceed with edited arguments check management:completeReviewActivity(taskId, {action: "proceed-with-input", input: {"orderId": "NEW-123"}}); // Reject: skip the call / fail the activity, with feedback for the agent check management:completeReviewActivity(taskId, {action: "reject", feedback: "Amount too high"});
Parameters
- taskWorkflowId string - Temporal workflow ID of the review activity child workflow (a bare UUID;
its
reviewactivity--prefixed kind travels in the workflow type and memo)
- decision ReviewDecision - The review decision: proceed, proceed with new input, or reject
- callerRoles [string, string...]? (default ()) - Roles held by the caller; validated against the task's configured
userRoles
- userId string? (default ()) - Optional user identifier stored in the audit trail (from
x-user-idheader)
Return Type
- error? - An error if the task cannot be found, is already completed, or the caller is unauthorized
errorCodeOf
Classifies a management error into its ErrorCode reason.
Parameters
- err Error - The error a management operation returned
Return Type
- ErrorCode - The error's protocol-independent reason
executeCommand
Executes a management operation.
Parameters per operation, all optional unless stated:
LIST_DEFINITIONS— none.GET_RUNTIME_INFO— none.LIST_INSTANCES—status,workflowType,workflowId,startedBy,limit,pageToken,startTimeFrom,startTimeTo,closeTimeFrom,closeTimeTo,taskQueue,kind(WORKFLOW,HUMAN_TASK,REVIEW_ACTIVITY,CHILD_WORKFLOW,AGENT). Without akindthe listing excludes task and review children, as it did before kinds existed; each row reports its ownkind, so an unfiltered listing is still self-describing.START_INSTANCE—workflowType(required),input,workflowId,timeoutSeconds.GET_INSTANCE,SUSPEND_INSTANCE,RESUME_INSTANCE,CANCEL_INSTANCE,GET_INSTANCE_HISTORY,GET_INSTANCE_ACTIVITY_TREE,GET_INSTANCE_EXECUTION_GRAPH—workflowId(required),runId.WAKE_INSTANCE—workflowId(required).TERMINATE_INSTANCE—workflowId(required),runId,reason.LIST_HUMAN_TASKS—status,parentWorkflowId,parentWorkflowType,taskName,userRole,limit,pageToken, the four time bounds,taskQueue.LIST_WORK_ITEMS—kinds(comma list ofHUMAN_TASK/REVIEW_ACTIVITY; both when absent),status,parentWorkflowId,parentWorkflowType,limit,pageToken, the four time bounds,taskQueue.COUNT_PENDING_HUMAN_TASKS—taskQueue.GET_HUMAN_TASK—taskId(required).COMPLETE_HUMAN_TASK—taskId(required),result.FAIL_HUMAN_TASK—taskIdandreason(required),details.LIST_REVIEW_ACTIVITIES—status,parentWorkflowId,taskName,limit,pageToken, the four time bounds,taskQueue.GET_REVIEW_ACTIVITY—taskId(required).DECIDE_REVIEW_ACTIVITY—taskIdandaction(required),input,feedback.BULK_RETRY_REVIEW_ACTIVITIES—action(required,"retry"or"fail"), and exactly one oftaskIds(an array of review activity IDs) orparentWorkflowId;activityNamenarrows aparentWorkflowIdselection,feedbackaccompanies"fail". There is no parameter for replacement arguments: a bulk decision cannot change the payload an activity is retried with.LIST_RESET_POINTS—workflowId(required),runId.RESET_INSTANCE—workflowIdandresetType(required),runId,eventId(required whenresetTypeis"workflow-task-id"),reason, andreapply({"type": …, "exclude": [...]}).
json|management:Error result = management:executeCommand({ operation: management:COMPLETE_HUMAN_TASK, params: {taskId: "humantask-...", result: {approved: true}}, identity: {userId: "alice", roles: ["approver"]} });
This function authenticates nothing. It trusts command.identity as given and
applies only the role checks the operations themselves perform — the same checks
the HTTP API relies on once it has resolved a caller. A consumer that accepts
commands from a remote channel is responsible for authenticating that channel and
for populating identity from a verified credential; scope policies configured
for the HTTP API (enforceScopes and friends) belong to that module and have no
effect here.
Parameters
- command Command - The command to execute
Return Type
- json|Error - The operation's payload, or the error explaining why it could not run
failHumanTask
function failHumanTask(string taskWorkflowId, string reason, map<json>? details, [string, string...]? callerRoles, string? userId) returns error?Fails (rejects) a pending human task with a reason and optional structured details.
Internally sends a rejection payload to the waiting workflow so it can handle the
rejection case. The caller's roles are validated against the task's userRoles.
check management:failHumanTask(taskId, "Missing required documents", details = {"missingDocs": ["invoice", "receipt"]}, callerRoles = ["finance_approver"]);
Parameters
- taskWorkflowId string - Temporal workflow ID of the human task child workflow
- reason string - Human-readable reason for the rejection
- details map<json>? (default ()) - Optional structured details about the failure (recorded with the rejection)
- callerRoles [string, string...]? (default ()) - Roles held by the caller; validated against the task's
userRoles
- userId string? (default ()) - Optional user identifier stored in the audit trail (from
x-user-idheader)
Return Type
- error? - An error if the task cannot be found, is already completed, or the caller is unauthorized
getActivityTree
function getActivityTree(string workflowId, string runId) returns ActivityTreeNode[]|errorParses the workflow execution history and returns a flat ordered list of activity, child-workflow, timer, and signal nodes with their status, timing, and I/O. Human-task and retry-task child workflows are classified with their specific types.
Parameters
- workflowId string - The workflow instance ID
- runId string - The specific run ID (pass empty string for the latest run)
Return Type
- ActivityTreeNode[]|error - Ordered array of tree nodes, or an error
getAgentResponse
Gets the latest response produced by a durable agent (a workflow:DurableAgent).
In a multi-turn conversation this is the answer of the most recent turn; it is
available while the agent is still running (e.g. suspended waiting for the next
chat event) as well as after it completes.
import ballerina/workflow.management; string? answer = check management:getAgentResponse(agentId);
Parameters
- agentId string - The agent's workflow ID (from
workflow:run)
getExecutionGraph
function getExecutionGraph(string workflowId, string runId) returns ExecutionGraph|errorDerives a directed execution graph from the workflow history suitable for rendering with D3.js or React Flow. Nodes represent execution steps; edges connect them in the order they were scheduled.
Parameters
- workflowId string - The workflow instance ID
- runId string - The specific run ID (pass empty string for the latest run)
Return Type
- ExecutionGraph|error - Graph with nodes and edges, or an error
getHumanTaskInfo
function getHumanTaskInfo(string taskId) returns HumanTaskInfo|errorReturns detailed info for a single human task, including memo fields. Calls Temporal DescribeWorkflowExecution to read the memo set at task creation.
management:HumanTaskInfo info = check management:getHumanTaskInfo(taskId);
Parameters
- taskId string - The child workflow ID of the human task (a bare UUID; the kind travels in its memo)
Return Type
- HumanTaskInfo|error - Full task info including title, userRoles, taskInput, and formSchema, or an error
getReviewActivityInfo
function getReviewActivityInfo(string taskId) returns ReviewActivityInfo|errorReturns detailed info for a single review activity, including the failure context,
the activity arguments that triggered the task, and the JSON Schema of the input
accepted by the proceed-with-input decision (formSchema).
management:ReviewActivityInfo info = check management:getReviewActivityInfo(taskId);
Parameters
- taskId string - The child workflow ID of the review activity (a bare UUID; the kind travels in its memo)
Return Type
- ReviewActivityInfo|error - Full review activity info including errorMessage, activityArgs, formSchema, and userRoles, or an error (including when the ID refers to a human task or any non-review workflow)
getWorkflowHistory
function getWorkflowHistory(string workflowId, string runId) returns HistoryEvent[]|errorReturns all execution history events for a workflow run in chronological order. Each event includes an event-type-specific attribute map suitable for timeline display.
Parameters
- workflowId string - The workflow instance ID
- runId string - The specific run ID (pass empty string for the latest run)
Return Type
- HistoryEvent[]|error - Ordered array of history events, or an error
getWorkflowInfo
function getWorkflowInfo(string workflowId) returns WorkflowExecutionInfo|errorGets current execution info for a workflow without waiting for it to finish. Returns the status, workflow type, and ID.
import ballerina/workflow.management; WorkflowExecutionInfo info = check management:getWorkflowInfo(workflowId);
Parameters
- workflowId string - The workflow ID
Return Type
- WorkflowExecutionInfo|error - Execution info, or an error
getWorkflowInfoForRun
function getWorkflowInfoForRun(string workflowId, string runId) returns WorkflowExecutionInfo|errorGets execution info for a specific run of a workflow, identified by both workflow ID and run ID.
Unlike getWorkflowInfo, this targets the exact run rather than the latest run.
Return Type
- WorkflowExecutionInfo|error - Execution info, or an error
getWorkflowMetadata
function getWorkflowMetadata() returns WorkflowMetadata|errorReturns the workflow metadata document for this program: registered workflow definitions, human tasks, activities, and durable agents, with their JSON schemas. The document is complete at module init — before any workflow has executed — so it is safe to read once at startup and publish to a control plane.
import ballerina/workflow.management; management:WorkflowMetadata meta = check management:getWorkflowMetadata();
Return Type
- WorkflowMetadata|error - The metadata document, or an error
getWorkflowTaskQueue
function getWorkflowTaskQueue() returns string?Returns the Temporal task queue this program's worker serves, or nil before the worker has registered. The queue is chosen at program startup — worker configuration, not workflow metadata — which is why it is exposed on its own rather than inside the metadata document: a control plane treats it as runtime state, like capabilities. Integrations in one project share a Temporal namespace, so the queue is the only attribute separating one integration's executions from its neighbours'.
string? queue = management:getWorkflowTaskQueue();
Return Type
- string? - The worker's task queue, or nil before the worker has registered
listAllHumanTasks
function listAllHumanTasks(string? status, string? startTimeFrom, string? startTimeTo, string? closeTimeFrom, string? closeTimeTo, string? taskQueue) returns HumanTaskSummary[]|errorLists all human task instances across all parent workflows, with optional filters.
Queries Temporal's visibility API for executions whose workflow TYPE starts with
humantask-. The taskName and parentWorkflowId fields are extracted from the task's
Temporal memo (set when the task was created by awaitHumanTask).
management:HumanTaskSummary[] pending = check management:listAllHumanTasks(status = "PENDING"); management:HumanTaskSummary[] recent = check management:listAllHumanTasks(startTimeFrom = "2026-06-01T00:00:00Z");
Parameters
- status string? (default ()) - Optional status filter:
PENDING|COMPLETED|FAILED|CANCELED|TERMINATED
- startTimeFrom string? (default ()) - Optional ISO-8601 lower bound on task start time (inclusive)
- startTimeTo string? (default ()) - Optional ISO-8601 upper bound on task start time (inclusive)
- closeTimeFrom string? (default ()) - Optional ISO-8601 lower bound on task close time (inclusive)
- closeTimeTo string? (default ()) - Optional ISO-8601 upper bound on task close time (inclusive)
- taskQueue string? (default ()) - Optional task queue filter: only tasks served by that integration. Omitted, all task queues in the configured namespace are returned
Return Type
- HumanTaskSummary[]|error - Array of human task summaries, or an error
listAllReviewActivities
function listAllReviewActivities(string? status, string? startTimeFrom, string? startTimeTo, string? closeTimeFrom, string? closeTimeTo, string? taskQueue) returns ReviewActivitySummary[]|errorLists all review activity instances across all parent workflows, with optional filters.
Queries Temporal's visibility API for executions whose workflow TYPE starts with
reviewactivity-.
management:ReviewActivitySummary[] pending = check management:listAllReviewActivities(status = "PENDING"); management:ReviewActivitySummary[] recent = check management:listAllReviewActivities(startTimeFrom = "2026-06-01T00:00:00Z");
Parameters
- status string? (default ()) - Optional status filter:
PENDING|COMPLETED|FAILED|CANCELED|TERMINATED
- startTimeFrom string? (default ()) - Optional ISO-8601 lower bound on task start time (inclusive)
- startTimeTo string? (default ()) - Optional ISO-8601 upper bound on task start time (inclusive)
- closeTimeFrom string? (default ()) - Optional ISO-8601 lower bound on task close time (inclusive)
- closeTimeTo string? (default ()) - Optional ISO-8601 upper bound on task close time (inclusive)
- taskQueue string? (default ()) - Optional task queue filter; without it, every queue in the configured namespace
Return Type
- ReviewActivitySummary[]|error - Array of review activity summaries, or an error
listPendingHumanTasks
function listPendingHumanTasks(string parentWorkflowId) returns HumanTaskGroup[]|errorReturns the pending human task child workflows started by the given parent workflow,
grouped by task type and sorted alphabetically by task name. Scans the parent's
event history for child workflow start events whose workflow TYPE has the
humantask- prefix (the ID itself is a bare UUID; what a task is travels in its
type and memo).
management:HumanTaskGroup[] groups = check management:listPendingHumanTasks(parentWorkflowId); // groups are sorted alphabetically by taskName foreach management:HumanTaskGroup group in groups { foreach string taskId in group.taskIds { check workflow:completeHumanTask(taskId, decision); } }
Parameters
- parentWorkflowId string - The Temporal workflow ID of the parent workflow
Return Type
- HumanTaskGroup[]|error - Array of task groups sorted by task name, or an error
listPendingReviewActivities
function listPendingReviewActivities(string parentWorkflowId) returns ReviewActivitySummary[]|errorReturns pending review activity child workflows started by the given parent workflow,
grouped by task name and sorted alphabetically. Scans the parent's event history for
child workflow start events whose workflow TYPE has the reviewactivity- prefix (the
ID itself is a bare UUID).
management:ReviewActivitySummary[] tasks = check management:listPendingReviewActivities(parentWorkflowId); foreach management:ReviewActivitySummary task in tasks { check management:completeReviewActivity(task.taskId, {action: "proceed"}); }
Parameters
- parentWorkflowId string - The Temporal workflow ID of the parent workflow
Return Type
- ReviewActivitySummary[]|error - Array of pending review activity summaries, or an error
listResetPoints
function listResetPoints(string workflowId, string runId) returns ResetPoint[]|errorReturns the events this run can be reset to — its workflow-task events — each annotated with the activity-tree nodes that task scheduled. A reset target is a workflow task, so the annotation is what lets a caller see which steps a point re-runs before choosing it.
Parameters
- workflowId string - The workflow instance ID
- runId string - The specific run ID (pass empty string for the latest run)
Return Type
- ResetPoint[]|error - Ordered array of reset points, or an error
listWorkflowDefinitions
function listWorkflowDefinitions() returns WorkflowDefinition[]|errorLists all workflow types registered with this worker, for use in the workflow launcher UI.
Returns one entry per registered workflow function. The inputSchema field is derived at
runtime from the registered workflow function's signature, or () when the workflow takes
no data input.
management:WorkflowDefinition[] defs = check management:listWorkflowDefinitions();
Return Type
- WorkflowDefinition[]|error - Array of workflow definitions, or an error
listWorkflowInstances
function listWorkflowInstances(string? status, string? workflowType, string? workflowId, string? startedBy, int 'limit, string? pageToken, string? startTimeFrom, string? startTimeTo, string? closeTimeFrom, string? closeTimeTo, string? taskQueue, string? kind) returns WorkflowInstancePage|errorLists workflow instances with optional filtering and pagination. Excludes humantask- and reviewactivity- child workflows automatically.
Parameters
- status string? (default ()) - Optional status filter:
RUNNING|SUSPENDED|COMPLETED|FAILED|CANCELED|TERMINATED.RUNNINGexcludes suspended workflows;SUSPENDEDreturns only workflows paused via the suspend management API.
- workflowType string? (default ()) - Optional workflow type filter
- workflowId string? (default ()) - Optional workflow ID prefix filter
- startedBy string? (default ()) - Optional starter user ID filter (set via management API
x-user-idwhen started)
- 'limit int (default 20) - Maximum number of results (capped at maxPageSize)
- pageToken string? (default ()) - Opaque continuation token from a prior call
- startTimeFrom string? (default ()) - Optional ISO-8601 lower bound on workflow start time (inclusive)
- startTimeTo string? (default ()) - Optional ISO-8601 upper bound on workflow start time (inclusive)
- closeTimeFrom string? (default ()) - Optional ISO-8601 lower bound on workflow close time (inclusive)
- closeTimeTo string? (default ()) - Optional ISO-8601 upper bound on workflow close time (inclusive)
- taskQueue string? (default ()) - Optional task queue filter; without it, every queue in the configured namespace
- kind string? (default ()) - Optional kind filter:
WORKFLOW,HUMAN_TASK,REVIEW_ACTIVITY,CHILD_WORKFLOWorAGENT. Without it the listing excludes task and review children, as it did before kinds existed. Each summary reports its ownkind, so an unfiltered listing is still self-describing. Filtering needs theWorkflowKindsearch attribute; where the server has none — the in-memory dev server, which supports no custom attributes — the listing comes back unfiltered with a warning rather than failing.
Return Type
- WorkflowInstancePage|error - Paginated list of workflow instance summaries, or an error
resetWorkflowExecution
function resetWorkflowExecution(string workflowId, string runId, int eventId, string reason, string reapplyType, string[] reapplyExclude, string identity, string idempotencyKey) returns WorkflowHandle|errorResets a run to a workflow-task event: history up to that point is preserved and everything after it re-executes as a new run of the same workflow ID.
Everything downstream of the point runs again, including the error handling and compensation the workflow already performed on its first pass, and replay happens against the worker's current code — a workflow function that changed since the run started can fail to replay.
Parameters
- workflowId string - The workflow instance ID
- runId string - The specific run ID (pass empty string for the latest run)
- eventId int - The workflow-task event to reset to, from
listResetPoints
- reason string - Audit reason recorded with the reset
- reapplyType string -
signal|none|all-eligible
- reapplyExclude string[] - Event categories to withhold from reapply
- identity string - The caller recorded as the reset's identity
- idempotencyKey string (default "") - Identifies the request so a retry is a no-op rather than a second
reset. Pass the request as the caller made it, not what it resolved
to: with
runIdomitted, "latest" names a different run once the first reset has created one. Empty derives a key from the arguments.
Return Type
- WorkflowHandle|error - Handle carrying the unchanged workflow ID and the new run ID, or an error
resumeWorkflow
Resumes a previously suspended workflow by sending a __wf_resume signal.
check management:resumeWorkflow(workflowId);
Parameters
- workflowId string - The workflow ID to resume
Return Type
- error? - An error if the signal cannot be delivered
resumeWorkflowRun
Resumes a specific run of a suspended workflow. Targets the exact runId rather than
the latest run, which is correct when a workflow ID has multiple historical runs.
Return Type
- error? - An error if the signal cannot be delivered
startWorkflowByType
function startWorkflowByType(string workflowType, json? input, string? workflowId, int? timeoutSeconds, string? startedBy) returns WorkflowHandle|errorStarts a new workflow instance by its registered type name.
Parameters
- workflowType string - The registered workflow type (function name)
- input json? - Workflow input as a JSON-compatible value. A durable agent is started with
its
{query, input}envelope:queryis the user turn, andinputis the payload validated against the agent's declaredinputType
- workflowId string? (default ()) - Optional explicit workflow ID; a UUID-v7 is generated if omitted
- timeoutSeconds int? (default ()) - Optional workflow execution timeout in seconds
- startedBy string? (default ()) - Optional starter user ID; stored with workflow metadata for filtering
Return Type
- WorkflowHandle|error - Handle with workflowId and runId, or an error
suspendWorkflow
Parameters
- workflowId string - The workflow ID to suspend
Return Type
- error? - An error if the signal cannot be delivered
suspendWorkflowRun
Suspends a specific run of a workflow. Targets the exact runId rather than the
latest run, which is correct when a workflow ID has multiple historical runs.
Parameters
- workflowId string - The workflow ID to suspend
- runId string - The specific run ID to suspend
Return Type
- error? - An error if the signal cannot be delivered
terminateWorkflow
Terminates a running workflow immediately with an optional reason. Unlike cancel, terminate does not allow the workflow to perform cleanup.
Parameters
- workflowId string - The workflow ID to terminate
- runId string - The specific run ID to terminate (pass empty string to use latest run)
- reason string? (default ()) - Optional human-readable reason
Return Type
- error? - An error if the workflow cannot be found or terminated
toErrorJson
function toErrorJson(Error err) returns jsonThe canonical JSON representation of a management error:
{"error": {"message": "..."}}. Every transport serializes errors this way, so
a consumer sees the same payload whichever path the operation was invoked
through.
Parameters
- err Error - The error to represent
Return Type
- json - The error as a
jsonpayload
wakeAgent
Requests a running workflow to suspend (pause) execution.
Sends a __wf_suspend signal; the workflow stops making progress at its next durable
operation (activity call, timer, human task, retry task, or child workflow) and
holds there until resumeWorkflow is called. While suspended, the workflow's reported
status is SUSPENDED. An operation already in flight when the signal arrives finishes
first — suspension takes effect at the next operation boundary.
check management:suspendWorkflow(workflowId);
Wakes a durable agent instance out of its built-in sleep tool by sending the
__agent_wake signal. Harmless when the instance is not sleeping: the request
is consumed by the next sleep.
check management:wakeAgent(instanceId);
Parameters
- workflowId string - The agent instance ID to wake
Return Type
- error? - An error if the signal cannot be delivered
Enums
workflow.management: ActivityNodeType
Classification of a node in the activity tree or execution graph. DATA marks
a received data event (workflow:sendData answering a wait dataEvents.<name>).
Members
workflow.management: BulkItemOutcome
What happened to one review activity in a bulk decision.
APPLIED — the decision was submitted.
SKIPPED — the task was not eligible and nothing was submitted: it was already
decided, or it gates a proposed call (PRE_RUN) rather than reviewing a failure.
FAILED — the decision could not be submitted: the task does not exist, the caller
may not decide it, or the runtime rejected it.
Members
workflow.management: ErrorCode
The machine-readable, protocol-independent reason a management operation failed.
One value per Error subtype, so a consumer that carries errors across a
boundary (a wire format, generated code, a log pipeline) can branch on the
reason without doing is-checks against this module's error types — and without
this module knowing anything about the consumer's protocol. Adapters own the
translation: workflow.management.rest maps these to HTTP status codes; other
transports map them to their own vocabulary.
Members
workflow.management: Operation
Names a management operation. The string value of each member is the operation's
stable wire name, so a consumer that receives an operation as text converts it
with cloneWithType/ensureType and gets a compile-time-checked value.
Members
Configurables
workflow.management: maxPageSize
Maximum number of items returned per page in list operations.
workflow.management: maxBulkRetrySize
Maximum number of review activities one bulk decision may address. A selector that resolves to more is rejected rather than truncated, so a caller is never told a decision was applied to a set larger than the one it was applied to.
workflow.management: reviewActivityAccessRole
Optional role required to view or decide review activities that declare no roles of
their own. A failure review declares the roles its retryPolicy names — a role
string, or a list of them — and declares none only when the policy is the legacy
"MANUAL_RETRY" sentinel, which opts out of role restriction. By default (()),
those unrestricted reviews are visible to any caller; set a role name to restrict
them to callers holding that role. Review activities that do declare roles always
require a matching caller role, regardless of this setting.
Records
workflow.management: ActivityInvocation
Information about an activity invocation (for testing/introspection).
Fields
- activityName string - The name of the activity that was invoked
- input anydata[] - The arguments passed to the activity
- output anydata? - The result returned by the activity (nil if not yet completed or failed)
- status string - The status of the activity execution ("COMPLETED", "FAILED", "RUNNING", "PENDING")
- errorMessage string? - Error message if the activity failed
- attempt? int - The attempt number for this invocation (1-based; values greater than 1 indicate a retry)
workflow.management: ActivityMeta
Describes one registered activity for metadata publishing. The input schema backs
review-activity proceed-with-input forms.
Fields
- workflowType string - The workflow definition the activity is registered under
- name string - The activity function name
- inputSchema string? - JSON Schema of the activity's data parameters as a string, or
()when it cannot be derived
workflow.management: ActivityTreeNode
A node in the activity execution tree for a workflow instance.
Fields
- id string - Unique node identifier (Temporal scheduledEventId or initiatedEventId as string)
- name string - Activity, task, or workflow type name
- 'type ActivityNodeType - Node classification
- status string - Current status: RUNNING | WAITING | COMPLETED | FAILED | TIMED_OUT | CANCELED (WAITING marks a data event the workflow is currently blocked on)
- startTime string? - ISO-8601 timestamp when this node started, or
()
- endTime string? - ISO-8601 timestamp when this node ended, or
()if still running
- input anydata? - Decoded activity/workflow input, or
()
- output anydata? - Decoded activity/workflow result, or
()
- failure FailureInfo? - Failure detail if the node failed, otherwise
()
- attempt int - Temporal attempt number (1-indexed)
- stepId string?(default ()) - Which step of the workflow ran: the id chosen with
stepIdat the call site, or the generated<target>#<ordinal>, matching a node in the descriptor'sgraph.()when the execution carries none — an instance started before the runtime recorded it
- reviewStepId string?(default ()) - For a review: its own node in the descriptor graph (
<reviewedStep>#review). Nil for other node kinds
- children ActivityTreeNode[]? - Nested child nodes, or
()for leaf nodes
workflow.management: AgentMeta
Describes one declared durable agent for metadata publishing.
Fields
- name string - The agent name (its module-level variable name)
- events string[] - Declared event channel names
- tools string[] - Tool names advertised to the model (declared activities and tools)
- humanTasks string[] - Qualified names (
<agent>.<task>) of the agent's declared human tasks
workflow.management: BulkItemResult
The outcome of one review activity within a bulk decision.
Fields
- taskId string - Workflow ID of the review activity this outcome belongs to
- outcome BulkItemOutcome - Whether the decision was applied, skipped, or failed
- reason string? - Why, for
SKIPPEDandFAILED;()when the decision was applied
workflow.management: BulkRetryResult
The result of a bulk decision. A bulk decision reports per-task outcomes rather than failing as a whole: one task decided by another operator in the meantime, or one the caller may not decide, does not stop the rest.
Fields
- action BulkRetryAction - The decision applied to every eligible task
- requested int - Number of tasks the selector resolved to
- applied int - Number of tasks the decision was submitted for
- skipped int - Number of tasks that were not eligible
- failed int - Number of tasks the decision could not be submitted for
- items BulkItemResult[] - Per-task outcomes, in the order the tasks were processed
- decidedBy string - User ID of the caller, or
"unknown"when the caller presented none
- decidedAt string - ISO-8601 timestamp of when the bulk decision was processed
workflow.management: Command
A management operation to execute, named by Operation and parameterized by a
map. Parameter names match the operation's own vocabulary and are documented
with executeCommand.
Fields
- operation Operation - The operation to run
- params map<json>(default {}) - The operation's parameters
- identity Identity(default {}) - The caller's identity
workflow.management: CompletionInfo
Audit record returned by human task completion operations.
Fields
- success boolean - Always true on the success path
- completedBy string - User ID extracted from the
x-user-idrequest header
- completedAt string - ISO-8601 timestamp of when the completion was processed
workflow.management: ExecutionGraph
Directed graph representing workflow execution flow for visualization.
Fields
- nodes GraphNode[] - Graph nodes (activities, tasks, timers, signals)
- edges GraphEdge[] - Directed edges connecting nodes in execution order
workflow.management: FailureInfo
A single failure description extracted from a Temporal activity or child-workflow failure.
Fields
- message string - Human-readable failure message
- 'type string? - Application failure type string, or
()if unavailable
- cause string? - Message of the root-cause failure, or
()if no cause chain
workflow.management: GraphEdge
A directed edge in the execution graph.
Fields
- 'source string - Source node ID
- target string - Target node ID
- label string? - Optional edge label
workflow.management: GraphNode
A node in the execution graph.
Fields
- id string - Unique node identifier
- label string - Display label
- 'type ActivityNodeType - Node classification (same values as
ActivityNodeType)
- status string - Current status
- metadata map<json>? - Optional extra key-value pairs for the UI:
taskIdfor human tasks, andstepId— which step ran, for highlighting the descriptor's graph
workflow.management: HistoryEvent
A single event from the Temporal workflow execution history.
Fields
- eventId int - Monotonically increasing event sequence number
- eventType string - Temporal event type name (e.g.
ACTIVITY_TASK_SCHEDULED)
- timestamp string - ISO-8601 wall-clock timestamp of the event
- attributes map<json> - Event-type-specific attribute map
workflow.management: HumanTaskGroup
Groups human task instances by task type for a single parent workflow.
Fields
- taskName string - The task type name (the
taskNamepassed toawaitHumanTask)
- taskIds string[] - Child workflow IDs of pending instances of this task type, in the order they were started
workflow.management: HumanTaskInfo
Detailed info about a human task, including memo fields set at task creation.
Fields
- namespace? string - The Temporal namespace the task lives in (the project scope)
- taskQueue? string - The task queue of the integration serving this task; route mutations there
- taskId string - Child workflow ID of this task instance
- taskName string - Task type name
- parentWorkflowId string - Workflow ID of the parent that created this task
- status string - Current status, mirroring the underlying task workflow:
PENDING(awaiting a human) |COMPLETED(a human submitted a result) |FAILED(rejected via the fail operation, or timed out before anyone acted) |CANCELED(retired internally because the parent workflow closed) |TERMINATED(an admin terminated the task workflow)
- startTime string - ISO-8601 timestamp when the task was created
- closeTime string? - ISO-8601 timestamp when the task ended, or
()if still pending
- title string - Display title shown in the task inbox
- description string - Supporting context for the reviewer
- userRoles [string, string...] - Roles permitted to complete this task
- taskInput map<json>? - Read-only context map rendered alongside the form
- createdAt string - ISO-8601 timestamp stored in memo at task start
- formSchema string? - JSON Schema for the completion form (populated by compiler plugin;
()until then)
- completedBy string? - User ID of the person who completed the task, or
()if not yet completed
- completedAt string? - ISO-8601 timestamp when the task was completed, or
()if pending
- result json? - The value submitted when completing the task, or
()if not yet completed
workflow.management: HumanTaskMeta
Describes one human task type for metadata publishing.
Fields
- name string - Qualified task name (
<workflowType>.<taskName>)
- resultSchema string? - JSON Schema of the task's completion form as a string, or
()when the result type is not yet known in this process (it is registered at module init when the compiler plugin can determine it statically, and lazily at first execution otherwise)
workflow.management: HumanTaskPage
Paginated list of human task summaries.
Fields
- items HumanTaskSummary[] - Human task summaries for this page
- nextPageToken string? - Opaque continuation token, or
()on the last page
- hasMore boolean - True when more pages follow
workflow.management: HumanTaskSummary
Summary of a human task instance for list views.
Fields
- taskId string - Child workflow ID of this task instance (a bare UUID; the kind travels in its memo)
- taskName string - Task type name (the
taskNamepassed toawaitHumanTask)
- title string(default "") - Display title given at task creation, falling back to the task name when none was set
- namespace? string - The Temporal namespace the task lives in (the project scope)
- taskQueue? string - The task queue of the integration serving this task; route mutations there
- parentWorkflowId string - Workflow ID of the parent that created this task
- parentWorkflowType string? - Registered workflow type of the parent, or
()if not available
- status string - Current status, mirroring the underlying task workflow:
PENDING(awaiting a human) |COMPLETED(a human submitted a result) |FAILED(rejected via the fail operation, or timed out before anyone acted) |CANCELED(retired internally because the parent workflow closed) |TERMINATED(an admin terminated the task workflow)
- startTime string - ISO-8601 timestamp when the task was created
- closeTime string? - ISO-8601 timestamp when the task ended, or
()if still pending
- completedBy string?(default ()) - User ID of whoever completed or rejected it, or
()while pending. Also()for tasks decided before the completer was recorded on the row
- completedAt string?(default ()) - When that decision was recorded, or
()when unknown
- userRoles string[] - Roles permitted to complete this task
- canComplete boolean(default false) - Whether the requesting caller has a role that permits completion
workflow.management: Identity
Identity of the caller an operation runs on behalf of. Drives role-based
visibility, task-completion authorization, and the audit fields recorded on
completions and decisions (completedBy, decidedBy, startedBy).
Fields
- userId string?(default ()) - The caller's user ID, or
()when unknown
- roles string[](default []) - The caller's roles; an empty array means the caller holds none
workflow.management: ResetPoint
An event a run can be reset to, and what resetting there re-runs.
Fields
- eventId int - Workflow-task event ID to reset to
- eventType string - The eligible workflow-task event:
WORKFLOW_TASK_COMPLETED,WORKFLOW_TASK_FAILED, orWORKFLOW_TASK_TIMED_OUT
- timestamp string - ISO-8601 time of the event
- nodeIds string[] - Activity-tree node IDs this task scheduled — all of them re-execute together. Empty when the task scheduled no visible work.
- nodeNames string[] - Display names for
nodeIds, in the same order
- isFirstFailure boolean - True for the point that re-runs the run's first failed step — the default "retry from where it broke"
workflow.management: ResetReapply
Which post-reset events are re-delivered to the new run.
Fields
- 'type "signal"|"none"|"all-eligible" (default "signal") -
"signal"re-delivers signals (the engine default),"none"re-delivers nothing, and"all-eligible"also re-delivers updates. Durable agent turns arrive as updates, so an agent reset with"signal"replays the agent without its conversation.
- exclude ("signal"|"update"|"nexus"|"cancel-request")[](default []) - Event categories to withhold even when
'typewould re-deliver them
workflow.management: ReviewActivityInfo
Detailed info about a review activity, including the proposal or failure context.
Fields
- namespace? string - The Temporal namespace the task lives in (the project scope)
- taskQueue? string - The task queue of the integration serving this task; route mutations there
- taskId string - Temporal workflow ID of this review activity
- taskName string - User-facing task name
- activityName string - Fully-qualified name of the reviewed activity
- parentWorkflowId string - Workflow ID of the parent that triggered this review
- trigger string - Why the review was created:
PRE_RUN(approval gate) |ON_FAILURE(rerun decision)
- title string - Display title for task inboxes; indicates whether this reviews a failed
activity (
ON_FAILURE) or gates a proposed activity call (PRE_RUN)
- description string - Supporting context for the reviewer, including the failure message for
ON_FAILUREreviews
- status string - Current status, mirroring the underlying task workflow:
PENDING(awaiting a decision) |COMPLETED(a human decided) |FAILED(the review timed out before a human decided) |CANCELED(retired internally because the parent workflow closed) |TERMINATED(an admin terminated the review workflow)
- startTime string - ISO-8601 timestamp when the review was created
- closeTime string? - ISO-8601 timestamp when the review ended, or
()if still pending
- userRoles [string, string...] - Roles permitted to complete this review activity
- errorMessage string - Error message from the failed activity invocation (empty for a pre-run gate)
- activityArgs map<json>? - Arguments proposed for (or passed to) the activity invocation; use these to
pre-fill the
formSchemaform
- formSchema string? - JSON Schema describing the
inputaccepted by theproceed-with-inputdecision — one property per data parameter of the reviewed activity — or()when no schema could be derived
- createdAt string - ISO-8601 timestamp stored in memo at review creation
- decidedBy string? - User ID of the person who submitted the decision, or
()if pending
- decidedAt string? - ISO-8601 timestamp when the decision was submitted, or
()if pending
workflow.management: ReviewActivityPage
Paginated list of review activity summaries.
Fields
- items ReviewActivitySummary[] - Review activity summaries for this page
- nextPageToken string? - Opaque continuation token, or
()on the last page
- hasMore boolean - True when more pages follow
workflow.management: ReviewActivitySummary
Summary of a review activity instance for list views.
Fields
- taskId string - Temporal workflow ID of this review activity (a bare UUID; the kind travels in its memo)
- taskName string - User-facing task name (qualified with workflow type)
- namespace? string - The Temporal namespace the task lives in (the project scope)
- taskQueue? string - The task queue of the integration serving this task; route mutations there
- activityName string - Fully-qualified name of the reviewed activity (
workflowType.activityName)
- parentWorkflowId string - Workflow ID of the parent that triggered this review
- trigger string - Why the review was created:
PRE_RUN(approval gate) |ON_FAILURE(rerun decision)
- title string - Display title for task inboxes; indicates whether this reviews a failed
activity (
ON_FAILURE) or gates a proposed activity call (PRE_RUN)
- status string - Current status, mirroring the underlying task workflow:
PENDING(awaiting a decision) |COMPLETED(a human decided) |FAILED(the review timed out before a human decided) |CANCELED(retired internally because the parent workflow closed) |TERMINATED(an admin terminated the review workflow)
- startTime string - ISO-8601 timestamp when the review was created
- closeTime string? - ISO-8601 timestamp when the review ended, or
()if still pending
- userRoles string[] - Roles permitted to review this activity; an empty array means any caller
workflow.management: ReviewDecision
Decision submitted by a human to resolve a review activity — a proposed activity call awaiting approval before it runs, or a failed activity awaiting a rerun decision.
Fields
- action "proceed"|"proceed-with-input"|"reject" -
"proceed"runs (or reruns) the activity with the original arguments;"proceed-with-input"runs it with theinputmap overriding arguments;"reject"skips the activity: the proposed call is not made, or the original failure is surfaced back to the workflow.
- input map<anydata>?(default ()) - New named arguments for the activity. Only relevant when
actionis"proceed-with-input". Keys must match the activity's parameter names.
- feedback string?(default ()) - Optional reviewer note. On
"reject"it is relayed to the caller so the workflow can act on it (e.g. surface it in the failure message).
workflow.management: ReviewDecisionInfo
Audit record returned by review activity decision operations.
Fields
- success boolean - Always true on the success path
- decision string - The decision taken:
"proceed","proceed-with-input", or"reject"
- decidedBy string - User ID extracted from the
x-user-idrequest header
- decidedAt string - ISO-8601 timestamp of when the decision was processed
workflow.management: WorkflowDefinition
Describes a registered workflow type for use by the workflow launcher UI.
Fields
- workflowType string - Registered workflow function name (Temporal workflow type)
- kind string(default "WORKFLOW") - What the definition starts: a
@workflow:Workflowfunction (WORKFLOW) or aworkflow:DurableAgentdeclaration (AGENT). Both start through the same endpoint and list as one set of definitions
- inputSchema string? - JSON Schema of the start input for form rendering: a workflow's
input parameters, or — for an agent — the uniform
{query, input}start envelope, whereinputcarries the declaredinputType's own schema and is absent when the agent declares no payload.()when the schema is unavailable
- isActive boolean - Whether this workflow type has an active registered worker
- workerCount int - Number of workers currently registered for this workflow type
workflow.management: WorkflowDefinitionMeta
Describes one registered workflow definition for metadata publishing.
Fields
- workflowType string - Registered workflow function (or durable agent) name
- kind string -
WORKFLOWfor a@workflow:Workflowfunction,AGENTfor a durable agent
- inputSchema string? - JSON Schema of the workflow's input type as a string, or
()when the workflow takes no data input
workflow.management: WorkflowExecutionInfo
Information about a workflow execution (for testing/introspection).
Fields
- workflowId string - The unique identifier for the workflow instance
- workflowType string - The type (process name) of the workflow
- status string - The execution status ("RUNNING", "SUSPENDED", "COMPLETED", "FAILED", "CANCELED", "TERMINATED"). "SUSPENDED" is a running workflow paused via the suspend management API.
- kind string?(default ()) - What this instance is — WORKFLOW, AGENT, HUMAN_TASK, REVIEW_ACTIVITY or CHILD_WORKFLOW — from the memo its starter stamped. A consumer routes to the right view by asking this, never by parsing the id; nil only for instances started before the stamp existed.
- result anydata? - The workflow result if completed successfully
- errorMessage string? - Error message if the workflow failed
- activityInvocations ActivityInvocation[] - List of activities invoked by this workflow
workflow.management: WorkflowHandle
Handle returned when a new workflow is started.
Fields
- workflowId string - Unique ID of the started workflow instance
- runId string - Temporal run ID
workflow.management: WorkflowInstancePage
Paginated list of workflow instances.
Fields
- items WorkflowInstanceSummary[] - Workflow summaries for this page
- nextPageToken string? - Opaque token to fetch the next page, or
()on the last page
- hasMore boolean - True when more pages follow
workflow.management: WorkflowInstanceSummary
Summary of a workflow instance for list views.
Fields
- namespace? string - The Temporal namespace the task lives in (the project scope)
- taskQueue? string - The task queue of the integration serving this task; route mutations there
- workflowId string - Unique workflow instance ID
- runId string - Temporal run ID for this execution
- workflowType string - Registered workflow type name
- status string - Execution status: RUNNING | SUSPENDED | COMPLETED | FAILED | CANCELED | TERMINATED | TIMED_OUT. SUSPENDED is a running workflow paused via the suspend management API.
- startTime string - ISO-8601 timestamp when the workflow started
- closeTime string? - ISO-8601 timestamp when it ended, or
()if still running
- kind string?(default ()) - What this instance is — WORKFLOW, AGENT, HUMAN_TASK, REVIEW_ACTIVITY, CHILD_WORKFLOW — from the memo its starter stamped (ids carry no classification)
- input json? - Workflow input as JSON, or
()if not available
workflow.management: WorkflowMetadata
The workflow metadata document: everything the program registered with the workflow runtime, complete at module init.
Fields
- metadataVersion string - Version of this document's shape (currently
"1.0")
- definitions WorkflowDefinitionMeta[] - Registered workflow definitions
- humanTasks HumanTaskMeta[] - Human task types with completion-form schemas
- activities ActivityMeta[] - Registered activities with input schemas
- reviewActions string[] - The static review-activity decision vocabulary
- agents AgentMeta[] - Declared durable agents
- descriptor json?(default ()) - The build-time Workflow Definition Descriptor (
workflow.def.json) packed into the running program by the compiler plugin: the canonical, versioned, checksummed description of the same structures with embedded JSON Schemas.()when the program was built without one (older plugin, or a run that never produced an executable JAR, such asbal test)
workflow.management: WorkItemPage
One page of the unified work queue.
Fields
- items WorkItemSummary[] - The page of work items
- nextPageToken string? - Cursor for the next page, or
()on the last one
- hasMore boolean - Whether more items exist past this page
workflow.management: WorkItemSummary
One item of a person's unified work queue: a human task, or a review activity — which is a human task with a fixed decision contract. The kinds stay distinct (each opens its own UX); what they share is the queue and its filters.
Fields
- kind string -
HUMAN_TASKorREVIEW_ACTIVITY
- taskId string - The instance id of the item (a bare UUID)
- taskName string - Qualified name (
workflowDefinition.taskOrActivityName)
- title string(default "") - Display title, falling back to the task name when none was set
- trigger string?(default ()) - Reviews only:
PRE_RUN(approval gate) |ON_FAILURE(rerun decision)
- namespace? string - The Temporal namespace the item lives in (the project scope)
- taskQueue? string - The task queue of the integration serving this item; route mutations there
- parentWorkflowId string - The workflow instance waiting on this item
- parentWorkflowType string? - The parent's registered workflow type, when known
- status string - The item's current state; a rejected review completes — its failure travels to the workflow, never into the review's own status
- startTime string - ISO-8601 timestamp when the item was created
- closeTime string? - ISO-8601 timestamp when it ended, or
()while pending
- userRoles string[] - Roles permitted to act on this item
- canComplete boolean(default false) - Whether the requesting caller may act on it
Errors
workflow.management: AccessDeniedError
The caller lacks the roles required to see or act on the target.
workflow.management: ConflictError
The target exists but is not in a state that allows the operation — for example completing a task that has already been completed.
workflow.management: Error
A management operation failed. Every error returned by an operation belongs to one of the distinct subtypes below, so consumers can branch on the reason without parsing messages.
workflow.management: ExecutionError
The operation could not be completed because of a failure inside the workflow runtime or its backing service.
workflow.management: InvalidPayloadError
The request is well formed, but the payload does not match the type the target declared (e.g. a human task completion value that is not assignable to the task's result type).
workflow.management: InvalidRequestError
The request is malformed: a required parameter is missing, or a value is not of the expected shape.
workflow.management: NotFoundError
The addressed workflow, human task, or review activity does not exist.
Union types
workflow.management: BulkRetryAction
BulkRetryAction
What to do with each review activity in a bulk decision.
"retry" reruns the activity with its original arguments (the single-task
proceed decision); "fail" surfaces the original failure to the workflow (the
single-task reject decision).
workflow.management: ResetTypeName
ResetTypeName
Which point of a run to reset to.
"first-workflow-task" replays the run from its first workflow task, so it runs
again from the beginning with the input it started with. "last-workflow-task"
resets to the most recent workflow task, which is how a run wedged on a failing
workflow task is moved onto fixed code. "workflow-task-id" targets one point
from listResetPoints, which is how a caller starts from a selected step.
Import
import ballerina/workflow.management;Metadata
Released date: 16 days ago
Version: 0.9.0
License: Apache-2.0
Compatibility
Platform: java21
Ballerina version: 2201.13.4
GraalVM compatible: No
Pull count
Total: 10910
Current verison: 865
Weekly downloads
Keywords
workflow
Contributors