Skip to content
reaatech

Files · Plan Takeoff to Subcontractor RFP Agent for GCs

75 (1 binary, 727.5 kB total)attempt 1

README.md·2153 B·markdown
markdown
# Plan Takeoff to Subcontractor RFP Agent for GCs
 
> Convert plan sets and spec docs into a bill of materials and RFP drafts in minutes, not days.
 
## Architecture
 
This project implements a document-pipeline agent that:
1. **Extracts** text from uploaded PDF plan sets using `unpdf`
2. **Parses** the text into structured sections using `@reaatech/agents-markdown-parser`
3. **Analyzes** takeoff data — extracts bill of materials from specification tables, with LLM fallback for unstructured text via the Vercel AI SDK (`ai` + `@ai-sdk/openai`)
4. **Retrieves** project context from long-term memory using `@reaatech/agent-memory` and `@reaatech/agent-memory-retrieval`
5. **Generates** RFP drafts using `generateText` with structured output (`Output.object`)
6. **Traces** pipeline execution with Langfuse observability
 
## API Endpoints
 
| Method | Path | Description |
|--------|------|-------------|
| POST | `/api/takeoff` | Upload PDF plan sets → returns bill of materials |
| POST | `/api/rfp` | Generate RFP from takeoff data |
| GET | `/api/rfp/:id` | Retrieve a generated RFP (future) |
| GET | `/api/health` | Health check |
 
## Setup
 
```bash
pnpm install
cp .env.example .env
# Edit .env with your API keys
pnpm test            # Run tests with coverage
pnpm dev             # Start development server
```
 
## Environment Variables
 
| Variable | Description |
|----------|-------------|
| `OPENAI_API_KEY` | OpenAI API key (required for LLM features) |
| `LANGFUSE_PUBLIC_KEY` | Langfuse public key (optional, enables tracing) |
| `LANGFUSE_SECRET_KEY` | Langfuse secret key |
| `LANGFUSE_BASE_URL` | Langfuse base URL |
 
## REAA Packages Used
 
- `@reaatech/agents-markdown` — Core domain types and schemas
- `@reaatech/agents-markdown-parser` — Markdown section and table parsing
- `@reaatech/agent-mesh` — Request/context envelope validation
- `@reaatech/agent-mesh-router` — Turn entry helpers for pipeline logging
- `@reaatech/agent-memory` — Long-term memory with LLM-powered extraction
- `@reaatech/agent-memory-retrieval` — Context injection for RFP generation prompts
 
## License
 
MIT — see [LICENSE](./LICENSE).