Inspiration

Commercial legal, procurement, and risk teams lose millions of dollars annually not because they fail to read agreements, but because critical operational constraints slip through the cracks. Buried automatic renewal clauses with narrow 20-day notice windows, asymmetric third-party indemnifications, and uncapped liability ceilings hide across dozens of pages of dense legalese.

Today's commercial AI tools are fundamentally passive chatbots—they sit idly waiting for a human to ask a question. If an overworked counsel forgets to ask about an obscure cancellation deadline, the contract silently auto-renews for two more years. We built LexiParse specifically for the Taskmaster track to shift the paradigm: moving from reactive chat prompts to autonomous, unattended contract auditing that safeguards enterprise operations 24/7.

What it does

LexiParse is an autonomous AI contract workflow auditor that continuously ingests, evaluates, and monitors commercial agreements:

  1. Instant Handoff & Background Execution: The moment a PDF agreement is uploaded, LexiParse returns an immediate 200 OK and hands off the document to an asynchronous background worker on Google Cloud Run.
  2. Clause Extraction & Confidence Scoring: Powered by Gemini 3.5 Flash on Vertex AI, LexiParse extracts clauses, maps responsible parties, surfaces financial exposure, and scores its own extraction confidence.
  3. Confidence Review Queue: When extraction confidence falls below 75% or ambiguous legal phrasing is detected, the clause is automatically routed to a human-in-the-loop review queue for oversight rather than guessing.
  4. Proactive Anomaly & Renewal Alert Engine: Cross-checks notice deadlines and compares indemnity caps against historical portfolio medians in ClickHouse Cloud. If a contract contains an aggressive renewal window or an anomalous $200k exposure against a $37.5k median, LexiParse dispatches proactive alerts immediately with zero user prompts required.
  5. Interactive Google ADK Agent with SQL Transparency: Allows legal teams to drill down into portfolio risk through a Google Agent Development Kit (ADK) agent that executes read-only SQL queries against ClickHouse in real-time, displaying both formatted counsel and the exact underlying SQL query.

How we built it

  • AI & Reasoning Layer: Gemini 3.5 Flash on Google Vertex AI for low-latency clause extraction, semantic analysis, and structured JSON parsing.
  • Agent Orchestration: Google Agent Development Kit (ADK) with custom schema-validated tools (query_ch, get_contract_context, get_portfolio_benchmarks) for multi-step reasoning with verifiable SQL transparency.
  • Analytical Database: ClickHouse Cloud configured with thread-safe client management, analytical aggregations, and strict SELECT-only execution guards.
  • Backend Infrastructure: FastAPI deployed as a containerized service to Google Cloud Run (asia-southeast1) with dedicated IAM authentication (roles/aiplatform.user), warm instance scaling (--min-instances=1), and extended async timeouts (--timeout=600).
  • Frontend & Visuals: Next.js 14, TypeScript, and Tailwind CSS deployed to "Firebase Hosting".
  • Automated CI/CD: Hermetic test suite with 25 unit and API contract tests running on GitHub Actions with zero external credential dependencies.

Challenges we ran into

  1. Ensuring Thread Safety & Connection Pooling in Async Workers: ClickHouse HTTP clients can run into race conditions during concurrent background evaluations. We resolved this by implementing thread-local storage (threading.local) for isolated, resilient client reuse.
  2. Eliminating Scaffolding for Verifiable SQL Transparency: Getting the ADK agent to reliably pass the executed SQL query to the frontend without breaking tool execution required custom tool-call interceptors and dedicated session state management.
  3. Graceful Handling of Legal Ambiguity: Rather than forcing the model to hallucinate deterministic risk scores on truncated or ambiguous legal text, we designed the Confidence Review Queue to isolate low-confidence clauses (<75%) for manual legal review.

Accomplishments that we're proud of

  • True Autonomous Workflow: Created a complete, end-to-end unattended loop where high-exposure alerts and renewal warnings are generated before anyone touches a keyboard.
  • 100% Real, Deployed Infrastructure: Deployed live to Google Cloud Run and Firebase Hosting with zero mock APIs, zero hardcoded responses, and 25/25 passing automated tests.
  • Verifiable SQL Transparency: Displaying the exact SQL query executed by the ADK agent ensures full explainability for enterprise legal teams.

What we learned

  • Designing autonomous agents requires separating pure business logic (confidence evaluation, anomaly math) from network I/O to enable rock-solid unit testing and reliable CI workflows.
  • Gemini 3.5 Flash provides exceptional speed and nuance reasoning for multi-clause legal extraction, making real-time background processing practical at enterprise scale.

What's next for LexiParse - Autonomous AI Contract Analyst & Workflow Auditor

  • Automated Redline Suggestions: Generating tracked-changes .docx redlines that modify high-risk clauses to standard fallback language.
  • Webhook & Slack/Email Integrations: Dispatching proactive renewal alerts directly into enterprise communication channels 30 days before critical deadlines.
  • Multi-Jurisdiction Policy Rules: Allowing corporate compliance teams to define custom risk rules across US, EU (GDPR/EU AI Act), and APAC jurisdictions.

Built With

  • ai-agents
  • autonomous-workflows
  • clickhouse
  • clickhouse-cloud
  • fastapi
  • firebase-hosting
  • gemini-3.5-flash
  • github-actions
  • google-adk
  • google-cloud-iam
  • google-cloud-run
  • google-vertex-ai
  • legaltech
  • next.js
  • pydantic
  • pymupdf
  • pytest
  • python
  • react
  • rest-api
  • tailwind-css
  • typescript
Share this project:

Updates

Submission history