Skip to content

amri369/mcp-temporal-agents

Repository files navigation

Summary

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

System Architecture

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

What we mean by “durable agents”
Agents whose steps are persisted and replayable, with built-in retries, timeouts, and idempotency—so they survive crashes, restarts, and long-running work.

1. Set up your Python environment

uv sync
source .venv/bin/activate

2. Run the MCP FastAPI Server on a custom port

In this example, we package the prompts of the financial analyst example in an MCP server.

uv run uvicorn examples.mcp_server.main:app --reload --port 9000

To inspect and interact with the server, run:

mcp dev examples/mcp_server/financial_research_server.py

This command shows the available tools, schemas, and prompt interfaces exposed by the MCP server.

MCP Inspector

# 3. Start a Temporal server Execute the following commands to start a pre-built image along with all the dependencies.
brew install temporal
temporal server start-dev

4. Start a Temporal worker

Execute the following command to start a worker to run the examples. Ensure that all your environment variables reside at file .env.

export PYTHONPATH=.
uv run --env-file .env examples/financial_research_agent/temporal/worker.py

5. Start the financial analyst agent

export PYTHONPATH=.
uv run --env-file .env examples/financial_research_agent/main.py

Temporal UI Showing Agents Orchestration

# 6. Credit

This example is inspired by these two great examples:

Readers are invited to visit this Medium article for more details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •