Code examples:

Media Script, Edit & Distribution Assistant — Building an AI Production Pipeline With Human Gates

November 16, 2026 13 min read By Jaffar Kazi
AI Development Media & Content Operations Human-in-the-Loop
Python C# Azure

What You'll Learn

  • How to run script, edit and distribution as one pipeline with three human approval gates
  • Why edit decisions must cite transcript segment IDs, not timestamps
  • How to validate platform constraints and publish idempotently
  • What a 45-minute episode costs to process, stage by stage
  • When this pipeline is the wrong tool

Introduction

A 45-minute episode isn't finished when the recording stops. Someone still has to write the script that shaped it, cut the dead air out of it, and turn it into a YouTube description with chapters, a LinkedIn post, a thread and a newsletter blurb. I built this assistant because on a small team that work takes about nine hours per episode, and only two of those hours need creative judgment.

The teams that feel this are studios, B2B media companies and creator-led businesses with a producer or two and a defined brand voice. The usual fixes fall short. A general chatbot writes a generic script. "AI clip" tools cut by audio energy without knowing the sponsor read must survive. Auto-schedulers post whatever they're handed, including a number the host never said. This article covers the pipeline I built across all three stages: the data model, the orchestration, the two hardest problems, the cost, and when not to build it.

The Current Approach and Its Limits

The baseline is a tangle of documents and habits: the script in a shared doc, footage in an editing suite, the transcript wherever it was exported, the distribution plan in a spreadsheet or someone's head. It works because one person remembers everything. For the illustrative team in this article, a weekly 45-minute episode takes about 3 hours to script, 4 for a rough cut and 2 to package. That is 9 hours at $60 an hour, or $540.

  • Context loss: the editor doesn't see the script's intent, so a deliberate callback gets cut as a tangent. The person writing the LinkedIn post hasn't watched the episode.
  • Voice drift: the style guide is a PDF nobody opens at 10 p.m.
  • Distribution last: packaging happens when energy is lowest, so posts go late and chapters get skipped.
  • Unused material: finding the strong 60-second moments means rewatching everything, so nobody does.

None of this is broken enough to trigger a rewrite. It is slow, and slow compounds: a team that could publish three pieces a week publishes one.

The Solution Approach

Treat the three stages as one pipeline with shared state, and split responsibility cleanly: the model proposes, deterministic code validates, and a human approves anything irreversible or public.

  • Script stage: a brief, retrieved style-guide passages and a rights-cleared source pack become a structured script. Every claim carries a source ID, and an unsourced claim blocks approval.
  • Edit stage: transcribe, then ask the model for cuts as transcript segment IDs. A validator checks the plan before an editor sees it.
  • Distribution stage: platform drafts from a shared content brief, validated against platform limits and the transcript, published only after approval.

Here's what surprised me: the benefit comes from the shared state more than from any single stage. The edit planner reads the approved script, so it knows which "tangent" is a deliberate callback. Three gates rather than one final review is deliberate, because by the end a bad script has already shaped the recording and a bad cut plan has already shaped the posts.

The stack is Azure OpenAI (GPT-5.4 for scripts, edit plans and posts; GPT-5.4 mini for chaptering and claim extraction), gpt-transcribe, Azure AI Search, Service Bus and Azure SQL. Python uses LangGraph. C# uses Semantic Kernel for model calls and a plain state machine for the workflow.

Architecture Overview

The workflow worker is the only component that talks to models. State is persisted to Azure SQL after every stage, and every stage that produces something a human relies on ends at a gate.

Architecture diagram showing a brief, source pack and recording feeding a workflow worker with a script agent, transcription, edit planner with validator, and distribution agent with platform validator, three human approval gates, and an idempotent publisher, supported by Service Bus, Azure SQL, AI Search and App Insights
  • Validators sit between every agent and every gate, so humans spend their attention on judgment calls, not out-of-range timestamps.
  • Retries loop back with the validator's exact issue text, capped at two attempts.
  • Gates are durable pauses. The script gate can sit for two days while the host records; the pipeline checkpoints and resumes on the approval or upload event.
  • Publishing is the only irreversible step, so it alone gets an idempotency key and a content hash check.

