Durable AI
Temporal gives AI applications and agents Durable Execution: a Workflow resumes automatically after a crash, a network timeout, or a multi-day wait for a human to approve a step. Use it to keep long-running agent loops, LLM tool calls, and multi-step AI pipelines running reliably, without hand-rolling retry logic, checkpointing, or state machines.
Looking to use an AI coding assistant to write Temporal code instead? See Develop with AI.
AI Cookbook
Runnable, step-by-step recipes for building AI systems and agents with Temporal: tool calling, MCP, structured output, human-in-the-loop, and more.
Hello world
Call an LLM from a durable Temporal Workflow in Python using the OpenAI API library.
Structured outputs with Temporal and OpenAI
Use Temporal and the OpenAI Responses API to reliably request output conforming to a specific data structure.
Hello world with LiteLLM
Integrate LiteLLM into a durable Temporal Workflow in Python to call and switch between LLM providers.
Retry policy from HTTP responses
Extract retry information from HTTP response headers and pass it to Temporal's retry mechanisms in Python.
Browse the full AI Cookbook for +11 more recipes
Agent framework integrations
Temporal integrations for the SDKs and frameworks teams use to build agents. This view is pre-filtered to agent frameworks — browse every integration for the full catalog.
AI SDK by Vercel
Build AI-powered applications with Durable Execution using the Vercel AI SDK.
Deep Agents
Make LangChain Deep Agents durable with Temporal Workflows and Activities.
Google ADK
Orchestrate Google ADK agents with durable Temporal Workflows.
Google ADK
Run Google ADK agents with durable execution using the Temporal Go SDK.
Google GenAI
Call Google Gemini models durably from Temporal Workflows with the Google Gen AI SDK.
LangGraph
Run LangGraph agent graphs as durable, resumable Temporal Workflows.
Mastra
Build durable AI agents and workflows with the Mastra TypeScript framework.
OpenAI Agents SDK
Run OpenAI Agents with Durable Execution using Temporal.
OpenAI Agents SDK
Run OpenAI Agents with Durable Execution using Temporal.
Pydantic AI
Build type-safe AI agents with Durable Execution through Pydantic AI.
Spring AI
Build AI-powered Java applications with durable Spring AI tool calls.
Strands Agents
Orchestrate AWS Strands Agents with durable Temporal Workflows.
Strands Agents
Orchestrate AWS Strands Agents with durable Temporal Workflows.
Featured from the Code Exchange
A hand-picked look at what the community is building with Temporal and AI. Browse the full Code Exchange for more.
AI enhanced e-commerce application
A sample e-commerce gift shop with hybrid full-text and vector search plus an AI-powered chat shopping assistant, built with Stripe and Temporal Workflows.
Temporal AI Question Planetarium
Runs a Hugging Face model inside Temporal Activities and Workers, streaming updates to the browser over WebSockets in real time.
Document Processing w/ AI
A mortgage underwriting demo that uses Gemini OCR and policy-grounded AI analysis in deterministic Workflows, with human-in-the-loop review and full traceability.
Rust Confessional: a durable AI agent demo
A live demo where an AI agent judges audience programming confessions, its progress surviving a Worker crash mid-task.
Use cases
Temporal shows up in four recurring shapes of AI system:
Agents. Long-running, stateful agent loops that call LLMs and tools, wait on humans, and pick up exactly where they left off after a failure. Start with the AI Cookbook and the Approval and Entity Workflow patterns.
Processing pipelines. Multi-step data and document pipelines, such as extraction, embedding, or batch inference, that need to fan out, retry failed steps in isolation, and resume without reprocessing completed work. See the batch processing patterns.
Internal agent platforms. Teams building a shared runtime for many agents reuse Temporal's Worker and Task Queue primitives instead of building their own scheduler. See the worker configuration patterns for routing and isolating agent workloads.
Model training. Long-running training and fine-tuning jobs coordinated across GPU resources, with checkpointing and recovery handled by Temporal's Event History instead of custom orchestration code.
Design patterns for AI agents
Approval
Human-in-the-loop Workflows that block until external approval decisions are made. Uses Signals to capture approval data with metadata.
Saga Pattern
Manages distributed transactions with compensating actions. Each step has a compensation that undoes its effects if subsequent steps fail.
Long-Running Activity
Long-running Activities report progress via heartbeats and enable resumption after failures with cancellation support.
Entity Workflow
Models long-lived business entities as individual Workflows that persist for the entity's entire lifetime, handling all state transitions through Signals and Updates.
Local Activities
Run Activity functions in-process inside the Workflow Task, eliminating all server scheduling round-trips. Best for short, idempotent Activities on a latency-sensitive path.
Browse the full Design Patterns catalog for more, or jump straight into the AI Cookbook for runnable code.