Files · AWS Bedrock Knowledge Agent for Buildium Tenant Self-Service
71 (1 binary, 643.7 kB total)attempt 1
README.md·2745 B·markdown
markdown
# AWS Bedrock Knowledge Agent for Buildium Tenant Self-Service
> Answer tenant questions about leases, payments, and maintenance schedules by pulling real‑time data from Buildium and a knowledge base of property documents.
A tutorialized reference solution from [reaatech.com](https://reaatech.com), demonstrating how to build production-grade AI systems with the `@reaatech/*` package family.
## 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
```
## Architecture
POST /api/chat → KnowledgeAgent → Buildium REST API + AgentMemory retrieval + Bedrock LLM + Qdrant cache + DynamoDB sessions + structured-repair output → JSON response
## Prerequisites
- AWS account with Bedrock, DynamoDB access
- Buildium API key
- Qdrant instance (local or cloud)
- OpenAI API key for embeddings
## Environment Variables
| Variable | Description | Example |
|---|---|---|
| AWS_REGION | AWS region for Bedrock | us-east-1 |
| AWS_ACCESS_KEY_ID | AWS access key | (your key) |
| AWS_SECRET_ACCESS_KEY | AWS secret key | (your secret) |
| BUILDIUM_API_KEY | Buildium REST API key | (your key) |
| BUILDIUM_API_BASE_URL | Buildium API base URL | https://api.buildium.com |
| QDRANT_URL | Qdrant server URL | http://localhost:6333 |
| QDRANT_API_KEY | Qdrant API key | (optional) |
| OPENAI_API_KEY | OpenAI API key for embeddings | (your key) |
| LANGFUSE_PUBLIC_KEY | Langfuse public key | (your key) |
| LANGFUSE_SECRET_KEY | Langfuse secret key | (your secret) |
| LANGFUSE_HOST | Langfuse host | https://cloud.langfuse.com |
| SESSION_TABLE_NAME | DynamoDB table for sessions | sessions |
| BEDROCK_MODEL_ID | Bedrock model ID | anthropic.claude-sonnet-4-v1:0 |
| HEALTH_PORT | Express health server port | 3001 |
## API Reference
### POST /api/chat
Request body:
```json
{
"sessionId": "optional-existing-session-id",
"message": "What is my current lease balance?",
"tenantId": "tenant-123",
"propertyId": "optional-property-id"
}
```
Response (200):
```json
{
"reply": "Your current lease balance is $0.",
"sessionId": "sess-uuid",
"sources": [{ "title": "Lease", "excerpt": "..." }],
"cost": { "inputTokens": 15, "outputTokens": 25, "costUsd": 0.00012 }
}
```
Error (400):
```json
{ "error": "Validation failed", "details": [...] }
```
Error (500):
```json
{ "error": "Internal error" }
```
## License
MIT — see [LICENSE](./LICENSE).