Stages communicate through small Service Bus messages (asset ID, stage, a pointer to persisted state), so redelivery is harmless. Messages that fail repeatedly dead-letter with the last validator output attached.

Core Implementation

The state model encodes two decisions that matter later. The model never emits timestamps, only segment indices into a transcript the system already holds. And every claim's source ID can be null, because "I could not find a source" must be representable.

models.py / Models.cs

from typing import Literal, TypedDict
from pydantic import BaseModel

class Claim(BaseModel):
    id: str
    text: str
    source_id: str | None = None      # None blocks script approval

class Beat(BaseModel):
    heading: str
    talking_points: list[str]
    target_seconds: int
    claim_ids: list[str] = []

class Script(BaseModel):
    title: str
    beats: list[Beat]
    claims: list[Claim]

class Cut(BaseModel):
    start_seg: int                    # transcript segment index, never seconds
    end_seg: int
    reason: Literal["filler", "tangent", "repeat", "dead_air", "off_brief"]

class EditPlan(BaseModel):
    cuts: list[Cut]
    highlights: list[tuple[int, int]] # segment ranges for short-form clips

class PostDraft(BaseModel):
    platform: Literal["youtube", "linkedin", "x", "newsletter", "shorts"]
    body: str
    title: str | None = None
    hashtags: list[str] = []

class PipelineState(TypedDict):
    asset_id: str
    brief: str
    script: Script | None
    segments: list[dict]              # {i, start, end, text, protected}
    edit_plan: EditPlan | None
    edit_issues: list[str]
    posts: list[PostDraft]
    post_issues: list[str]
    attempts: dict[str, int]

public record Claim(string Id, string Text, string? SourceId);   // null blocks approval

public record Beat(string Heading, List<string> TalkingPoints,
                   int TargetSeconds, List<string> ClaimIds);

public record Script(string Title, List<Beat> Beats, List<Claim> Claims);

public enum CutReason { Filler, Tangent, Repeat, DeadAir, OffBrief }

// Segment indices into the stored transcript, never seconds.
public record Cut(int StartSeg, int EndSeg, CutReason Reason);
public record SegmentRange(int Start, int End);
public record EditPlan(List<Cut> Cuts, List<SegmentRange> Highlights);

public record Segment(int I, double Start, double End, string Text, bool Protected);

public record PostDraft(string Platform, string Body, string? Title, List<string> Hashtags);

public enum Stage { DraftScript, ScriptApproval, AwaitFootage, PlanEdit, EditApproval,
                    DraftPosts, PostApproval, Publish, Done }

public record PipelineState(
    string AssetId, string Brief, Stage Stage,
    Script? Script = null,
    IReadOnlyList<Segment>? Segments = null,
    EditPlan? EditPlan = null, List<string>? EditIssues = null, int EditAttempts = 0,
    List<PostDraft>? Posts = null, List<string>? PostIssues = null, int PostAttempts = 0);

LangGraph gives me checkpointing and interrupt() for the gates. In C#, an explicit stage enum and a loop advance the work until it parks at a gate. The shape is the same: do the work, validate, retry with feedback up to a cap, stop at a human gate.

workflow.py / MediaWorkflow.cs

from langgraph.graph import StateGraph, START, END
from langgraph.types import interrupt

MAX_ATTEMPTS = 2

def approve_script(state: PipelineState):
    # Durable pause: the checkpoint holds state until a human resumes the run.
    decision = interrupt({"gate": "script", "script": state["script"].model_dump()})
    return {"script": Script(**decision["script"])}

def await_footage(state: PipelineState):
    upload = interrupt({"gate": "footage", "asset_id": state["asset_id"]})
    return {"segments": upload["segments"]}

def retry_or(next_node: str, producer: str, issues_key: str):
    def route(state: PipelineState) -> str:
        tries = state["attempts"].get(producer, 0)
        # Out of attempts: go to the human gate WITH the unresolved issues attached.
        return producer if state[issues_key] and tries < MAX_ATTEMPTS else next_node
    return route

g = StateGraph(PipelineState)
for name, fn in [("draft_script", draft_script), ("approve_script", approve_script),
                 ("await_footage", await_footage), ("plan_edit", plan_edit),
                 ("validate_edit", validate_edit), ("approve_edit", approve_edit),
                 ("draft_posts", draft_posts), ("validate_posts", validate_posts),
                 ("approve_posts", approve_posts), ("publish", publish)]:
    g.add_node(name, fn)

