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.
Hello world with LiteLLM
Integrate LiteLLM into a durable Temporal Workflow in Python to call and switch between LLM providers.
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.
Structured outputs with Temporal and OpenAI
Use Temporal and the OpenAI Responses API to reliably request output conforming to a specific data structure.
Retry policy from HTTP responses
Extract retry information from HTTP response headers and pass it to Temporal's retry mechanisms in Python.
Basic agentic loop with Claude and tool calling
Build a durable agentic loop in Python with Claude tool calling and Temporal.
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.
Durable MCP weather server
Build a durable MCP server in Python that runs weather tools reliably with Temporal Workflows.
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.
Human-in-the-loop AI agent
Add human-in-the-loop approval to a durable AI agent using Temporal Signals in Python.
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.
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.
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.
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.
Deep research
Build a multi-agent deep research system in Python with Temporal and the OpenAI Responses API.