Table of Contents

๐Ÿ‘‰ Try the demo: https://github.com/LM-Kit/lm-kit-net-samples/tree/main/console_net/ai-agents/multi-agent-workflows/content_creation_pipeline

Content Creation Pipeline for C# .NET Applications


๐ŸŽฏ Purpose of the Demo

Content Creation Pipeline demonstrates how to use LM-Kit.NET to build a sequential multi-agent content workflow using the PipelineOrchestrator where content flows through a series of specialized agents, each refining and improving it.

The sample shows how to:

  • Create multiple specialized content agents for different stages.
  • Use PipelineOrchestrator to chain agents sequentially.
  • Pass output from one stage as input to the next.
  • Visualize content evolution through each pipeline stage.
  • Access intermediate outputs at every step.

Why Pipeline Orchestration with LM-Kit.NET?

  • Structured workflow: content progresses through defined stages.
  • Specialization: each agent focuses on one aspect of content creation.
  • Quality layers: multiple passes ensure polished output.
  • Transparency: see how content evolves at each stage.
  • Local-first: entire pipeline runs on your hardware.

๐Ÿ‘ฅ Who Should Use This Demo

  • Content Teams: automate blog post, article, and documentation creation.
  • Marketing Departments: streamline content production workflows.
  • Technical Writers: create structured documentation pipelines.
  • Publishers: build editorial review workflows.
  • Educators: understand sequential agent chaining patterns.

๐Ÿš€ What Problem It Solves

  • Structured content creation: from topic to polished article in defined stages.
  • Separation of concerns: each agent specializes in one task.
  • Quality assurance: multiple refinement passes.
  • Fact verification: dedicated stage for accuracy checking.
  • Workflow automation: repeatable content production process.

๐Ÿ’ป Demo Application Overview

Console app that:

  • Lets you choose from 6 models suitable for content generation.
  • Creates four specialized pipeline agents (Outliner, Writer, Editor, Fact-Checker).
  • Sets up a PipelineOrchestrator to chain agents sequentially.
  • Enters an interactive creation loop where you can:
    • Enter a topic or brief.
    • Watch content evolve through each stage.
    • See intermediate outputs (truncated for display).
    • Receive polished final content.
  • Displays execution statistics (stages completed, duration).
  • Loops until you type quit to exit.

Key Features

  • PipelineOrchestrator: sequential agent chaining.
  • Four-Stage Pipeline: Outliner, Writer, Editor, Fact-Checker.
  • Content Evolution: see how content transforms at each stage.
  • Color-Coded Stages: each stage output in distinct colors.
  • Intermediate Access: view output from any pipeline stage.
  • Timing Metrics: total pipeline execution duration.

Built-In Models (menu)

On startup, the sample shows a model selection menu:

Option Model Approx. VRAM Needed
0 Alibaba Qwen 3.5 9B ~7 GB VRAM
1 Google Gemma 4 E4B ~6 GB VRAM
2 Microsoft Phi-4 14.7B ~11 GB VRAM
3 OpenAI GPT OSS 20B ~16 GB VRAM
4 Z.ai GLM 4.7 Flash 30B ~18 GB VRAM
5 Alibaba Qwen 3.8 27B ~18 GB VRAM
6 Alibaba Qwen 3.6 35B-A3B ~22 GB VRAM
other Custom model URI depends on model

The same model is used for all pipeline stages. Larger models produce higher quality content.


Pipeline Stages

Stage Agent Input Output Role
1 Outliner Topic/Brief Structured outline Creates logical structure with sections and key points
2 Writer Outline Draft content Expands outline into full prose (400-600 words)
3 Editor Draft Polished content Improves grammar, style, flow, and clarity
4 Fact-Checker Polished content Verified content Adds caveats, qualifiers, and accuracy notes

Content Flow

Topic/Brief โ†’ Outliner โ†’ Writer โ†’ Editor โ†’ Fact-Checker โ†’ Final Content

Stage Details

1. Outliner Agent

  • Analyzes the topic
  • Creates structured outline with:
    • Compelling title
    • Introduction section
    • 3-5 main sections with headings
    • Key points for each section
    • Conclusion section

2. Writer Agent

  • Takes the outline
  • Expands into engaging prose
  • Maintains logical flow
  • Includes relevant examples
  • Targets 400-600 words

3. Editor Agent

  • Fixes grammar and spelling
  • Improves sentence structure
  • Enhances flow and transitions
  • Removes redundancy
  • Polishes word choice

4. Fact-Checker Agent

  • Identifies claims needing verification
  • Adds appropriate qualifiers
  • Flags potentially outdated information
  • Ensures balanced presentation
  • Adds notes for important caveats

Example Topics

Try the sample with:

  • Technical content:

    • "Write a blog post about the benefits of TypeScript for large-scale applications"
    • "Create an article explaining how blockchain technology works for beginners"
  • Business content:

    • "Write a guide on best practices for remote team management"
    • "Create content about effective communication strategies for distributed teams"
  • Lifestyle content:

    • "Create content about sustainable living tips for apartment dwellers"
    • "Write an article on productivity techniques for work-from-home professionals"

Agent Configuration

using LMKit.Agents;
using LMKit.Agents.Orchestration;
using LMKit.Model;

// Load model (shared by all pipeline stages)
LM model = LM.LoadFromModelID("qwen3.5:9b");

