This sample demonstrates an AI-powered news article generator using the Durable Task .NET SDK. The workflow chains multiple specialized AI agents to research topics, generate content, create images, and produce an HTML article.
This application chains together three AI agents to create a complete news article:
- Research Agent: Researches a topic using web search capabilities
- Content Generation Agent: Creates article content based on research findings
- Image Generation Agent: Creates images for the article using DALL-E
The workflow is orchestrated using the Durable Task SDK, which handles the workflow coordination and reliability. When complete, the article is saved as an HTML file with text content and images.
- .NET 8 SDK
- Docker (for the Durable Task Scheduler emulator)
- Azure AI Projects service
- Azure credentials (via az login)
- Optional: Azure OpenAI service with DALL-E 3
-
Start the Durable Task Scheduler Emulator
# Pull and run the emulator docker pull mcr.microsoft.com/dts/dts-emulator:latest docker run --name dtsemulator -d -p 8080:8080 -p 8082:8082 mcr.microsoft.com/dts/dts-emulator:latest -
Set Environment Variables
# Required: Azure AI Projects endpoint export AGENT_CONNECTION_STRING="https://your-ai-project-endpoint.services.ai.azure.com/api/projects/your-project-id" # Optional: OpenAI model name (defaults to "gpt-4") export OPENAI_DEPLOYMENT_NAME="gpt-4-turbo" # Optional: For image generation (if omitted, placeholder images will be used) export DALLE_ENDPOINT="https://your-resource.openai.azure.com/openai/deployments/dall-e-3/images/generations?api-version=2024-02-01"
Note for Windows users:
- Command Prompt: Use
setinstead ofexport - PowerShell: Use
$env:VARIABLE_NAME="value"
- Command Prompt: Use
-
Build and Run the Application
In the first terminal:
dotnet build dotnet run --project Worker/Worker.csproj
In a second terminal:
dotnet run --project Client/Client.csproj
-
Generate an Article
Follow the prompts in the client console to enter a news topic. The application will:
- Research the topic
- Generate article content
- Create supporting images
- Save an HTML file with the complete article
When finished, the client will show the path to your generated HTML file (typically in a temp directory like
/var/folders/.../T/article-generator/on macOS).
The application uses a durable orchestration workflow with four key steps:
- Research: The Research Agent gathers facts, sources, and angles for your topic
- Content Creation: The Content Generation Agent writes a professional news article
- Image Generation: The Image Generation Agent creates descriptive images with DALL-E
- Assembly: All content is combined into a styled HTML document
The sample uses Azure's DefaultAzureCredential for authentication:
# Login with your Azure account
az login
# Select the correct subscription if needed
az account set --subscription "your-subscription-name-or-id"Ensure your account has:
- "AI Project User" role for Azure AI Projects
- "Cognitive Services OpenAI User" role for Azure OpenAI (if using DALL-E)
Monitor your workflow executions in the Durable Task Scheduler dashboard:
- Open a browser and go to
http://localhost:8082 - Select the
defaulttask hub - Check the Instances tab to see your orchestrations