g.add_edge(START, "draft_script")
g.add_edge("draft_script", "approve_script")
g.add_edge("approve_script", "await_footage")
g.add_edge("await_footage", "plan_edit")
g.add_edge("plan_edit", "validate_edit")
g.add_conditional_edges("validate_edit", retry_or("approve_edit", "plan_edit", "edit_issues"),
                        ["plan_edit", "approve_edit"])
g.add_edge("approve_edit", "draft_posts")
g.add_edge("draft_posts", "validate_posts")
g.add_conditional_edges("validate_posts", retry_or("approve_posts", "draft_posts", "post_issues"),
                        ["draft_posts", "approve_posts"])
g.add_edge("approve_posts", "publish")
g.add_edge("publish", END)

graph = g.compile(checkpointer=checkpointer)   # Postgres or SQL-backed saver in production

public class MediaWorkflow(IScriptAgent script, IEditAgent edit,
                           IDistributionAgent dist, IStateStore store)
{
    private const int MaxAttempts = 2;

    public async Task<PipelineState> AdvanceAsync(PipelineState s, CancellationToken ct)
    {
        while (true)
        {
            switch (s.Stage)
            {
                case Stage.DraftScript:
                    s = s with { Script = await script.DraftAsync(s.Brief, ct),
                                 Stage = Stage.ScriptApproval };
                    break;

                case Stage.PlanEdit:
                {
                    var plan = await edit.PlanAsync(s.Segments!, s.Script!, s.EditIssues, ct);
                    var issues = EditValidator.Validate(plan, s.Segments!);
                    var retry = issues.Count > 0 && s.EditAttempts < MaxAttempts;
                    s = retry
                        ? s with { EditIssues = issues, EditAttempts = s.EditAttempts + 1 }
                        : s with { EditPlan = plan, EditIssues = issues, Stage = Stage.EditApproval };
                    break;
                }

                case Stage.DraftPosts:
                {
                    var posts = await dist.DraftAsync(s, ct);
                    var issues = PostValidator.Validate(posts, s.Segments!);
                    var retry = issues.Count > 0 && s.PostAttempts < MaxAttempts;
                    s = retry
                        ? s with { PostIssues = issues, PostAttempts = s.PostAttempts + 1 }
                        : s with { Posts = posts, PostIssues = issues, Stage = Stage.PostApproval };
                    break;
                }

                case Stage.ScriptApproval:
                case Stage.AwaitFootage:
                case Stage.EditApproval:
                case Stage.PostApproval:
                    await store.SaveAsync(s, ct);
                    return s;                       // parked: a human or an upload event resumes

                case Stage.Publish:
                    s = (await dist.PublishApprovedAsync(s, ct)) with { Stage = Stage.Done };
                    break;

                default:
                    return s;
            }
            await store.SaveAsync(s, ct);           // persist after every transition
        }
    }
}

The trade-off is tooling versus portability. LangGraph hands me resumable interrupts for free. The C# state machine is more code but easy to read and test, and I chose not to depend on Semantic Kernel's process framework for a workflow this simple.

The tricky part of the script stage is resisting what the model already knows. It will add a plausible statistic from memory, and it will read perfectly. Forcing a source ID on each claim doesn't make the model more truthful; it makes unsupported claims visible, and the approval screen lists them first.

Key Technical Challenge #1: Edit Decisions the Model Cannot Hallucinate

My first version asked for cuts as timestamps. In practice, models produce timestamps fluently and wrongly: cuts landed mid-sentence, ranges ran past the end of the recording, and two cuts overlapped so the editor's import broke.

The fix is to change what the model is allowed to say. The transcript is split into numbered segments and shown like this:

[17] So the thing about renewal pricing is it never goes down.
[18] Anyway, before I forget, did you see the match last night?
[19] Right. Back to pricing. The first lever is the notice period.

The model answers "cut 18 to 18, reason tangent". It can't invent a position that doesn't exist, because the system resolves indices to times from the stored transcript. The validator then enforces what a human editor would have caught:

  • Indices are in range and cuts don't overlap.
  • Protected segments (sponsor reads, disclaimers, guest consent) are never removed.
  • Total removed stays under 35% of runtime. More than that is almost always the model misreading the brief.
