Skip to main content

AI Cookbook

Step-by-step recipes for building reliable AI systems with Temporal, covering LLM integrations, agentic loops, tool calling, and production patterns.

Hello world

Call an LLM from a durable Temporal Workflow in Python using the OpenAI API library.

foundationsopenai

Structured outputs with Temporal and OpenAI

Use Temporal and the OpenAI Responses API to reliably request output conforming to a specific data structure.

foundationsopenai

Hello world with LiteLLM

Integrate LiteLLM into a durable Temporal Workflow in Python to call and switch between LLM providers.

foundationslitellm

Retry policy from HTTP responses

Extract retry information from HTTP response headers and pass it to Temporal's retry mechanisms in Python.

foundationsopenai

Basic agentic loop with Claude and tool calling

Build a durable agentic loop in Python with Claude tool calling and Temporal.

agentsclaude

Basic agentic loop with OpenAI and tool calling

Build a durable agentic loop in Python that calls a dynamic set of tools with Temporal and the OpenAI Responses API.

agentsopenai

Durable MCP weather server

Build a durable MCP server in Python that runs weather tools reliably with Temporal Workflows.

mcpworkflows

Tool calling agent

Build a simple, non-looping Python agent that lets the LLM choose tools and then invokes the chosen tools with Temporal and OpenAI.

agentsopenai

Durable agent with tools using the AI SDK by Vercel

Build a durable AI agent with the AI SDK by Vercel and Temporal that chooses tools to answer user questions.

agentsopenai

Human-in-the-loop AI agent

Add human-in-the-loop approval to a durable AI agent using Temporal Signals in Python.

agentsopenai

Durable agent with tools using the OpenAI Agents SDK

Build a durable AI agent with the OpenAI Agents SDK and Temporal that chooses tools to answer user questions.

agentsopenai

Durable agent with MCP and Activity-backed tools using the Strands Agents SDK

Build a durable AI agent in Python with Temporal and the Strands Agents SDK plugin, combining an MCP server tool with an Activity-backed tool that calls a live HTTP feed.

agentsbedrock

Post-LLM guardrail with hard-rule overrides

Build a durable content-moderation guardrail in Python with Temporal and Claude that layers deterministic hard rules over an LLM's verdict for auditable overrides.

agentsanthropic

Claim check pattern with Temporal

Use the Claim Check pattern with Temporal to keep large payloads out of Event History by offloading them to S3.

foundationss3claim-check

Deep research

Build a multi-agent deep research system in Python with Temporal and the OpenAI Responses API.

agentsopenai