This repository contains a deep research agent that uses multiple AI agents to conduct comprehensive research. It includes a web UI for interacting with the agent through a conversational interface.
The current implementation works but has no durability - if the application crashes, all progress is lost. In the companion tutorial, you'll learn how to add Temporal to make this application durable and production-ready.
The deep research agent:
- Triages your research query to determine if it needs clarification
- Asks clarifying questions if your query is too broad
- Plans a web search strategy based on your query
- Searches multiple sources concurrently
- Writes a comprehensive research report
Without Temporal, this application has critical weaknesses:
- Lost Progress: If the server crashes during research, everything is lost
- Wasted API Calls: Expensive LLM calls must be repeated after failures
- No Recovery: Users must start completely over after any interruption
- In-Memory State: All session data disappears when the server restarts
- Python 3.10 or later
- An OpenAI API key
-
Clone the repository:
git clone https://github.com/temporalio/edu-deep-research-tutorial-template.git cd edu-deep-research-tutorial-template -
Install dependencies:
uv sync
-
Configure your API key:
cp .env-sample .env # Edit .env and add your OpenAI API key -
Run the application:
uv run run_server.py
-
Open your browser: Navigate to http://localhost:8234
edu-deep-research-tutorial-template/
├── deep_research/
│ ├── agents/ # AI agent implementations
│ │ ├── triage_agent.py # Determines if clarification needed
│ │ ├── clarifying_agent.py # Generates clarifying questions
│ │ ├── planner_agent.py # Creates search strategy
│ │ ├── search_agent.py # Performs web searches
│ │ └── writer_agent.py # Writes the final report
│ ├── models.py # Data models
│ └── research_manager.py # Orchestrates the research pipeline
├── ui/ # Web interface
│ ├── index.html # Chat interface
│ ├── success.html # Results page
│ └── src/
│ ├── css/styles.css
│ └── js/api-client.js
├── run_server.py # FastAPI server
├── pyproject.toml # Dependencies
└── README.md
Complete the Building a Durable Deep Research Agent tutorial to:
- Use the OpenAI Agents SDK Temporal integration for automatic LLM call durability
- Create a durable Workflow that orchestrates the research pipeline
- Add human-in-the-loop capabilities with Workflow Updates
- Handle failures gracefully with automatic retries
- Make your research sessions survive crashes and restarts
This code is an adapted version from this repository by steveandroulakis.