2026·Gen AI·Brand & product systemsTessact AI

One pipeline, four creative formats, one product identity.

Product images and a prompt in. Image bundles, fast paced videos, scripted videos, and UGC style cuts out. The challenge was supporting very different creative formats without turning the backend into a set of tightly coupled provider scripts.

Role
Engineer · routing + pipeline
Team
Gen AI service
Stack
FastAPI, Python, Postgres, RabbitMQ
Surface
Internal job APIs, callbacks
Formats
4 output modes
Sanitized
Yes
·Demo
01Overview

From a product image and a prompt to a full campaign surface.

The workflow generates product focused creative from product images, optional links, user prompts, and campaign settings. I structured the system around strict job contracts, durable step state, capability based provider adapters, and branch specific pipelines that share common reliability primitives.

Workflow capabilities8
  • Product creation
  • Metadata extraction
  • Storyboard suggestions
  • Image bundles
  • Fast paced videos
  • Script to video
  • UGC style outputs
  • Product fidelity checks
02Product problem

A wide creative surface with different pipeline shapes.

A single product can require clean imagery, metadata, storyboard concepts, scene images, video clips, scripts, voiceover, continuity frames, and final stitched media. Different output modes have different shapes, but they still need consistent progress tracking, retries, and completion callbacks.

Before

Provider scripts wired into product code.

  • · Format changes touched product APIs.
  • · New providers required broad refactors.
  • · Retries reran whole campaigns.
  • · Fidelity checks lived outside the pipeline.
After

One orchestration layer, branch aware pipelines.

  • · Adding a format is a routing concern.
  • · Adapters keep providers swappable.
  • · Retries resume from scene or stage.
  • · Fidelity is a pipeline stage, not a review step.
03My role
01·

Normalized job contracts

For marketing creation, output generation, and retry jobs.

02·

Branch aware routing

Image bundle, video, script to video, and UGC style flows behind one entry point.

03·

Persisted job & step state

For observability, audit, and targeted retries.

04·

Capability adapters

Image, video, audio, script, storyboard, fidelity, stitch, lip sync.

05·

Lifecycle events

Structured accepted, started, progress, completed, and failed events.

06·

Contract & pipeline tests

Routing, callbacks, persistence, output shape.

04System design

Adding a new output mode is a routing concern, not a platform change.

Internal requests are validated, persisted with idempotency, and dispatched onto dedicated queues for asynchronous execution. The product backend submits a compact product snapshot. The Gen AI service handles media execution, intermediate assets, failure recovery, and completion reporting.

Source of truthProduct backend
Owns orchestrationGen AI service
Extension pointRouter + pipeline module
Service boundaryinternal only
Service AAPI

Product backend

  • Users & workspaces
  • Permissions
  • Public API
  • Product records
  • Response shapes
Service BThis service

Gen AI service

  • Job APIs (idempotent)
  • Persistence + snapshots
  • Worker queues
  • Output mode router
  • Provider adapters
Product snapshotProduct identity, output mode, prompt, settings, idempotency key.
Lifecycle eventsaccepted · started · progress · completed · failed.
Inside Service Bqueue isolation
Marketing
Avatar
Callbacks
Maintenance
Retry
05Marketing creation flow

Identity separated from campaign specific instructions.

Later creative generation reuses a stable product representation while still varying format, pacing, scene style, and presentation mode. The service records stage outputs as reusable checkpoints rather than treating each generation attempt as disposable.

  1. 01
    Neutral imageClean product image from user media.
  2. 02
    MetadataProduct attributes and category.
  3. 03
    Character sheetReference for visual consistency.
  4. 04
    Link metadataOptional product page extraction.
  5. 05
    Storyboard seedsConcepts that seed later output.
  6. 06
    EmitProgress and completion to product record.
checkpointedExpensive steps are reused when a later metadata, character sheet, or storyboard suggestion stage needs to rerun.
06Output mode router

One entry point, four branch specific pipelines.

The output router inspects the requested format and dispatches to a branch specific pipeline while preserving common job lifecycle, progress events, retry semantics, and final output structure.

routermode flag
image bundlefast videoscript videoUGC
01
02
03
04
+5
queued

Image bundle