edit_validator.py / EditValidator.cs

MAX_CUT_RATIO = 0.35

def validate_edit(plan: EditPlan, segs: list[dict]) -> list[str]:
    issues, n = [], len(segs)
    protected = {s["i"] for s in segs if s.get("protected")}
    total = segs[-1]["end"] - segs[0]["start"]
    cut_secs, last_end = 0.0, -1

    for c in sorted(plan.cuts, key=lambda c: c.start_seg):
        if not (0 <= c.start_seg <= c.end_seg < n):
            issues.append(f"cut {c.start_seg}-{c.end_seg} is outside the transcript (0-{n - 1})")
            continue
        if c.start_seg <= last_end:
            issues.append(f"cut {c.start_seg}-{c.end_seg} overlaps the previous cut")
        if protected.intersection(range(c.start_seg, c.end_seg + 1)):
            issues.append(f"cut {c.start_seg}-{c.end_seg} removes a protected segment")
        cut_secs += segs[c.end_seg]["end"] - segs[c.start_seg]["start"]
        last_end = max(last_end, c.end_seg)

    if cut_secs / total > MAX_CUT_RATIO:
        issues.append(f"cuts remove {cut_secs / total:.0%} of runtime; the limit is {MAX_CUT_RATIO:.0%}")
    return issues

public static class EditValidator
{
    private const double MaxCutRatio = 0.35;

    public static List<string> Validate(EditPlan plan, IReadOnlyList<Segment> segs)
    {
        var issues = new List<string>();
        int n = segs.Count, lastEnd = -1;
        double total = segs[^1].End - segs[0].Start, cutSecs = 0;

        foreach (var c in plan.Cuts.OrderBy(c => c.StartSeg))
        {
            if (c.StartSeg < 0 || c.EndSeg >= n || c.StartSeg > c.EndSeg)
            {
                issues.Add($"cut {c.StartSeg}-{c.EndSeg} is outside the transcript (0-{n - 1})");
                continue;
            }
            if (c.StartSeg <= lastEnd)
                issues.Add($"cut {c.StartSeg}-{c.EndSeg} overlaps the previous cut");
            if (segs.Skip(c.StartSeg).Take(c.EndSeg - c.StartSeg + 1).Any(s => s.Protected))
                issues.Add($"cut {c.StartSeg}-{c.EndSeg} removes a protected segment");

            cutSecs += segs[c.EndSeg].End - segs[c.StartSeg].Start;
            lastEnd = Math.Max(lastEnd, c.EndSeg);
        }

        if (cutSecs / total > MaxCutRatio)
            issues.Add($"cuts remove {cutSecs / total:P0} of runtime; the limit is {MaxCutRatio:P0}");
        return issues;
    }
}

The validator is the unglamorous piece that makes the rest trustworthy. The model's judgment about what to cut is still reviewed by a human; its arithmetic about where is no longer in question. On export, boundaries snap to word-level timestamps with a pad of about 150 milliseconds, and each cut's reason travels with it as a marker so the editor can override in one click.

Key Technical Challenge #2: Distribution That Cannot Embarrass You

A bad cut costs an editor five minutes. A bad post is public and screenshotted. The distribution stage has three layers.

  • Constraints are code, not prompt text. "Keep it under 3,000 characters" works most of the time, which isn't good enough. Hard limits (LinkedIn length, YouTube title length) are checked and returned as issues for the retry.
  • Every figure must exist in the source. Extract each number from a draft and confirm it appears in the transcript. A false positive costs one retry; a false negative costs a correction notice.
  • Publishing is idempotent. Queues deliver at least once, so a timeout after the platform accepted a post means a duplicate. The key combines asset, platform, slot and a hash of the approved body, and is claimed with a unique constraint before the platform call. Editing after approval changes the hash, which forces re-approval.
post_validator.py / PostValidator.cs

import hashlib, re

LIMITS = {"linkedin": 3000, "x": 280, "youtube_title": 100, "youtube_desc": 5000}
NUMBER = re.compile(r"\d+(?:[,.]\d+)*%?")

