Project 10 / 10 · RAG & NLP
Text Summarization AI Agent
Autonomous agent on Groq Llama 3.3 70B that detects document domain, picks the summarisation strategy, scores with ROUGE-L and auto-retries on low quality.
01 / Context
The problem
The application treats summarization as a workflow rather than a single prompt, adapting strategy to document domain and checking output quality before accepting the result.
02 / System workflow
From input to output
- 01Text / PDF / URL
- 02Domain detection
- 03Strategy selection
- 04Streaming summary
- 05ROUGE-L check
- 06Retry or export
03 / Architecture
Inside the system
FastAPI accepts text, PDF, URL, batch, comparison, and autonomous-agent requests from a framework-free HTML, CSS, and JavaScript interface.
The agent measures document characteristics, selects a domain-aware prompt and token strategy, calls Groq Llama 3.3 70B, then evaluates ROUGE-L before retrying with an alternate strategy when needed.
PDF ingestion uses pdfplumber, URL extraction uses trafilatura, and token streaming returns the generated summary in real time.
04 / Engineering decisions
What shaped the build
Decision 01
Quality as a loop
ROUGE-L is part of the autonomous path, so a low-scoring first response can trigger another strategy without human intervention.
Decision 02
Multiple work modes
Separate tabs support focused summarization, side-by-side style comparison, batch jobs, browser-side evaluation, and the full agent flow.
Decision 03
Portable delivery
A single Docker image serves the API and interface on the Hugging Face runtime port.
05 / Evidence
Measured, not implied
4
Agent stages
Analyze, select strategy, summarize, and evaluate.
3
Input modes
Plain text, uploaded PDF, or fetched web URL.
5
Workflow tabs
Summarize, compare, batch, evaluate, and agent.
06 / Delivery
What shipped
- 01The REST surface includes health, model discovery, single, URL, PDF, batch, compare, and agent endpoints.
- 02Exports cover TXT, JSON, Markdown, and batch CSV; session history remains in the browser.
- 03GitHub Actions runs tests and linting, then deploys the Docker application to Hugging Face Spaces.
Constraint documented
The autonomous quality gate uses reference-based ROUGE-L, so its usefulness depends on whether reference text is available for the evaluation path.