Build stateful, long-running, reliable workflows using the Dapr Workflow Go SDK with Catalyst. The Dapr Workflow Go SDK provides a powerful way to orchestrate complex business processes using Go.

Prefer to start from a diagram? Use [Workflow Composer](https://docs.diagrid.io/develop/workflows/workflow-composer) to generate a runnable Go Dapr Workflow project from a BPMN flowchart, then iterate with this SDK. For local monitoring of running workflows, use the [Dapr Dev Dashboard](https://docs.diagrid.io/develop/local-development/dev-dashboard).

## Resources

- [Dapr Go SDK GitHub](https://github.com/dapr/go-sdk)
- [Dapr Go SDK GoDoc](https://pkg.go.dev/github.com/dapr/go-sdk)
- [Dapr Workflow Documentation](https://docs.dapr.io/developing-applications/building-blocks/workflow/)

**Prerequisites:**

- Go 1.19+ ([Download](https://go.dev/doc/install))
- [Dapr Go SDK](https://github.com/dapr/go-sdk)

## Installation

Install the Dapr Workflow SDK via go get:

```bash
go get github.com/dapr/go-sdk/client
go get github.com/dapr/go-sdk/workflow
```

## Core Application

Use the essential components of a Dapr Workflow application (Workflows and Activities) to build and run a workflow application.

- [Develop a Workflow Definition](https://docs.dapr.io/developing-applications/building-blocks/workflow/howto-author-workflow#tabs-03-01-tab) — Learn how to define workflows as functions that take a WorkflowContext
- [Develop an Activity Definition](https://docs.dapr.io/developing-applications/building-blocks/workflow/howto-author-workflow#tabs-02-01-tab) — Create activities that perform the actual work orchestrated by workflows

## Dapr Client

Connect to the Dapr Workflow API and start, get status, and manage workflow executions.

- [Workflow Client Usage](https://docs.dapr.io/developing-applications/sdks/go/go-client/#workflow) — Learn how to create and configure the workflow client, including workflow and activity registration
- [Start a Workflow](https://docs.dapr.io/developing-applications/building-blocks/workflow/howto-manage-workflow#start-a-workflow-instance) — Schedule new workflow instances via the Go SDK
- [Get Workflow Results](https://docs.dapr.io/developing-applications/building-blocks/workflow/howto-manage-workflow#get-workflow-instance-status) — Retrieve workflow instance data such as the current status, input, custom status, and output

## Failure Detection

Explore how your application can detect failures using timeouts.

- [Workflow Timeouts](https://docs.dapr.io/developing-applications/building-blocks/workflow/workflow-features-concepts/#workflow-timeouts) — Each workflow timeout controls the maximum duration of a different aspect of a workflow execution
- [Activity Timeouts](https://docs.dapr.io/developing-applications/building-blocks/workflow/workflow-features-concepts/#activity-timeouts) — Each activity timeout controls the maximum duration of a different aspect of an activity execution

## External Events

Wait for external input and send events to running workflows.

- [Wait for External Event](https://docs.dapr.io/developing-applications/building-blocks/workflow/workflow-patterns#tabs-10-01-tab) — Wait for external input, such as human approvals or system responses
- [Raise Workflow Event](https://docs.dapr.io/developing-applications/building-blocks/workflow/howto-manage-workflow#raise-an-event-to-a-running-workflow-instance) — Send an event to a running workflow instance from a client or another workflow

## Control Workflow Progression

Interrupt a workflow execution with pause, resume, or terminate actions.

- [Pause a Workflow](https://docs.dapr.io/developing-applications/building-blocks/workflow/howto-manage-workflow#suspend-a-running-workflow-instance) — Pause a running workflow instance
- [Resume a Workflow](https://docs.dapr.io/developing-applications/building-blocks/workflow/howto-manage-workflow#resume-a-suspended-workflow-instance) — Resume a paused workflow instance
- [Terminate a Workflow](https://docs.dapr.io/developing-applications/building-blocks/workflow/howto-manage-workflow#terminate-a-workflow-instance) — Terminate a workflow execution and its activities

## Advanced Features

- [Durable Timers](https://docs.dapr.io/developing-applications/building-blocks/workflow/workflow-patterns/#tabs-06-01-tab) — Use timers to make a workflow execution pause or sleep for a fixed time period
- [Continue-As-New](https://docs.dapr.io/developing-applications/building-blocks/workflow/workflow-patterns/#tabs-06-01-tab) — Continue the workflow execution with a new workflow execution using the same workflow ID

## Observability

Configure and use observability features to monitor and debug workflows.

- [Workflow Visibility](https://docs.diagrid.io/operate/project-operations/observability) — Use the Catalyst workflow dashboard to view workflow executions, states, and success rates

## Getting Started

- [Workflow Quickstart](https://docs.diagrid.io/getting-started/quickstarts/workflow) — Get started with workflows in Catalyst
- [Workflow Patterns](https://docs.dapr.io/developing-applications/building-blocks/workflow/workflow-patterns/) — Learn about common workflow patterns
- [Dapr Workflow Documentation](https://docs.dapr.io/developing-applications/building-blocks/workflow/) — Comprehensive Dapr workflow guide