def validate_post(p: PostDraft, transcript: str) -> list[str]:
    issues = []
    if p.platform in LIMITS and len(p.body) > LIMITS[p.platform]:
        issues.append(f"{p.platform}: body is {len(p.body)} chars, limit {LIMITS[p.platform]}")
    if p.platform == "youtube" and p.title and len(p.title) > LIMITS["youtube_title"]:
        issues.append(f"youtube: title is {len(p.title)} chars, limit {LIMITS['youtube_title']}")
    for figure in NUMBER.findall(p.body):
        if figure not in transcript:
            issues.append(f"{p.platform}: figure '{figure}' does not appear in the transcript")
    return issues

def publish_key(asset_id: str, p: PostDraft, slot: str) -> str:
    digest = hashlib.sha256(p.body.encode()).hexdigest()[:16]
    return f"{asset_id}:{p.platform}:{slot}:{digest}"

def publish_once(db, client, key: str, post: PostDraft) -> str:
    if not db.try_claim(key):                # INSERT with a unique constraint on key
        return "duplicate_skipped"
    result = client.publish(post)
    db.mark_published(key, result.external_id)
    return "published"

public static partial class PostValidator
{
    private static readonly Dictionary<string, int> Limits = new()
        { ["linkedin"] = 3000, ["x"] = 280, ["youtube_title"] = 100, ["youtube_desc"] = 5000 };

    [GeneratedRegex(@"\d+(?:[,.]\d+)*%?")]
    private static partial Regex Number();

    public static List<string> Validate(PostDraft p, string transcript)
    {
        var issues = new List<string>();
        if (Limits.TryGetValue(p.Platform, out var max) && p.Body.Length > max)
            issues.Add($"{p.Platform}: body is {p.Body.Length} chars, limit {max}");
        if (p.Platform == "youtube" && p.Title?.Length > Limits["youtube_title"])
            issues.Add($"youtube: title is {p.Title.Length} chars, limit {Limits["youtube_title"]}");
        foreach (Match m in Number().Matches(p.Body))
            if (!transcript.Contains(m.Value))
                issues.Add($"{p.Platform}: figure '{m.Value}' does not appear in the transcript");
        return issues;
    }
}

public static class Publisher
{
    public static string Key(string assetId, PostDraft p, string slot)
    {
        var hash = Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(p.Body)))[..16];
        return $"{assetId}:{p.Platform}:{slot}:{hash}";
    }

    public static async Task<string> PublishOnceAsync(IPublicationStore db, IPlatformClient client,
                                                      string key, PostDraft post, CancellationToken ct)
    {
        if (!await db.TryClaimAsync(key, ct)) return "duplicate_skipped";   // unique constraint on key
        var result = await client.PublishAsync(post, ct);
        await db.MarkPublishedAsync(key, result.ExternalId, ct);
        return "published";
    }
}

The Gap in This Pattern

If the worker crashes after claiming the key, either nothing was posted or the confirmation was lost. I keep claimed separate from published, and a reconciler checks the platform for stale claims. Idempotency prevents duplicates; it doesn't remove the need to reconcile.

Cost Analysis

The numbers are per 45-minute episode, using OpenAI's published API list prices as of November 2026: GPT-5.4 at $2.50 per million input tokens and $15 per million output, GPT-5.4 mini at $0.75 and $4.50, and gpt-transcribe at $0.0045 per audio minute. These are OpenAI direct prices, not Azure's, which can differ by deployment type and region, so check Azure before relying on them.

StageModelTokens (in / out)Cost
Transcription (45 min)gpt-transcribe45 audio minutes$0.20
Script, two drafting passesGPT-5.42 × (6,000 / 2,500)$0.11
Claim extractionGPT-5.4 mini3,000 / 1,000$0.007
Edit planGPT-5.412,000 / 1,500$0.053
Chapters and highlightsGPT-5.4 mini12,000 / 1,000$0.014
Six distribution drafts, with retriesGPT-5.4about 4,500 / 3,200$0.06
Total per episodeabout $0.44

Transcription is the largest line, and it isn't an LLM cost. Distribution is cheap by design: one compact content brief (about 1,200 tokens) is fanned out, instead of sending the full 12,000-token transcript with each of six requests. That is about $0.23 versus $0.06, a 74% saving.

