# aws-samples/sample-mimir-saga-ai-media-pipelines architecture

> Architecture diagram of the GitHub repository aws-samples/sample-mimir-saga-ai-media-pipelines, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aws-samples/sample-mimir-saga-ai-media-pipelines
- Repository: https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines

## Overview

This AWS CDK application deploys AI-assisted Mimir media workflows and Saga editorial workflows. A Mimir or Saga action/webhook initiates a pipeline; Step Functions coordinate processing that can analyze, summarize, transform, or assemble media and then update the relevant system. The rough-cut workflow combines script analysis, clip search, voice-over, and timeline creation. Separate capabilities cover feed ingestion, story research, MCP access, and observability. The graph combines README-documented workflows with sampled source; unsampled handlers are included only where their role is documented or clear from their path.

Main entry points: [`lib/infrastructure-stack.ts`](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/infrastructure-stack.ts) (Workflow orchestration), [`agents/rough-cut-agent/rough_cut_agent.py`](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/agents/rough-cut-agent/rough_cut_agent.py) (Rough-cut agent), [`bin/app.ts`](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/bin/app.ts) (CDK app), [`lib/saga-feeds-stack.ts`](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/saga-feeds-stack.ts) (Saga feed workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Pipeline orchestration"]
  node_pipeline["Workflow orchestration"]
  node_feedflow["Saga feed workflow"]
end

subgraph group_media["Media processing"]
  node_embedding["Video embeddings<br/>[index.js]"]
  node_stability["Camera stability<br/>[index.js]"]
  node_summary["Video summarization<br/>[index.js]"]
  node_transcription["Transcription<br/>[index.js]"]
  node_chaptering["Video chapters<br/>[index.js]"]
  node_reframe["Smart reframe<br/>[index.js]"]
  node_graphics["Graphics overlay<br/>[index.py]"]
end

subgraph group_editorial["Editorial workflows"]
  node_roughcut["Rough-cut agent<br/>[rough_cut_agent.py]"]
  node_roughprofiles["Cut profiles<br/>[profiles.py]"]
  node_roughprompts["Agent prompts<br/>[prompts.py]"]
  node_roughtools["Media and timeline tools<br/>[tools.py]"]
  node_storyresearch["Story research<br/>[index.js]"]
  node_storycontext["Story context<br/>[index.js]"]
  node_sagafeed["Feed matching<br/>[index.js]"]
end

subgraph group_integration["Platform integrations"]
  node_mcpserver["Mimir Saga MCP<br/>[mimir_mcp.py]"]
  node_gateway["Authenticated MCP gateway"]
  node_agentdeploy["AgentCore runtimes<br/>[agentcore-stack.ts]"]
  node_agentconstruct["Agent runtime construct"]
  node_xmlagent["XML processor agent"]
end

subgraph group_operations["Runtime services"]
  node_observability["Model logging"]
  node_vectors[("S3 Vectors")]
  node_app["CDK app<br/>[app.ts]"]
end

node_mimir(("Mimir"))
node_saga(("Saga"))

node_mimir -->|"triggers workflows"| node_pipeline
node_saga -->|"triggers actions"| node_pipeline
node_pipeline -->|"runs embedding"| node_embedding
node_pipeline -->|"analyzes footage"| node_stability
node_pipeline -->|"summarizes video"| node_summary
node_summary -->|"falls back to"| node_transcription
node_pipeline -->|"creates chapters"| node_chaptering
node_pipeline -->|"reframes video"| node_reframe
node_pipeline -->|"overlays graphics"| node_graphics
node_pipeline -->|"invokes agent"| node_roughcut
node_pipeline -->|"runs research"| node_storyresearch
node_pipeline -->|"gathers context"| node_storycontext
node_saga -->|"triggers ingestion"| node_feedflow
node_feedflow -->|"matches stories"| node_sagafeed
node_roughcut -->|"selects profile"| node_roughprofiles
node_roughcut -->|"uses prompts"| node_roughprompts
node_roughcut -->|"uses tools"| node_roughtools
node_roughcut -->|"reads stability maps"| node_stability
node_roughcut -->|"searches embeddings"| node_vectors
node_roughcut -->|"creates timeline"| node_mimir
node_mimir -->|"exposes asset tools"| node_mcpserver
node_saga -->|"exposes story tools"| node_mcpserver
node_gateway -->|"routes tool requests"| node_mcpserver
node_agentdeploy -->|"deploys runtimes"| node_agentconstruct
node_agentconstruct -->|"hosts agent"| node_xmlagent
node_app -->|"instantiates stack"| node_pipeline
node_app -->|"instantiates stack"| node_feedflow
node_app -->|"instantiates stack"| node_agentdeploy
node_app -->|"instantiates stack"| node_gateway
node_app -->|"instantiates stack"| node_observability
node_pipeline -.->|"configures model logging"| node_observability

click node_pipeline "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/infrastructure-stack.ts"
click node_feedflow "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/saga-feeds-stack.ts"
click node_embedding "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/embedding-trigger-handler/index.js"
click node_stability "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/stability-analysis-handler/index.js"
click node_summary "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/summarizer-handler/index.js"
click node_transcription "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/transcribe-handler/index.js"
click node_chaptering "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/chapterize-handler/index.js"
click node_reframe "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/vertical-reframe-handler/index.js"
click node_graphics "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/graphics-overlay-handler/index.py"
click node_roughcut "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/agents/rough-cut-agent/rough_cut_agent.py"
click node_roughprofiles "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/agents/rough-cut-agent/profiles.py"
click node_roughprompts "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/agents/rough-cut-agent/prompts.py"
click node_roughtools "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/agents/rough-cut-agent/tools.py"
click node_storyresearch "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/story-research-handler/index.js"
click node_storycontext "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/story-context-handler/index.js"
click node_sagafeed "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/saga-feed-handler/index.js"
click node_mcpserver "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/agents/mimir-mcp-server/mimir_mcp.py"
click node_gateway "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/mcp-gateway-stack.ts"
click node_agentdeploy "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/agentcore-stack.ts"
click node_agentconstruct "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/constructs/multi-agent-core.ts"
click node_xmlagent "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/agents/xml-processor-agent/xml_processor_agent.py"
click node_observability "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/observability-stack.ts"
click node_vectors "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/infrastructure-stack.ts"
click node_app "https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/bin/app.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pipeline,node_feedflow toneBlue
class node_embedding,node_stability,node_summary,node_transcription,node_chaptering,node_reframe,node_graphics toneAmber
class node_roughcut,node_roughprofiles,node_roughprompts,node_roughtools,node_storyresearch,node_storycontext,node_sagafeed toneMint
class node_mcpserver,node_gateway,node_agentdeploy,node_agentconstruct,node_xmlagent toneRose
class node_observability,node_vectors,node_app,node_mimir,node_saga toneIndigo
```

## Components

### Pipeline orchestration

- [Workflow orchestration](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/infrastructure-stack.ts): `lib/infrastructure-stack.ts`
- [Saga feed workflow](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/saga-feeds-stack.ts): `lib/saga-feeds-stack.ts`

### Media processing

- [Video embeddings](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/embedding-trigger-handler/index.js): `lambda/embedding-trigger-handler/index.js`
- [Camera stability](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/stability-analysis-handler/index.js): `lambda/stability-analysis-handler/index.js`
- [Video summarization](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/summarizer-handler/index.js): `lambda/summarizer-handler/index.js`
- [Transcription](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/transcribe-handler/index.js): `lambda/transcribe-handler/index.js`
- [Video chapters](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/chapterize-handler/index.js): `lambda/chapterize-handler/index.js`
- [Smart reframe](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/vertical-reframe-handler/index.js): `lambda/vertical-reframe-handler/index.js`
- [Graphics overlay](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/graphics-overlay-handler/index.py): `lambda/graphics-overlay-handler/index.py`

### Editorial workflows

- [Rough-cut agent](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/agents/rough-cut-agent/rough_cut_agent.py): `agents/rough-cut-agent/rough_cut_agent.py`
- [Cut profiles](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/agents/rough-cut-agent/profiles.py): `agents/rough-cut-agent/profiles.py`
- [Agent prompts](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/agents/rough-cut-agent/prompts.py): `agents/rough-cut-agent/prompts.py`
- [Media and timeline tools](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/agents/rough-cut-agent/tools.py): `agents/rough-cut-agent/tools.py`
- [Story research](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/story-research-handler/index.js): `lambda/story-research-handler/index.js`
- [Story context](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/story-context-handler/index.js): `lambda/story-context-handler/index.js`
- [Feed matching](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lambda/saga-feed-handler/index.js): `lambda/saga-feed-handler/index.js`

### Platform integrations

- [Mimir Saga MCP](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/agents/mimir-mcp-server/mimir_mcp.py): `agents/mimir-mcp-server/mimir_mcp.py`
- [Authenticated MCP gateway](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/mcp-gateway-stack.ts): `lib/mcp-gateway-stack.ts`
- [AgentCore runtimes](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/agentcore-stack.ts): `lib/agentcore-stack.ts`
- [Agent runtime construct](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/constructs/multi-agent-core.ts): `lib/constructs/multi-agent-core.ts`
- [XML processor agent](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/agents/xml-processor-agent/xml_processor_agent.py): `agents/xml-processor-agent/xml_processor_agent.py`

### Runtime services

- [Model logging](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/observability-stack.ts): `lib/observability-stack.ts`
- [S3 Vectors](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/lib/infrastructure-stack.ts): `lib/infrastructure-stack.ts`
- [CDK app](https://github.com/aws-samples/sample-mimir-saga-ai-media-pipelines/blob/main/bin/app.ts): `bin/app.ts`

### Other components

- **Mimir**
- **Saga**

## Connections

- Mimir → Workflow orchestration: triggers workflows (evidence: `README.md`)
- Saga → Workflow orchestration: triggers actions (evidence: `README.md`)
- Workflow orchestration → Video embeddings: runs embedding (evidence: `README.md`)
- Workflow orchestration → Camera stability: analyzes footage (evidence: `README.md`)
- Workflow orchestration → Video summarization: summarizes video (evidence: `README.md`)
- Video summarization → Transcription: falls back to (evidence: `README.md`)
- Workflow orchestration → Video chapters: creates chapters (evidence: `README.md`)
- Workflow orchestration → Smart reframe: reframes video (evidence: `README.md`)
- Workflow orchestration → Graphics overlay: overlays graphics (evidence: `README.md`)
- Workflow orchestration → Rough-cut agent: invokes agent (evidence: `README.md`)
- Workflow orchestration → Story research: runs research (evidence: `README.md`)
- Workflow orchestration → Story context: gathers context (evidence: `README.md`)
- Saga → Saga feed workflow: triggers ingestion (evidence: `README.md`)
- Saga feed workflow → Feed matching: matches stories (evidence: `README.md`)
- Rough-cut agent → Cut profiles: selects profile (evidence: `agents/rough-cut-agent/rough_cut_agent.py`)
- Rough-cut agent → Agent prompts: uses prompts (evidence: `agents/rough-cut-agent/rough_cut_agent.py`)
- Rough-cut agent → Media and timeline tools: uses tools (evidence: `agents/rough-cut-agent/rough_cut_agent.py`)
- Rough-cut agent → Camera stability: reads stability maps (evidence: `agents/rough-cut-agent/rough_cut_agent.py`)
- Rough-cut agent → S3 Vectors: searches embeddings (evidence: `README.md`)
- Rough-cut agent → Mimir: creates timeline (evidence: `README.md`)
- Mimir → Mimir Saga MCP: exposes asset tools (evidence: `README.md`)
- Saga → Mimir Saga MCP: exposes story tools (evidence: `README.md`)
- Authenticated MCP gateway → Mimir Saga MCP: routes tool requests (evidence: `lib/mcp-gateway-stack.ts`)
- AgentCore runtimes → Agent runtime construct: deploys runtimes (evidence: `lib/agentcore-stack.ts`)
- Agent runtime construct → XML processor agent: hosts agent
- CDK app → Workflow orchestration: instantiates stack (evidence: `bin/app.ts`)
- CDK app → Saga feed workflow: instantiates stack (evidence: `bin/app.ts`)
- CDK app → AgentCore runtimes: instantiates stack (evidence: `bin/app.ts`)
- CDK app → Authenticated MCP gateway: instantiates stack (evidence: `bin/app.ts`)
- CDK app → Model logging: instantiates stack (evidence: `bin/app.ts`)
- Workflow orchestration → Model logging: configures model logging