// Create pipeline agents
var outlinerAgent = Agent.CreateBuilder(model)
    .WithPersona(@"Outliner - Expert Content Outliner.
Create well-structured outlines including:
- A compelling title
- An introduction section
- 3-5 main sections with clear headings
- Key points under each section
- A conclusion section")
    .WithPlanning(PlanningStrategy.None)
    .Build();

var writerAgent = Agent.CreateBuilder(model)
    .WithPersona(@"Writer - Professional Content Writer.
Expand outlines into engaging prose:
- Clear, accessible style
- Smooth transitions between sections
- Relevant examples where appropriate
- Consistent tone throughout
- 400-600 words total")
    .WithPlanning(PlanningStrategy.None)
    .Build();

var editorAgent = Agent.CreateBuilder(model)
    .WithPersona(@"Editor - Meticulous Editor.
Refine and polish content:
- Grammar and spelling corrections
- Improved sentence structure
- Enhanced flow and transitions
- Removed redundancy
- Better word choice for clarity")
    .WithPlanning(PlanningStrategy.None)
    .Build();

var factCheckerAgent = Agent.CreateBuilder(model)
    .WithPersona(@"FactChecker - Fact-Checker and Quality Reviewer.
Review content for accuracy:
- Identify claims needing verification
- Add appropriate qualifiers
- Flag potentially outdated information
- Ensure balanced presentation
- Add notes for important caveats")
    .WithPlanning(PlanningStrategy.None)
    .Build();

// Create pipeline orchestrator
var pipeline = new PipelineOrchestrator()
    .AddStage("Outliner", outlinerAgent)
    .AddStage("Writer", writerAgent)
    .AddStage("Editor", editorAgent)
    .AddStage("FactChecker", factCheckerAgent);

// Execute pipeline
var result = await pipeline.ExecuteAsync(
    $"Create content about: {topic}",
    cancellationToken);

// Access stage results
foreach (var stageResult in result.AgentResults)
{
    Console.WriteLine($"Stage output: {stageResult.Content}");
}

// Final content
Console.WriteLine($"Final: {result.Content}");
Console.WriteLine($"Duration: {result.Duration.TotalSeconds:F1}s");

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Outliner   โ”‚ โ”€โ”€โ–ถ โ”‚   Writer    โ”‚ โ”€โ”€โ–ถ โ”‚   Editor    โ”‚ โ”€โ”€โ–ถ โ”‚Fact-Checker โ”‚
โ”‚   Agent     โ”‚     โ”‚   Agent     โ”‚     โ”‚   Agent     โ”‚     โ”‚   Agent     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
      โ”‚                   โ”‚                   โ”‚                   โ”‚
      โ–ผ                   โ–ผ                   โ–ผ                   โ–ผ
  Outline            Draft Text         Polished Text       Final Content

Understanding the Output

The demo displays content evolution through each stage:

Color Stage Content Type
Yellow Outliner Structured outline with sections and key points
Green Writer Draft prose expanded from outline
Magenta Editor Polished content with improved style
Cyan Fact-Checker Verified content with caveats and notes
White Final Content Complete, production-ready content
Dark Gray Statistics Stages completed, success count, duration

Output Format

โ”Œโ”€โ”€โ”€ Stage 1: OUTLINER โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
[Outline with title, sections, key points...]
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

โ”Œโ”€โ”€โ”€ Stage 2: WRITER โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
[Draft prose, may be truncated for display...]
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

โ”Œโ”€โ”€โ”€ Stage 3: EDITOR โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
[Polished content, may be truncated for display...]
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

โ”Œโ”€โ”€โ”€ Stage 4: FACT-CHECKER โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
[Final verified content with notes...]
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘                    FINAL CONTENT                              โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
[Complete content ready for use]

Behavior & Policies

  • Model sharing: same model used for all four pipeline stages.
  • Sequential execution: each stage waits for the previous to complete.
  • Output chaining: each stage receives the previous stage's output.
  • Intermediate truncation: display truncates long intermediate outputs.
  • Full final output: final content is displayed in full.
  • Timeout: 10-minute timeout per pipeline execution.

โš™๏ธ Getting Started

Prerequisites

  • .NET 8.0 or later
  • Sufficient VRAM for the selected model (7-18 GB depending on model choice)

Download

git clone https://github.com/LM-Kit/lm-kit-net-samples
cd lm-kit-net-samples/console_net/ai-agents/multi-agent-workflows/content_creation_pipeline

Run

dotnet build
dotnet run

Then:

  1. Select a model by typing 0-6, or paste a custom model URI.
  2. Wait for the model to download (first run) and load.
  3. Enter a topic or brief for content creation.
  4. Watch content evolve through each stage.
  5. Receive polished final content.
  6. Type quit to exit.

๐Ÿ”ง Troubleshooting

  • Low-quality content

    • Use a larger model for better writing.
    • Provide more detailed topic briefs.
  • Outline too sparse

    • Topic may need more context.
    • Try more specific or detailed briefs.
  • Content too short

    • Writer agent targets 400-600 words.
    • Adjust persona for longer content if needed.
  • Slow pipeline

    • Four sequential stages mean four inference calls.
    • Use a smaller or faster model.
    • Consider reducing stages for simpler workflows.
  • Out-of-memory errors

    • Single model is shared, so VRAM usage is manageable.
    • Pick a smaller model if needed.
  • Stage failures

    • Check StageResult.IsSuccess for each stage.
    • Failed stages may produce empty or error content.

๐Ÿš€ Extend the Demo

  • Add/remove stages: customize pipeline for different content types.
  • Parallel branches: split pipeline for A/B content variations.
  • Custom personas: create specialized pipelines (technical docs, marketing, social media).
  • Format conversion: add stages for Markdown, HTML, or other formats.
  • SEO optimization: add stage for keyword integration.
  • Translation: add stage for multi-language content.
  • Quality scoring: implement automated quality metrics.
  • Conditional stages: skip stages based on content characteristics.

Pipeline Variations

Documentation Pipeline

Technical Brief โ†’ Outliner โ†’ Writer โ†’ Technical Editor โ†’ API Validator

Marketing Pipeline

Product Brief โ†’ Outliner โ†’ Copywriter โ†’ Brand Reviewer โ†’ SEO Optimizer

Social Media Pipeline

Topic โ†’ Content Strategist โ†’ Writer โ†’ Tone Adjuster โ†’ Platform Formatter

๐Ÿ“š Additional Resources

Share