On model tiers, I pay for the stronger model where a human reviews the output (script, edit plan) and use the cheaper one where a validator checks it (claims, chapters). Distribution drafts are the stage to test. Doubling the price of every LLM stage would add roughly $0.24 per episode, small against $540. Decide with the replay harness below, not with price lists.

Cost Reality

Model spend is rarely the budget problem. A 20-episode month costs about $9 in model and transcription fees against roughly $60 of infrastructure, about $3.50 per episode all-in. A team with two episodes a month pays mostly for idle infrastructure.

Observability and Debugging

Three agents and three gates fail quietly: an off-brand script, a cut plan the editor rejects every time, a post that passes validation and still reads badly. I trace every model call with stage, asset, tokens and retries.

tracing.py / Tracing.cs

from azure.monitor.opentelemetry import configure_azure_monitor
from opentelemetry import trace

configure_azure_monitor()                      # reads APPLICATIONINSIGHTS_CONNECTION_STRING
tracer = trace.get_tracer("media.assistant")

async def traced_call(stage: str, asset_id: str, model: str, messages: list, **kw):
    with tracer.start_as_current_span(f"llm.{stage}") as span:
        span.set_attribute("asset.id", asset_id)
        span.set_attribute("pipeline.stage", stage)
        span.set_attribute("llm.model", model)
        resp = await client.chat.completions.create(model=model, messages=messages, **kw)
        usage = resp.usage
        span.set_attribute("llm.tokens.input", usage.prompt_tokens)
        span.set_attribute("llm.tokens.output", usage.completion_tokens)
        span.set_attribute("llm.cost_usd", estimate_cost(model, usage))
        return resp

def record_validation(stage: str, asset_id: str, issues: list[str], attempt: int):
    span = trace.get_current_span()
    span.set_attribute(f"{stage}.issues", len(issues))
    span.set_attribute(f"{stage}.attempt", attempt)
    for issue in issues:
        span.add_event("validation_issue", {"stage": stage, "detail": issue})

// Program.cs
builder.Services.AddOpenTelemetry()
    .UseAzureMonitor()
    .WithTracing(t => t.AddSource("Media.Assistant"));

public class TracedChat(IChatCompletionService chat)
{
    private static readonly ActivitySource Source = new("Media.Assistant");

    public async Task<ChatMessageContent> CompleteAsync(
        string stage, string assetId, string model, ChatHistory history,
        PromptExecutionSettings settings, Kernel kernel, CancellationToken ct)
    {
        using var activity = Source.StartActivity($"llm.{stage}");
        activity?.SetTag("asset.id", assetId);
        activity?.SetTag("pipeline.stage", stage);
        activity?.SetTag("llm.model", model);

        var result = await chat.GetChatMessageContentAsync(history, settings, kernel, ct);

        if (result.Metadata?["Usage"] is OpenAI.Chat.ChatTokenUsage u)
        {
            activity?.SetTag("llm.tokens.input", u.InputTokenCount);
            activity?.SetTag("llm.tokens.output", u.OutputTokenCount);
        }
        return result;
    }

    public static void RecordValidation(string stage, IReadOnlyList<string> issues, int attempt)
    {
        var activity = Activity.Current;
        activity?.SetTag($"{stage}.issues", issues.Count);
        activity?.SetTag($"{stage}.attempt", attempt);
        foreach (var issue in issues)
            activity?.AddEvent(new ActivityEvent("validation_issue",
                tags: new ActivityTagsCollection { ["stage"] = stage, ["detail"] = issue }));
    }
}
  • Validator rejection rate per stage: the earliest warning of prompt or transcript-format drift.
  • Gate change rate: how much the human altered the output before approving. Approving unchanged 95% of the time may mean rubber-stamping; changing 60% means the agent isn't earning its place.
  • Time in gate: a pipeline that sits two days at post approval isn't saving anyone time.

The last piece is a replay harness. Every approved episode stores its brief, transcript, model outputs and the human's final version. After a prompt or validator change, I replay past episodes and compare with what the human approved, which gives me a regression suite built from real editorial decisions.

Technology Choices

Python Implementation

