AI Agent Case Study: Proposal Writer Agent — LangGraph, FastAPI, Celery & Postgres Build

Interactive click-to-advance reader covering a real production AI-agent build: a Proposal Writer Agent for consulting and engineering firms. 12 slides covering the business problem, Next.js 15 + FastAPI + Celery + PostgreSQL/Redis architecture, the full 13-node LangGraph pipeline (requirement extraction, scope and timeline, executive summary, project scope, technical section, risks, team structure, pricing, SOW, quality flags, internal notes), async Celery orchestration, the mandatory human approval gate before export, the PostgreSQL data model and client/template management, and the frontend generation UX.

← AI Studio
About this tool — how it works & FAQOpen ▾Close ▴

AI Agent Case Study: Proposal Writer Agent

A real production AI-agent build, end to end — an AI operating system for consulting firms that drafts a full engineering proposal from meeting notes. Next.js 15 frontend, FastAPI backend, a 13-node LangGraph pipeline, Celery + Redis async processing, PostgreSQL persistence, and a mandatory human approval gate before anything reaches a client.

12 slides covered

Ch 1: The business problem — why proposal drafting consumes senior consulting hours before an engagement is even won. Ch 2: System architecture — Next.js 15, FastAPI, Celery/Redis, PostgreSQL, and where the LLM sits in the stack. Ch 3: The 13-node LangGraph pipeline and the shared ProposalState TypedDict. Ch 4: Ingestion, requirement extraction, scope, and timeline nodes. Ch 5: Drafting the executive summary, project scope, and technical section. Ch 6: Assumptions/risks, team structure, and pricing nodes — including the disclaimer baked into the pricing prompt itself. Ch 7: SOW generation, the missing-info quality-review node, and confidential internal notes. Ch 8: Running the pipeline asynchronously with Celery — task config, retries, and progress reporting. Ch 9: The human-in-the-loop approval workflow and the 403 export gate. Ch 10: The full PostgreSQL data model, client records, and template management. Ch 11: The Next.js polling UX and the production security model.

A direct companion to the RFP Compliance Generator case study

The RFP Compliance Generator reader in this studio explicitly scoped itself to compliance-matrix extraction and named proposal drafting, pricing, and SOW generation as deliberately excluded — deferred to a separate case study. This reader is that case study: the same "real production AI agent" format, applied to the complementary half of the problem — not finding what a client needs, but drafting the response to it.

What makes this a real case study, not a demo

Every code sample is real, working code from the actual project: the 13 LangGraph node functions verbatim (including the exact system prompts and JSON contracts each one enforces), the Celery task that runs the pipeline in the background, the FastAPI approval-review endpoint and its 403 export gate, and the SQLAlchemy Proposal and Approval models. Nothing is paraphrased into pseudocode.

Why the human approval gate is architectural, not cosmetic

The system enforces "no export before approval" as a 403 HTTPException inside the export endpoint itself, not as a disabled button in the UI. Combined with an immutable activity log and a full JSON version-snapshot on every edit, this is a pattern worth generalizing to any AI agent whose output is client-facing or carries financial commitments: put the compliance check in the API layer, where a compromised frontend cannot bypass it.

Frequently asked questions

What does this AI agent actually do?

It takes meeting notes, a discovery-call transcript, or a project description and drafts a complete engineering consulting proposal — executive summary, project scope, technical requirements and architecture recommendations, assumptions and risks, team structure, a pricing estimate, and a full Statement of Work — through a 13-node LangGraph pipeline. It never lets that draft reach a client without a human explicitly approving it first.

How is this different from the RFP Compliance Generator case study in this studio?

The RFP Compliance Generator reads a federal solicitation and extracts a structured compliance matrix — it deliberately does not draft proposal text or pricing. This system is the deferred complement: it starts once requirements are known and drafts the actual proposal content, pricing, and SOW. Together they sketch two halves of an "AI operating system" for a consulting or engineering firm.

What is the actual tech stack used in this case study?

Next.js 15 with TypeScript, TailwindCSS, shadcn/ui, and Zustand for the frontend; FastAPI with SQLAlchemy 2.0 (async) and Pydantic v2 for the backend; LangGraph 0.2 and LangChain orchestrating OpenAI GPT-4o for the 13-node pipeline; Celery with Redis for asynchronous background job processing; and PostgreSQL 16 with Alembic migrations for persistence.

Why does the pipeline run in Celery instead of directly inside the API request?

The full 13-node LangGraph chain takes roughly 60-90 seconds on GPT-4o. Running that inside a single HTTP request risks timeouts and gives no retry story if it fails partway through. Instead, the FastAPI endpoint queues a Celery task and returns immediately; the worker runs the pipeline, reports progress through Celery's own state machine, and persists results to PostgreSQL, which the frontend polls until the draft is ready.

How does the system prevent an AI-drafted proposal from being sent to a client without review?

The export endpoint raises a 403 HTTPException unless the proposal's status is "approved" or "in_review" — a real API-level gate, not just a disabled button in the UI. A proposal only reaches "approved" status through the dedicated review endpoint, which requires a human reviewer to explicitly submit an approve/reject/changes-requested decision.

Related tools & guides