Skip to main content

ZIO Temporal

Build invincible apps with ZIO and Temporal


Working with Temporal is natural as though it was developed for Scala


The library handles most typical programmer errors at compile time.

No more dumb runtime exceptions!


Use your favorite ZIO library with Temporal!

Running ZIO code inside your workflows has never been that easy!

Get started easily

Here is an example of how simple it is to run and interact with Temporal workflows.

import zio._
import zio.temporal._
import zio.temporal.workflow._
import zio.temporal.protobuf.syntax._

// Business process as an interface
trait PaymentWorkflow {

def proceed(transaction: ProceedTransactionCommand): TransactionView

def isFinished(): Boolean

def confirmTransaction(command: ConfirmTransactionCommand): Unit

// Client-side code
class TemporalPaymentService(workflowClient: ZWorkflowClient) {
def createPayment(sender: UUID, receiver: UUID, amount: BigDecimal) =
for {
transactionId <- ZIO.randomWith(_.nextUUID)
paymentWorkflow <- workflowClient
// Built-in timeouts
// Built-in retries
// Start the business process
_ <- ZWorkflowStub.start(
id = transactionId,
sender = sender,
receiver = receiver,
amount = amount
} yield transactionId

def confirmTransaction(transactionId: UUID, confirmationCode: String) =
for {
// Get the running business process
workflowStub <- workflowClient.newWorkflowStub[PaymentWorkflow](
workflowId = transactionId.toString
// Check the business process state
isFinished <- ZWorkflowStub.query(
_ <- ZIO.unless(isFinished) {
// Interact with a running workflow!
ConfirmTransactionCommand(id = transactionId, confirmationCode)
} yield ()