ProjectBuild an Agentic Content Studio: the explanation · Module 10: The strategist, the designer and JSON repair · part 12 of 22
Part 12 · Module 10: The strategist, the designer and JSON repair

Module 10: The strategist, the designer and JSON repair

26 min read·
About 50 minutes · Needs: Module 7 (the deck spec), Module 8 (the LangGraph pipeline), Module 3 (the Ollama model and why MLX has no structured outputs) · Code: backend/app/ai/prompts.py, backend/app/ai/agents/strategist.py, backend/app/ai/agents/designer.py, backend/app/ai/jsonfix.py

Where this fits

WHERE THIS FITS Slidesmith Studio this module BROWSER React FRONT DOOR AND API nginx, FastAPI BACKGROUND AGENTS LangGraph MODELS Ollama RENDERING Playwright DATA Postgres 17 OPERATIONS evals, Docker, Cloud Run Studio app React pages /render page same renderer nginx proxy, headers Auth sessions, CSRF Brand kit onboarding, uploads Projects deck spec, edits Job runner progress over SSE Research search, facts Strategist outline Designer slide JSON Check fit, else repair LangGraph pipeline state graph, JSON repair Ideas post ideas from pillars qwen3.8:27b Ollama, local GPU Web search Ollama API Chromium render, measure Exports PDF, PNG, ZIP, HTML PostgreSQL users, decks, jobs Uploads disk or GCS Evaluation suites, gate Insights usage, timings Containers Docker Compose Deploy Cloud Run, CI/CD
The strategist and the designer (blue: this module) turn prompts into the outline and the slides. The model (amber) writes text; everything after it is our code.

The pipeline calls two writing agents. The content strategist turns the topic into an outline of exactly N slides; the designer turns each outline item into one slide of the deck spec. Both talk to the same local model, and both face the same problem: the model writes text, but the rest of the system needs valid JSON in an exact shape. This module is about the prompts that ask for that shape and the code that makes sure of it.

The rest of this project is yours to keep

This project is bought on its own, once, and stays readable afterwards, including the parts added to it later.

Or open everything with a plan