Why choose Python: If your team writes Python, you get access to the richest AI/ML ecosystem.

  • Library ecosystem — LangGraph for checkpointed workflows with resumable interrupts
  • Rapid prototyping — quick iteration on prompts and validators, and notebooks for replaying a bad episode
  • Community — most agentic-workflow and evaluation examples are Python-first

C#/.NET Implementation

Why choose C#: If your backend is .NET, you get first-party Microsoft support and enterprise patterns.

  • Native Azure integration — first-party SDKs for Azure OpenAI, Service Bus and Azure Monitor
  • Enterprise patterns — dependency injection and records that make the stage model compiler-checked
  • Production-ready — background services and durable queues fit an existing .NET platform

The Bottom Line

Python team? Use Python. C#/.NET team? Use C#. Don't fight your stack. The edit validator, the figure check and the idempotency key are worth porting exactly; the orchestration framework is the part you can swap.

Azure Infrastructure

ServiceRoleApprox. monthly
Azure OpenAIGPT-5.4, GPT-5.4 mini, gpt-transcribeabout $9 at 20 episodes
Container AppsWorker and approval APIabout $20
Service Bus (Standard)Queues, retries, dead-letterabout $10
Azure SQL (serverless)State, checkpoints, publication keysabout $15
Blob StorageRecordings, transcripts, source packsabout $5
Application InsightsTraces and validation eventsabout $10
AI Search (Basic), optionalStyle-guide retrievalabout $75

The roughly $60 infrastructure figure excludes AI Search. A style guide of a few dozen pages fits in one prompt with caching, so I added Search only once the guide plus past-episode hooks outgrew that. These infrastructure figures are estimates.

Azure AI Foundry Agent Service

Azure AI Foundry Agent Service is now generally available, providing managed orchestration for AI systems.

  • Built-in routing and workflows
  • Managed state persistence
  • Native Azure OpenAI integration
  • Observability through Azure Monitor

It is a reasonable alternative to hosting the worker yourself. I'd keep the validators and the publisher as ordinary code either way, since they carry the strictest correctness requirements.

Check Azure AI Foundry Agent Service for current pricing.

ROI and Business Value

Worked Example: 20 Episodes per Month

  • Before: 9 hours per episode at $60 per hour = $540
  • After: about 5.5 hours (1.5 script review, 3 cut-list review and fine cut, 1 post review) = $330
  • Saved: about $210 per episode, so $4,200 a month against about $70 running cost
  • Payback: on an assumed $30,000 build, roughly seven months

These inputs are illustrative assumptions, not measurements.

I used 3.5 hours saved rather than the 5 or 6 a demo suggests, because review time is real. Break-even depends on volume: at 5 episodes a month, payback takes over two years; at 40, under four months. If reviewing an AI cut list takes your editor as long as producing one, the saving collapses, so pilot two weeks on real episodes before committing.

When NOT to Use This

Skip or Defer This Pipeline If

  • You publish fewer than about 6 pieces a month. The build and fixed infrastructure won't pay back.
  • Your content is visual-first. The planner works from speech; a cooking show or documentary cut on imagery will mislead it.
  • The creative voice is the product. A model-drafted script drifts toward the average. Use it for research packs and packaging instead.
  • You can't staff the gates. Without a person reading the output, you have built an auto-poster with extra steps.
  • Rights and legal review are complex. Music, archive footage and regulated claims need a clearance process this doesn't replace.

A transcript-based editor plus a saved prompt for distribution copy covers many teams. If the main pain is distribution, build only that stage first: the idempotent publisher and figure check carry over when you add the rest.

Key Takeaways

  • One pipeline, three stages, three gates. Shared state is where most of the quality comes from.
  • The model proposes; code validates; humans approve. Put mechanical rules in validators, not prompts.
  • Never let the model emit timestamps. Have it cite segment IDs.
  • Check figures against the source and publish idempotently.
  • Cost is fixed infrastructure and human review, not tokens: about $0.44 per episode against $540 of manual effort.

Want More Practical AI Tutorials?

I write about building production AI systems with Azure, Python, and C#. Subscribe for practical tutorials delivered twice a month.

Subscribe to Newsletter →

Written by Jaffar Kazi, a software engineer in Sydney building AI-powered applications. Connect on LinkedIn.