LittleHorse API Reference
The LittleHorse Server exposes a GRPC API to its clients. For most general usage of LittleHorse, you will not need to
read the raw protobuf schema. Common LittleHorse client actions fall into three general categories:
- Developing a Task Worker, which is handled by our Task Worker SDK's.
- Developing a WfSpec, which is handled by our
WfSpec
SDK's.
- Running and interacting with
WfRun
's, which is documented in our "Using the API" docs.
However, the highly curious reader might want to see the actual GRPC and Protobuf specification. The docs on this page
are autogenerated from our actual protobuf files.
The documentation of what the specific protobuf fields mean is potentially useful for advanced Jedi Master use-cases.
Happy Reading!
LittleHorse GRPC API
The LittleHorse GRPC API is the backbone of the clients that you get in all of our SDK's. Every LHConfig
object
gives you a GRPC stub to access the API. Most common operations are already documented with code examples in different
languages here, but we put this here for the true Jedi Masters.
RPC PutTaskDef
RPC GetTaskDef
RPC GetTaskWorkerGroup
Request Type | Response Type | Description |
---|
TaskDefId | TaskWorkerGroup | Gets the registered task worker group associated with a specific TaskDef. |
RPC PutExternalEventDef
RPC GetExternalEventDef
RPC PutWorkflowEventDef
RPC PutWfSpec
RPC GetWfSpec
RPC GetLatestWfSpec
Request Type | Response Type | Description |
---|
GetLatestWfSpecRequest | WfSpec | Returns the latest WfSpec with a specified name (and optionally a specified Major Version). |
RPC MigrateWfSpec
Request Type | Response Type | Description |
---|
MigrateWfSpecRequest | WfSpec | EXPERIMENTAL: Migrates all WfRun's from one version of a WfSpec onto a newer version of the same WfSpec. This is useful for long-running WfRun's (eg. a 60-day marketing campaign) where you must update WfRun's that are in the RUNNING state rather than allowing them to run to completion.
As of 0.7.2, this feature is only partially implemented. |
RPC PutUserTaskDef
RPC GetUserTaskDef
Request Type | Response Type | Description |
---|
UserTaskDefId | UserTaskDef | Gets a specific UserTaskDef.
This RPC is highly useful for applications built around User Tasks. For example, a UI that dynamically displays form fields based on the User Task might first receive a UserTaskRun, then use that UserTaskRun to look up the UserTaskDef. The frontend would inspect the UserTaskDef and display a form field on the browser page for each field in the UserTaskDef. |
RPC GetLatestUserTaskDef
RPC RunWf
Request Type | Response Type | Description |
---|
RunWfRequest | WfRun | Runs a WfSpec to create a WfRun. |
RPC ScheduleWf
RPC SearchScheduledWfRun
RPC GetScheduledWfRun
RPC GetWfRun
Request Type | Response Type | Description |
---|
WfRunId | WfRun | Gets a WfRun. Although useful for development and debugging, this RPC is not often used by applications. |
RPC GetUserTaskRun
Request Type | Response Type | Description |
---|
UserTaskRunId | UserTaskRun | Loads a specific UserTaskRun. It includes information about to whom the UserTask is currently assigned, history of assignments and reassignments, and any context for that UserTaskRun which is specific to the WfRun. |
RPC AssignUserTaskRun
Request Type | Response Type | Description |
---|
AssignUserTaskRunRequest | .google.protobuf.Empty | Change the ownership of a UserTaskRun to a new userId, userGroup, or both. The action will be reflected in your next call to SearchUserTaskRun. This RPC is useful for applications that are using User Tasks to build an internal task-list and wish to administer the tasks. |
RPC CompleteUserTaskRun
Request Type | Response Type | Description |
---|
CompleteUserTaskRunRequest | .google.protobuf.Empty | Completes a UserTaskRun. Includes the results of the UserTaskRun, the UserTaskRun Id, and the userId of the user who completes the UserTaskRun. Results in the UserTask NodeRun being completed, and unblocks the associated ThreadRun in the WfRun.
This RPC is highly useful for applications built around a WfSpec that uses USER_TASK nodes. |
RPC CancelUserTaskRun
Request Type | Response Type | Description |
---|
CancelUserTaskRunRequest | .google.protobuf.Empty | Cancels a UserTaskRun. This will result in an EXCEPTION being propagated to the WfRun. |
RPC SaveUserTaskRunProgress
Request Type | Response Type | Description |
---|
SaveUserTaskRunProgressRequest | UserTaskRun | Saves the results of a UserTaskRun and logs who saved the content.
Throws FAILED_PRECONDITION if the UserTaskRun is in the DONE or CANCELLED state. If policy is set to FAIL_IF_CLAIMED_BY_OTHER , returns FAILED_PRECONDITION if the user_id field of the UserTaskRun does not match the user_id of the request. |
RPC ListUserTaskRuns
RPC GetNodeRun
RPC ListNodeRuns
RPC GetTaskRun
RPC ListTaskRuns
RPC GetVariable
Request Type | Response Type | Description |
---|
VariableId | Variable | Get the value of a specific Variable. When using a WfRun to model an entity, this RPC is useful for retrieving information. It is equivalent to looking up the value of a column for a specific row in a SQL table. |
RPC ListVariables
RPC PutExternalEvent
RPC GetExternalEvent
RPC AwaitWorkflowEvent
Request Type | Response Type | Description |
---|
AwaitWorkflowEventRequest | WorkflowEvent | Waits for a WorkflowEvent to be thrown by a given WfRun. Returns immediately if a matching WorkflowEvent has already been thrown; throws a DEADLINE_EXCEEDED error if the WorkflowEvent is not thrown before the deadline specified by the client.
To specify the deadline, the client should use GRPC deadlines. |
RPC GetWorkflowEventDef
RPC GetWorkflowEvent
RPC ListExternalEvents
RPC ListWorkflowEvents
RPC SearchWfRun
Request Type | Response Type | Description |
---|
SearchWfRunRequest | WfRunIdList | Search for WfRun's. This RPC is highly useful for applications that store data in LittleHorse and need to find a specific WfRun based on certain indexed fields. |
RPC SearchNodeRun
Request Type | Response Type | Description |
---|
SearchNodeRunRequest | NodeRunIdList | Search for NodeRun's. This RPC is useful for monitoring and finding bugs in your workflows or Task Workers. |
RPC SearchTaskRun
RPC SearchUserTaskRun
Request Type | Response Type | Description |
---|
SearchUserTaskRunRequest | UserTaskRunIdList | Search for UserTaskRun's. This RPC is highly useful for applications that connect human end-users to LittleHorse: it enables you to find all tasks assigned to a specific person or group of people. |
RPC SearchVariable
Request Type | Response Type | Description |
---|
SearchVariableRequest | VariableIdList | Search for Variable's. This RPC is highly useful for applications that store data in LittleHorse and need to find a specific WfRun based on certain indexed fields. |
RPC SearchExternalEvent
RPC SearchWorkflowEvent
RPC SearchTaskDef
RPC SearchUserTaskDef
RPC SearchWfSpec
RPC SearchExternalEventDef
RPC SearchWorkflowEventDef
RPC SearchTenant
RPC SearchPrincipal
RPC RegisterTaskWorker
Request Type | Response Type | Description |
---|
RegisterTaskWorkerRequest | RegisterTaskWorkerResponse | Used by the Task Worker to: 1. Tell the LH Server that the Task Worker has joined the Task Worker Group. 2. Receive the assignemnt of LH Server's to poll from. Generally, you won't use this request manually. |
RPC PollTask
Request Type | Response Type | Description |
---|
PollTaskRequest | PollTaskResponse | Used by Task Workers to listen for TaskRuns on the Task Queue. Generally, you won't use this RPC manually. |
RPC ReportTask
Request Type | Response Type | Description |
---|
ReportTaskRun | .google.protobuf.Empty | Used by Task Workers to report the result of a TaskRun. Generally, you won't use this rpc manually. |
RPC StopWfRun
Request Type | Response Type | Description |
---|
StopWfRunRequest | .google.protobuf.Empty | Move a WfRun or a specific ThreadRun in that WfRun to the HALTED state. |
RPC ResumeWfRun
Request Type | Response Type | Description |
---|
ResumeWfRunRequest | .google.protobuf.Empty | Resumes a WfRun or a specific ThreadRun of a WfRun. |
RPC RescueThreadRun
Request Type | Response Type | Description |
---|
RescueThreadRunRequest | WfRun | Rescues a failed ThreadRun (in the ERROR state only) by restarting it from the point of failure. Useful if a bug in Task Worker implementation caused a WfRun to fail and you did not have a FailureHandler for that NodeRun.
The specified ThreadRun must be in a state where it's latest NodeRun is: - In the ERROR state. - Has no FailureHandler ThreadRun s - The parent ThreadRun , or any parent of the parent, has not handled the Failure yet.
If that is not true, then the ThreadRun cannot be rescued and the request will return FAILED_PRECONDITION . |
RPC DeleteWfRun
Request Type | Response Type | Description |
---|
DeleteWfRunRequest | .google.protobuf.Empty | Deletes a WfRun. The WfRun cannot be in the RUNNING state. |
RPC DeleteTaskDef
RPC DeleteWfSpec
RPC DeleteUserTaskDef
RPC DeleteExternalEventDef
RPC DeleteWorkflowEventDef
RPC DeletePrincipal
Request Type | Response Type | Description |
---|
DeletePrincipalRequest | .google.protobuf.Empty | Deletes a Principal . Fails with FAILED_PRECONDITION if the specified Principal is the last remaining Principal with admin permissions. Admin permissions are defined as having the global_acls of ALL_ACTIONS over the ACL_ALL_RESOURCES scope. |
RPC DeleteScheduledWfRun
Request Type | Response Type | Description |
---|
DeleteScheduledWfRunRequest | .google.protobuf.Empty | Deletes a scheduled run and prevents any further associated WfRun from being executed. |
RPC GetTaskDefMetricsWindow
RPC GetWfSpecMetricsWindow
RPC ListTaskDefMetrics
RPC ListWfSpecMetrics