Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions kits/home-maintenance-triage/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Lamatic credentials (from Settings → API Keys in Lamatic Studio)
LAMATIC_PROJECT_ENDPOINT=
LAMATIC_PROJECT_ID=
LAMATIC_PROJECT_API_KEY=

# Your deployed flow ID (from Flow → Details Panel → Flow ID)
NEXT_PUBLIC_LAMATIC_FLOW_ID=
164 changes: 164 additions & 0 deletions kits/home-maintenance-triage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Home Maintenance Triage

![Built with Lamatic](https://img.shields.io/badge/Built%20with-Lamatic-5B21B6?style=flat-square)
![Type: Kit](https://img.shields.io/badge/type-kit-0EA5E9?style=flat-square)
![Challenge](https://img.shields.io/badge/challenge-agentkit-F59E0B?style=flat-square)

> Describe any household issue and get a structured AI assessment — how serious it is, whether you need a professional, and what to do right now.

---

## The Problem

When something breaks at home, most people face the same uncertainty. Is this a small thing I can handle myself, or do I need to call someone today? Is it safe to wait a few days, or is this actually an emergency?

Getting this wrong in either direction has real consequences. Ignoring a slow gas leak or a sparking outlet can be dangerous. Panicking over a nail hole or a dripping faucet wastes time and money.

This kit gives homeowners a fast, structured way to understand what they are dealing with.

---

## What It Does

You describe the issue — a water stain, a strange smell, a noise from the AC — and the agent returns a structured report:

| Field | Description |
|-------|-------------|
| Severity | low, moderate, high, or emergency |
| Urgency | Plain-language timeframe for action |
| Professional needed | Yes or no, and which type |
| Safe next steps | Specific actions to take right now |
| Do not do | Things to avoid attempting yourself |
| Reasoning | Why the agent assessed it this way |
| Disclaimer | Always included — this is informational, not an inspection |

### Safety-first design

The agent is built around a few hard rules:

- It always rounds up on severity when the situation is ambiguous
- For emergencies, safe next steps are hazard-specific: **gas smell** — evacuate and call emergency services only (never touch switches or breakers); **fire or smoke** — evacuate and call emergency services; **electrical fault** — evacuate, call emergency services, then isolate the breaker only if safely reachable, then contact a licensed electrician
- It never gives DIY instructions for electrical, gas, or structural problems
- It never claims to replace a licensed inspector or professional

---

## How It Works

```
User describes the issue (text + optional photo URL or uploaded image)
|
API Request node (Lamatic trigger)
|
Generate Text node (vision LLM)
— analyzes description and image with a safety-first system prompt
|
API Response node
|
Next.js frontend renders the structured result
```

One flow, one LLM call, clean JSON output. Public HTTPS photo URLs and base64 image data URIs (`data:image/...`) are supported directly.

---

## Setup

### Prerequisites

- A [Lamatic.ai](https://lamatic.ai) account (free tier works)
- A vision-capable model configured in Lamatic Studio — GPT-4o, Gemini 1.5 Pro, or Claude 3.5 Sonnet work well
- Node.js 20.9.0 or later

### Step 1 — Build the Lamatic Flow

1. Log in to [studio.lamatic.ai](https://studio.lamatic.ai)
2. Create a new project and a new flow
3. Add three nodes:
- **API Request** — trigger node, accepts `issueDescription` (string) and `imageUrl` (string, optional)
- **Generate Text** — LLM node, select a vision-capable model, paste the system prompt from `prompts/home-maintenance-triage_generate-text_system.md`
- **API Response** — maps `output` to `{{LLMNode_501.output.generatedResponse}}` (or your Studio-assigned LLM node output)
4. Connect them in order: API Request > Generate Text > API Response
5. Deploy the flow and copy the Flow ID from the details panel

### Step 2 — Configure the App

```bash
cd apps
cp .env.example .env.local
```

Open `.env.local` and fill in your four credentials:

```
LAMATIC_PROJECT_ENDPOINT=https://your-project.lamatic.ai
LAMATIC_PROJECT_ID=your-project-id
LAMATIC_PROJECT_API_KEY=your-api-key
NEXT_PUBLIC_LAMATIC_FLOW_ID=your-flow-id
```

### Step 3 — Run Locally

```bash
npm install
npm run dev
```

Open [http://localhost:3000](http://localhost:3000)

### Step 4 — Deploy (Optional)

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/sage106/AgentKit/tree/main/kits/home-maintenance-triage/apps)

Set the same four environment variables in your Vercel project settings.

---

## Example

**Input:**
```json
{
"issueDescription": "Wall outlet sparked when I plugged something in. I can smell something burning near it.",
"imageUrl": "https://example.com/outlet-photo.jpg"
}
```

**Output:**
```json
{
"category": "electrical",
"severity": "emergency",
"urgency": "Stop and act immediately",
"professionalNeeded": true,
"professionalType": "licensed electrician",
"safeNextSteps": [
"Evacuate or step back from the immediate area if smoke or burning smell is active",
"Call emergency services immediately",
"Turn off power to that circuit at the breaker only if you can safely reach the panel without crossing the hazard",
"Contact a licensed electrician once the immediate hazard is addressed"
],
"doNotDo": [
"Do not touch the outlet",
"Do not attempt to inspect or repair this yourself",
"Do not ignore the burning smell"
],
"reasoning": "Sparking combined with a burning smell indicates an active electrical fault and a fire risk. This needs immediate professional attention.",
"disclaimer": "This is an informational assessment, not a professional inspection. For anything electrical, gas-related, or structural, or if you are unsure, contact a licensed professional."
}
```

---

## Disclaimer

This tool provides informational triage only. It is not a substitute for a licensed inspector, electrician, plumber, or structural engineer. For any electrical, gas, or structural concern — or if you are unsure — contact a qualified professional.

---

## Notes

- The flow uses a single LLM call. No RAG, no multi-step pipeline. For a triage task like this, keeping it simple is the right call.
- The LLM node must be a vision-capable model. Text-only models will still work when no image is provided but cannot analyze photos.
- Image URLs are passed directly to the vision model. No file storage is needed.
- The system prompt instructs the model to round up on severity when uncertain. This is intentional — false reassurance is more dangerous than over-caution.
94 changes: 94 additions & 0 deletions kits/home-maintenance-triage/agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Home Maintenance Triage

## What this agent does

Home Maintenance Triage takes a description of a household problem — a leak, a strange smell, a noise from the AC, a discoloration on the wall — and returns a structured, cautious assessment of how serious it is and what the person should do next.

The output is always honest about what the agent can and cannot determine. When evidence is unclear, it defaults to the more cautious interpretation. It never gives repair instructions for anything electrical, gas-related, or structural.

## What it returns

Given an issue description and an optional photo URL, the agent produces:

- **category** — the type of problem: water damage, electrical, structural, mold, pest, cosmetic, or other
- **severity** — low, moderate, high, or emergency
- **urgency** — a single sentence explaining the timeframe for action
- **professionalNeeded** — whether a licensed professional is required
- **professionalType** — which kind, if applicable (plumber, electrician, HVAC technician, structural engineer, etc.)
- **safeNextSteps** — two to five concrete actions the person can take right now
- **doNotDo** — things they should explicitly avoid attempting themselves
- **reasoning** — one or two sentences explaining the assessment
- **disclaimer** — a fixed note that this is informational, not a professional inspection

## What it will not do

- Give confident DIY repair instructions for electrical, gas, or structural problems
- Downplay a potential hazard to seem more helpful or reassuring
- Fabricate details that are not visible in the image or stated in the description
- Act as a substitute for a licensed inspector, electrician, plumber, or structural engineer

For emergencies, safe next steps are hazard-specific:

- **Active gas smell:** (1) Evacuate the area immediately; (2) Contact emergency services or your gas utility provider. Do not touch any switches, appliances, or breakers — any spark can ignite gas.
- **Fire or smoke:** (1) Evacuate immediately; (2) Contact emergency services (fire department).
- **Active sparking or electrical fault:** (1) Evacuate or step back from the area; (2) Contact emergency services; (3) Turn off the breaker for that circuit only if you can safely reach the panel without crossing the hazard; (4) Contact a licensed electrician.

## Example — water damage

**Input:** photo of a brown stain spreading across a ceiling, description: "noticed it a week ago, seems to be growing"

**Output:**
```json
{
"category": "water damage",
"severity": "moderate",
"urgency": "Address within the next few days",
"professionalNeeded": true,
"professionalType": "plumber",
"safeNextSteps": [
"Check the room or floor above for a leaking pipe or fixture",
"Place a container under the stain if it is actively dripping",
"Take photos to track whether the stain grows"
],
"doNotDo": ["Do not cut into the ceiling to inspect it yourself"],
"reasoning": "A growing stain suggests an active, ongoing leak rather than a one-time incident. The source needs to be found and stopped.",
"disclaimer": "This is an informational assessment, not a professional inspection. For anything electrical, gas-related, or structural, or if you are unsure, contact a licensed professional."
}
```

## Example — electrical emergency

**Input:** description: "wall outlet is sparking and I can smell something burning"

**Output:**
```json
{
"category": "electrical",
"severity": "emergency",
"urgency": "Stop and act immediately",
"professionalNeeded": true,
"professionalType": "licensed electrician",
"safeNextSteps": [
"Evacuate or step back from the immediate area if smoke or burning smell is active",
"Call emergency services immediately",
"Turn off power to that circuit at the breaker only if you can safely reach the panel without crossing the hazard",
"Contact a licensed electrician once the immediate hazard is addressed"
],
"doNotDo": [
"Do not touch the outlet",
"Do not attempt to inspect or repair this yourself"
],
"reasoning": "Sparking combined with a burning smell indicates an active electrical fault and a fire risk.",
"disclaimer": "This is an informational assessment, not a professional inspection. For anything electrical, gas-related, or structural, or if you are unsure, contact a licensed professional."
}
```

## How the flow works

The flow has three nodes:

1. **API Request** — trigger node that receives `issueDescription` (required) and `imageUrl` (optional)
2. **Generate Text** — a vision-capable LLM node that analyzes the input using the system prompt in `prompts/home-maintenance-triage_generate-text_system.md`
3. **API Response** — returns the generated JSON string as the `output` field

The system prompt encodes the severity logic, safety escalation rules, and output contract directly. The model is instructed to return only valid JSON with no surrounding text.
7 changes: 7 additions & 0 deletions kits/home-maintenance-triage/apps/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Lamatic credentials (from Settings → API Keys in Lamatic Studio)
LAMATIC_PROJECT_ENDPOINT=
LAMATIC_PROJECT_ID=
LAMATIC_PROJECT_API_KEY=

# Your deployed flow ID (from Flow → Details Panel → Flow ID)
NEXT_PUBLIC_LAMATIC_FLOW_ID=
34 changes: 34 additions & 0 deletions kits/home-maintenance-triage/apps/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# dependencies
node_modules/
.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
6 changes: 6 additions & 0 deletions kits/home-maintenance-triage/apps/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
/* config options here */
};

export default nextConfig;
Loading
Loading