Skip to content
reaatech

Files · Automated Review Response Agent for Independent Restaurants

71 (1 binary, 572.0 kB total)attempt 1

README.md·2891 B·markdown
markdown
# Automated Review Response Agent for Independent Restaurants
 
> Never miss a Yelp or Google review again with consistent, on-brand replies.
 
A tutorialized reference solution from [reaatech.com](https://reaatech.com), demonstrating how to build production-grade AI systems with the `@reaatech/*` package family.
 
## How it works
 
The pipeline processes online reviews through four stages:
 
1. **Review ingestion** — normalizes Yelp, Google, and TripAdvisor formats into a canonical `RestaurantReview` shape via `@reaatech/agent-mesh` types and Zod schemas.
2. **Guardrail filtering** — passes review content through an `@reaatech/guardrail-chain` pipeline to block profanity, toxicity, and off-tone inputs before the LLM is invoked.
3. **LLM generation** — builds a brand-aware system prompt from `BrandVoiceConfig` (restaurant name, tone, values), retrieves prior reviewer context via `@reaatech/agent-memory`, and calls the Vercel AI SDK (`ai` + `@ai-sdk/openai`) to generate an appropriate on-brand response.
4. **Cost tracking + response delivery** — records each LLM call as a `CostSpan` via `@reaatech/llm-cost-telemetry`, persists extracted facts to long-term memory, formats the response in MCP-compatible `ToolResponse` shape via `@reaatech/mcp-server-core`, and returns it over HTTP.
 
## Quick start
 
```bash
pnpm install
# Set your OpenAI API key
export OPENAI_API_KEY=<your-openai-key>
pnpm dev
```
 
Then POST a review to generate a response:
 
```bash
curl -X POST http://localhost:3000/api/reviews \
  -H 'Content-Type: application/json' \
  -d '{
    "review": {
      "id": "1",
      "platform": "yelp",
      "restaurantId": "r1",
      "rating": 5,
      "content": "Amazing pasta!",
      "authorName": "Jane",
      "reviewDate": "2026-06-25"
    },
    "brand": {
      "restaurantId": "r1",
      "restaurantName": "Luigi'\''s",
      "brandTone": "warm and friendly",
      "brandValues": ["family", "tradition"],
      "signatureName": "Luigi",
      "platforms": ["yelp"]
    }
  }'
```
 
### Environment variables
 
| Variable | Required | Description |
|---|---|---|
| `OPENAI_API_KEY` | Yes | API key for OpenAI (used by `@ai-sdk/openai`) |
 
### Vendored packages
 
This recipe wires 6 REAA packages: `@reaatech/agent-mesh`, `@reaatech/guardrail-chain`, `@reaatech/llm-router-core`, `@reaatech/llm-cost-telemetry`, `@reaatech/mcp-server-core`, and `@reaatech/agent-memory`.
 
## Running locally
 
```bash
pnpm install
pnpm test            # vitest run with coverage
pnpm dev             # next dev
```
 
## Project layout
 
```
app/                  Next.js App Router pages + API routes
src/                  services, lib, adapters
tests/                vitest suite (mirrors src/)
packages/             API references for every dependency (read these first)
DEV_PLAN.md           build plan for this recipe
```
 
## License
 
MIT — see [LICENSE](./LICENSE).