# Durable Execution

> Learn how durable execution survives failures and makes building long-running code simple.

## What is durable execution?

A **durable function** is application code that Inngest coordinates as a run which survives failures and can wait indefinitely. A run has its own input, steps, and trace. Inngest stores each completed step's result. When work resumes after a retry or wait, functions resume from the last completed step instead of from the start.

For example, an AI workflow can retrieve context, call an LLM, and validate the response in separate steps. If the LLM call fails or returns an invalid response, the next attempt reuses the retrieved context and continues from the failed step. You can see the failed step and its retry in the run trace.  This occurs over your entire agent run.

### Benefits:

- **Recover from failure.** Retry failed work without starting the whole run again.
- **Wait without holding compute.** Resume after a delay or external event without keeping a worker busy.
- **Control load for workflows.** Set concurrency and other flow controls to protect services your workflow calls.
- **See what happened.** Inspect steps, waits, retries, and failures in [Traces](/docs-markdown/platform-and-operations/traces).
- **Run anywhere.**  Inngest orchestrates code on any compute and works on your current infrastructure.

All functions can run code in [Sandboxes](/docs-markdown/sandboxes), measure outcomes with [Agent Evals](/docs-markdown/agent-evals), and publish progress through [Realtime](/docs-markdown/realtime). For framework setup and method signatures, use [SDKs & APIs](/docs-markdown/sdks).

## Types of durable functions

You can deploy multiple types of durable functions using Inngest:

### Durable workflows

Durable workflows are typically background functions invoked from an event, schedule, webhook, or another function. Your app triggers a workflow that runs asynchronously, then moves on to other processing.  Use this path for jobs that take time, wait for another action, or coordinate several services.

- Read [Durable Workflows](/docs-markdown/durable-execution/durable-workflows) to see how triggers, runs, and checkpoints fit together.
- Read our [Quick start](/docs-markdown/durable-execution/quick-start) to build a workflow.
- Learn how [Events and triggers](/docs-markdown/durable-execution/guides-and-advanced/events-and-triggers) start work.
- Read [Flow control](/docs-markdown/durable-execution/flow-control) to orchestrate and manage your functions.

### Durable endpoints

Durable endpoints are API endpoints that survive intermittent errors.  They are regular HTTP endpoints, and they return results as HTTP responses, even after temporary errors and retries.  This brings the power of durable execution to every API endpoint you write, without updating any client code.

- Read [Durable Endpoints](/docs-markdown/durable-execution/durable-endpoints) for the request and response flow

### Durable agents

Durable agents are workflows whose next step is chosen by a model. Each model call and tool call runs as a step, so an agent keeps its progress through failures, waits for people without holding a worker, and delegates work to sub-agents.

- Read [Durable Agents](/docs-markdown/durable-execution/durable-agents) to see how agent loops, waits, and sub-agents work.
- Build an [agent tool loop](/docs-markdown/durable-execution/durable-agents/agent-tool-loops).

## Next up

Read below to learn more and get started:

- [Concepts](/docs-markdown/durable-execution/concepts) defines runs, triggers, steps, waits, and retries for both entry points.
- [Primitives](/docs-markdown/durable-execution/primitives) introduces the operations you can put inside a run, and which ones work in [durable endpoints](/docs-markdown/durable-execution/primitives#workflow-and-endpoint-support).
- [Flow control](/docs-markdown/durable-execution/flow-control), [Events and triggers](/docs-markdown/durable-execution/guides-and-advanced/events-and-triggers), [Error handling](/docs-markdown/durable-execution/guides-and-advanced/error-handling), and [Cancellation](/docs-markdown/durable-execution/guides-and-advanced/cancellation) cover how runs start, recover, and stop.
- [Advanced](/docs-markdown/durable-execution/guides-and-advanced) covers idempotency, versioning, testing, patterns, middleware, logging, and checkpointing.
- [Deploying functions](/docs-markdown/durable-execution/deploying-functions) explains HTTP Serve and Connect for functions on your infrastructure. Inngest compute is planned as an app-level hosting option.
- [Limits](/docs-markdown/durable-execution/limits), [Best practices](/docs-markdown/durable-execution/best-practices), and [Troubleshooting](/docs-markdown/durable-execution/troubleshooting) help you ship and operate durable workflows. Check the Durable Endpoints page for its beta limits.

***