Temporal capabilities

Temporal delivers new development primitives that help simplify your code and allow you to build more features, faster. And at runtime, it's fault-tolerant and easily scalable so your apps can grow bigger, more reliably.

Autosave for Application State

Stop building state machines

Temporal captures the complete state of your functions (variables, threads, blocking calls) so you get the benefits of a state machine, without maintaining complex state machine code.

async function transfer(
  fromAccount: string,
  toAccount: string,
  amount: number,
) {
  // These are activities, not regular functions.
  // Activities may run elsewhere, and their return value
  // is automatically persisted by Temporal.
  await myActivities.withdraw(fromAccount, amount);
  try {
    await myActivities.deposit(toAccount, amount);
  } catch {
    await myActivities.deposit(fromAccount, amount);
  }
}

Native Retries

Set retry policies, don't code them

Temporal allows you to define exponential retry policies for Activities, so you don’t have to write retry logic into your application code. And your retry duration can be as long as needed, even months.

@activity.defn
async def compose_greeting(input: ComposeGreetingInput) -> str:
    print(f"Invoking activity, attempt number {activity.info().attempt}")
    # Fail the first 3 attempts, succeed the 4th
    if activity.info().attempt < 4:
        raise RuntimeError("Intentional failure" )
    return f"{input.greeting}, {input.name}!"


@workflow.defn
class GreetingWorkflow:
    @workflow.run
    async def run(self, name: str) -> str:
        # By default activities will retry, backing off an initial interval and
        # then using a coefficient of 2 to increase the backoff each time after
        # for an unlimited amount of time and an unlimited number of attempts.
        # We'll keep those defaults except we'll set the maximum interval to
        # just 2 seconds.
        return await workflow.execute_activity(
            compose_greeting,
            ComposeGreetingInput("Hello", name),
            start_to_close_timeout =timedelta(seconds=10),
            retry_policy=RetryPolicy(maximum_interval=timedelta(seconds=2)),
        )

Timeouts/Timers

Wait for 3 seconds or 3 months

Set timers to wait for days, weeks, or months, knowing that an outage or server restart during the wait period won’t prevent your workflow from executing.

import { proxyActivities, sleep } from "@temporalio/workflow";
import type { Activities } from "./activities";
const { hasUpgraded, sendReminderEmail } = proxyActivities<Activities>({
  startToCloseTimeout: "10 seconds",
});

async function startTrial(user: string) {
  while (!(await hasUpgraded(user))) {
    await sendReminderEmail(user);
    await sleep("30 days");
  }
}

Schedules

Schedule, don't Cron

Temporal delivers an ability to schedule a workflow (much like a cron job) and then pause, re-start, and stop them as needed.

await new Client().schedule.create({
  action: {
    type: "startWorkflow",
    workflowType: reminderWorkflow,
    args: [
      "♻️ Dear future self, please take out the recycling tonight. Sincerely, past you ❤️",
    ],
    taskQueue: "schedules",
  },
  scheduleId: "sample-schedule",
  spec: {
    calendars: [
      {
        comment: "every wednesday at 8:30pm",
        dayOfWeek: "WEDNESDAY",
        hour: 20,
        minute: 30,
      },
    ],
  },
});

Idiomatic Language Support

Code like a champion, in your language

Temporal allows you to simply code for durable execution, using one or more of our SDKs in Go, Java, Typescript, Python and .NET (and even deploy polyglot workflows).

const activities = proxyActivities<Activities>({
  scheduleToCloseTimeout: "30 seconds",
});

interface GreetingParam {
  name: string;
}

export async function greet(param: GreetingParam): Promise<string> {
  return await activities.greet(param);
}

Human in the Loop

Incorporate human interactions

Use external sources -- including human actions -- that interact seamlessly with Workflows.

func Accept(ctx workflow.Context, input *AcceptWorkflowInput) (*AcceptWorkflowResult, error) {
	err := emailCandidate(ctx, input)
	if err != nil {
		return nil, err
	}
	submission, err := waitForSubmission(ctx)
	if err != nil {
		return nil, err
	}
	return &AcceptWorkflowResult{Submission: submission},
		nil
}

Execution Visibility

Never guess what's going on

Temporal allows you to inspect, replay, and rewind every Workflow execution, step by step. 

Timeline

Local Development Model

Develop locally, deploy globally

Write code in your preferred language locally, then deploy your workflows and activities using the same software delivery mechanisms you have today.

Documentation

brew install temporal && temporal server start-dev

More ways to set up your local environment.

graphic
Recent Workflows

Don't fight dev patterns, ship code.

Event-Driven Architectures

Event-driven architectures and queue-driven design promise ease of deployment and scale, but are a development nightmare.

Without Temporal
Event-driven applications are loosely coupled at runtime, but highly coupled at build time. This creates great complexity for error handling and propagation of state across disparate services.

With Temporal
Application state, retries, and error handling are abstracted away so that you no longer have to code for them. System testing is a breeze because Temporal eliminates common failure scenarios.

EDA Diagram

SAGA & Distributed Transactions

The saga pattern ensures safe and consistent state across distributed services so that the failure of one operation within a sequence results in prior operations being reversed using compensating transactions.

Read now: Automating the Saga Pattern with Temporal ›

Without Temporal
Saga typically requires significant forethought as there is no central system to manage coordination and visibility. Debugging unexpected failure modes can be treacherous.

With Temporal
Workflow definitions allow you to more easily understand, debug, and modify sagas. Tighter coupling for  compensations increases and your application code remains clean.

Saga Diagram

Batch Processing

Batch Processes are created to execute a well-defined function across large or even small sets of data.

Without Temporal
Often, batch processes can be quite large and when they fail, you have limited or no insight into where they failed, what completed and what hasn't.

With Temporal
Each execution within the batch process becomes a Workflow Execution with state captured, so that upon failure, you have insight into what completed and where to restart the process.

Batch Processing Diagram

Scheduled Jobs & Cron

For years, we have relied on Cron to schedule jobs to be executed at a certain time or regular interval.

Without Temporal
Cron is a largely manual process that can be unreliable and provides limited to no controls over execution.

With Temporal
You can replace Cron with Scheduled Workflows to be reliably executed.  You can start and pause them and even set up signals to start them on command for a Workflow.

Schedules Diagram

State Machines

State machines are often used to define and manage valid state and transitions for entities within your application and depending on your application, they can be quite complex.

Read now: State Machines Simplified ›

Without Temporal
State machine code grows in complexity and length with the addition of each new state and maintenance and testing of them can be a challenge.

With Temporal
Complete state of your function and workflow is captured, so you no longer need to automate, track and validate state so you can eliminate or avoid state machines.

State Machine Diagram
Globe with pixelated continents and orbitting dashed lines

Temporal Cloud

Reliable, scalable, serverless Temporal in 11+ regions

Run the Temporal Service today, without hassle, and with peace of mind. Pay for only what you use with our managed service, built, managed, and supported by the creators of the Temporal project.

Temporal Cloud

Reliable, scalable, serverless Temporal in 11+ regions

Run the Temporal Service today, without hassle, and with peace of mind. Pay for only what you use with our managed service, built, managed, and supported by the creators of the Temporal project.

Globe with pixelated continents and orbitting dashed lines

Temporal Cloud

Reliable, scalable, serverless Temporal in 11+ regions

Run the Temporal Service today, without hassle, and with peace of mind. Pay for only what you use with our managed service, built, managed, and supported by the creators of the Temporal project.

Globe with pixelated continents and orbitting dashed lines

Build invincible apps

Give your apps and services durable execution.