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.
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.
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.
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.
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.
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.
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.
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.
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.
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.