How I Built a Multi-Agent Prompt Engineering Runbook with pydantic-ai and FastAPI

Most teams building AI tooling eventually hit the same wall: they have five different prompt patterns scattered across Notion docs, Slack threads, and someone's local Python file. Nobody agrees on the output format. The SWOT analysis prompt returns markdown sometimes and JSON sometimes. The code reviewer just dumps text. When something breaks in production, you spend 40 minutes figuring out which version of the prompt was actually running.

This article walks through an architecture that solves that problem using pydantic-ai, FastAPI, and structured Pydantic outputs. The result is a prompt engineering runbook: a single deployable service that handles SWOT analysis, social post generation, code review, multi-format summarisation, and a decision framework, all returning typed, validated responses.

The Problem: Prompt Sprawl Kills Reliability

Here is a concrete scenario that plays out in teams of five or more engineers.