01

Storyboard concepts, scene image generation, then bundle finalization.

conceptsscene imagesfinalize
0:00fast cut0:30

Fast paced video

02

Cut storyboard, scene images and videos, then stitching.

storyboardscenesvideosstitch
script · 247 chars
tts · readytiming locked

Script to video

03

Script interpretation or segmentation, spoken media, then timed video.

scriptaudiotimed video
v1
selected
v3

UGC style

04

Prompt interpretation, spoken script and storyboard, media, final assembly.

promptscript + storymediaassemble
07Product fidelity loop

Fidelity is a pipeline stage, not a review step.

Outputs must remain visually faithful to the source product while still allowing creative variation. The pipeline separates product identity from output specific creative instructions and runs fidelity checks with controlled regeneration when assets drift.

  • product only
  • with model
  • mixed scenes
Loop with controlled attemptsmax 3
Source product
Generate asset
Fidelity check
Accept
Regenerate
Pass: asset matches the source product reference.
Drift: regenerate with adjusted prompt and constraints.
Cap: bounded attempts, then surface a structured error.
08Technical highlights
contractv2
job_type:"marketing_output"
idempotency_key:"7b22…"
product_id:"prod_91"
mode:"fast_video"
prompt:"…"
settings:{ duration, aspect }
retry:null

Polymorphic job contracts

Creation, output generation, and retries share contracts while keeping payload validation strict.

routermode flag
image bundlefast videoscript videoUGC

Output mode routing

Image bundle, fast paced video, script to video, and UGC under shared lifecycle semantics.

scene_1.imageok
scene_2.imageok
scene_2.videorunning
scene_3.imagequeued
stitchpending

Intermediate asset tracking

Scene images, videos, scripts, audio, transcripts, and storyboard metadata reported incrementally.

source
check0.87
outputpass

Product fidelity loop

Output generation validates consistency and performs controlled regeneration when assets drift.

s1
s2
s3
s4
s5
resumefrom s3s1, s2 kept

Scene aware retries

Image and video stages can resume from a specific scene order without discarding usable work.

orchestration
imagevideoaudiofidelitystitchlip-sync
capability interface

Provider isolation

Orchestration depends on media capabilities, not account or vendor specific details.

09Retry design

Retry context carries stage and scene order.

Useful for operational recovery and for creative iteration. Avoids full pipeline reruns when only one scene or stage needs regeneration.

  • 01
    Neutral product imageRerun cleanup without touching metadata or storyboard.
  • 02
    Storyboard suggestionsRegenerate while preserving extracted product metadata.
  • 03
    Image from sceneRetry image generation from a specific scene order.
  • 04
    Video from sceneRetry video generation from a specific scene order.
  • 05
    Resume from stagePick up an output pipeline at a named stage.
10Reliability patterns
K
01

Idempotent submission

Duplicate internal requests resolve predictably.

S
02

Durable job steps

Every major stage records status, inputs, outputs, errors.

E
03

Callback outbox

Outbound events persisted for delivery tracking and retry.

Q
04

Queue isolation

Marketing workers scale separately from avatar and callback.

P
05

Provider adapters

Orchestration independent from provider request details.

F
06

Snapshot based jobs

Execution from captured product state, not product DB models.

X
07

Failure localization

Retries start at point of failure, not whole campaign.

11Privacy & security
Sanitized for portfolio

Private internal APIs and service to service authentication.

Secrets, provider credentials, storage configuration, callback destinations, and account specific values come from environment configuration and are not included here. Job payloads carry only the product and output snapshots needed for generation. The service does not require access to product user credentials or the product database.

12Outcome

A cleaner platform for product creative generation.

AI execution was separated from the product backend. The Gen AI service now owns generation orchestration, retries, provider integration, progress state, and event delivery, while the core backend stays focused on product records, permissions, and public APIs. Extensible by output mode, observable by stage, resilient to provider failures, and structured for fast creative iteration.

ExtensibleNew output modes are routing and pipeline concerns.
ObservablePer stage status, intermediate assets, structured errors.
ResilientScene aware retries and provider isolation.
IterableReusable checkpoints across creative attempts.
Case study · 02 of 04 · ai-marketing