← Portfolio/The Law Practice Exchange
Legal / M&A MarketplaceAI + Automation

30 Minutes to 5 Minutes — Mission-Critical AI System Rebuilt Before API Deprecation

The Law Practice Exchange

30 min ? 5 minexecution time (83% faster)
Zerotimeouts — no execution limit in n8n
Parallelprocessing — independent sub-tasks run simultaneously
Future-proofedoff deprecated API before Aug 2024 deadline

The Law Practice Exchange runs the #1 marketplace for buying and selling law firms in the US. Their AI-powered valuation system was timing out at 30+ minutes, failing mid-process regularly, and 4 months from complete breakage due to OpenAI API deprecation. We rebuilt the entire system: new API, parallel processing, background execution, and vector stores for better AI accuracy.

The Problem

The core product was slow, breaking regularly, and 4 months from complete failure.

LPE's law firm valuation system was built on Google Apps Script and the OpenAI Assistants API. Both choices created cascading problems.

Google Apps Script has a hard 30-minute execution limit. The valuation workflow consistently ran 30+ minutes and frequently hit the timeout — leaving valuations incomplete. The workflow was also sequential: if any step failed, everything after it failed. There was no parallel processing, no retry logic, no graceful recovery.

The OpenAI Assistants API that the AI valuation agent ran on was announced as deprecated, with the shutdown scheduled for August 2024 — 4 months away at the time. Without a rebuild, the entire system would stop working completely.

Users had to keep their browser tab open throughout the process. If the tab closed, the process failed. AI quality was also inconsistent — the model had insufficient context (no vector stores) and was making errors in deliverables sent to paying clients.

  • Execution time 30+ minutes — frequently hitting Apps Script timeout
  • Sequential workflow — one failure breaks all downstream steps
  • User must keep browser tab open or process fails
  • AI making errors in client deliverables due to insufficient context
  • OpenAI Assistants API deprecating August 2024 — 4 months to rebuild or lose the product

What We Built

Complete system rebuild: migration to n8n for background execution, OpenAI Responses API with vector stores, and parallel processing throughout.

01

Backend migration: Apps Script ? n8n

Moved the entire workflow out of Google Apps Script into n8n. n8n runs server-side with no execution time limit. Workflows run in the background — users trigger the valuation and can close their browser immediately. They receive a notification when it's complete.

02

API migration: Assistants API ? Responses API + Vector Stores

Migrated from the deprecating OpenAI Assistants API to the OpenAI Responses API. Added vector stores loaded with deep context: historical valuation data, market comparables, legal practice area benchmarks, and domain-specific best practices. The AI now has dramatically more relevant context to work with on each valuation.

03

Parallel processing architecture

Rewired the workflow for parallel execution. Steps that don't depend on each other now run simultaneously. Financial data collection, client data retrieval, and market data lookups all happen at the same time instead of sequentially. This alone cut execution time by more than half.

04

Webhook-based execution model

The user triggers the workflow via a minimal Apps Script UI button. A webhook fires to n8n. The entire process runs in the background. The user gets a notification — email or Slack — when the valuation is complete and ready to review.

Technical Breakdown

Old stackGoogle Apps Script (30-min limit, browser-dependent) + OpenAI Assistants API (deprecated Aug 2024) + sequential workflow
New stackn8n (no execution limits, background processing) + OpenAI Responses API + Vector Stores + minimal Apps Script UI triggers
Parallel processingIndependent sub-processes run simultaneously — financial data, client data, market data all pulled in parallel; analysis steps run in parallel where possible
Vector storesLoaded with historical valuations, practice area benchmarks, market comparables, and domain knowledge — AI has full context on every run
Execution modelWebhook-based — user triggers, closes tab, gets notified when done. Zero dependency on browser session.

Ready to be next?

Tell me where your biggest bottleneck is.

30-minute audit call. I'll map out exactly what to automate, what it costs, and what you'll get back. No fluff.