---
title: "MCP + Temporal Durable Agents"
description: "Durable AI agents that combine OpenAI Agents (runtime/coordination), Temporal (durable workflows), MCP, and Pydantic Logfire for tracing. Includes a financial-research agent, persisted steps, retries/timeouts, and Temporal workflow orchestration."
canonical: "https://temporal.io/code-exchange/mcp-temporal-durable-agents.md"
source: "https://temporal.io/code-exchange/mcp-temporal-durable-agents"
published: "2025-08-30"
authors:
  - "Dr. Mohamed Amri"
languages:
  - "Python"
tags:
  - "pydantic"
  - "openai"
  - "mcp"
reviewed_by_temporal: false
community_contribution: true
---

# MCP + Temporal Durable Agents

Durable AI agents that combine OpenAI Agents (runtime/coordination), Temporal (durable workflows), MCP, and Pydantic Logfire for tracing. Includes a financial-research agent, persisted steps, retries/timeouts, and Temporal workflow orchestration.

- [View repo](https://github.com/amri369/mcp-temporal-agents)
- [Read tutorial](https://medium.com/@amri369/build-production-grade-agents-using-mcp-temporal-and-openai-agents-sdk-c49c928bc4ec)

This project shows how to build **durable AI agents** using four production-grade components:

- [OpenAI Agents SDK](https://github.com/openai/openai-agents-python) — agent runtime and coordination
- [Temporal Python SDK](https://github.com/temporalio/sdk-python) — durable workflows, retries, and long-running tasks
- [Model Context Protocol (MCP)](https://github.com/modelcontextprotocol/python-sdk) — standard interface for tools and data sources
- **(Optional)** [Pydantic Logfire](https://pydantic.dev/logfire) — unified observability (logs, traces, metrics) with native LLM & agent instrumentation

![MCP + Temporal Durable Agents architecture](https://images.ctfassets.net/0uuz8ydxyd9p/1e0rE9cAD60D2G8ioDpsDp/d446c7bfd373d872f41329f315104563/Temporal-Openai-Integration.png)

If you’re tired of debugging Celery tasks, running into scalability limits, or wrestling with LangGraph dependency issues, this project is for you.

The included example (“financial research agent”) runs a planner → parallel web search → writer → verifier flow. Agent steps are executed inside Temporal Activities and orchestrated by a Temporal Workflow, so each step is persisted, replayable, and automatically retried on failure. Temporal UI lets you visualize the orchestration end-to-end.
