← Code Exchange

Daily News Briefing Agent Demo (Vercel AI SDK)

A demo comparing AI agent workflows with and without durable execution. Generates daily tech briefings via web search, summarization, and AI synthesis — showing how Temporal handles retries and crash recovery automatically.


Demo#

What is this?#

This project demonstrates what it looks like to build an AI agent that actually works in production — not just in a happy-path demo. It runs a daily tech briefing agent that searches the web for topics you care about, summarizes the findings, and synthesizes everything into a personalized report.
The twist: it runs the same workflow twice, simultaneously — once as a plain async implementation, and once powered by Temporal. The side-by-side UI makes the difference immediately visible.

The problem with AI agents in production#

Most AI agent demos work great — until they don't. A network timeout mid-workflow, an API rate limit after step 3 of 5, a process crash while waiting on a slow LLM call. In a vanilla implementation, any of these means starting over from scratch. In long-running, multi-step agents, that's expensive and frustrating.
Temporal solves this by making workflows durable by default. Every step is checkpointed. If anything fails, it retries automatically with configurable backoff. If the process crashes entirely, it resumes exactly where it left off when it comes back up.

How the agent works#

The briefing agent runs in three phases: ```
Topics entered by user
│ ▼ ┌───────────────────┐
│ Phase 1: Search │ ← Parallel web searches per topic
└───────────────────┘

▼ ┌─────────────────────┐
│ Phase 2: Summarize │ ← AI summarizes each topic's findings └─────────────────────┘ │ ▼
┌──────────────────────┐ │ Phase 3: Brief │ ← Final report synthesized from all summaries └──────────────────────┘


  Both implementations follow the same logic. The difference is what happens when something goes wrong.                                                                                                                                                        
## Side-by-side comparison
The web UI runs both versions at the same time. You can watch the phase-by-phase progress live and see how each handles failures.                                                                                                                   
  | | Without Temporal | With Temporal |                     
  |---|---|---|                                                                     
  | **Phase 1 failure** | Job errors out, all progress lost | Retries automatically with backoff |                                                                         | **Process crash** | All in-flight work is gone | Resumes from last checkpoint on restart |
  | **Observability** | Terminal logs only | Full workflow history in Temporal UI   
  | **Long-running steps** | Fragile | Fault-tolerant |
  | **Retry logic** | Write it yourself | Built-in, configurable per activity |                                                                                          To simulate a crash on the vanilla side: just kill the server (`Ctrl+C`) while a job is running. Restart it and the vanilla job is gone. The Temporal workflow will pick back up automatically once the worker reconnects.                                                                          
The Temporal column shows:                                                             - Live phase progress as each step completes                                         - A retry badge when Phase 1 is automatically retried                               - A direct link to the Temporal UI to inspect workflow history, event timeline, and activity results                                                                                                                                                                                          
## Tech stack                                                       
  - **[Temporal](https://temporal.io)** — durable workflow execution                                                                                                                                                   
  - **[AI SDK](https://sdk.vercel.ai)** — LLM calls and tool use                                                                                                                                                       
  - **[OpenAI](https://platform.openai.com)** — `gpt-4o-mini` with built-in web search                                                                                                                                 
  - **TypeScript** — end to end                                                                                                                                                                                        
  - **Express** — lightweight server for the web UI                                                                                                                               
## Key concepts illustrated                                                                                            
  - **Activities vs. Workflows** — non-deterministic work (API calls, web search) lives in activities; orchestration logic lives in workflows                                                                          
  - **Automatic retries** — Phase 1 intentionally fails on the first attempt to show Temporal retrying transparently                                                                                                   
  - **Workflow queries** — the UI polls live phase progress directly from the running workflow via a Temporal query handler                                                                                            
  - **Durable state** — workflow progress survives worker restarts with no extra code    

Language

TypeScript
💖 Community vercelaiai sdk

About the Author

melissa-herrera

Melissa Herrera

Senior AI Developer Advocate