From 363eff2adb44def4aa5f4a0d662a9810d7ea5e00 Mon Sep 17 00:00:00 2001 From: siddhant-bagga Date: Sun, 19 Apr 2026 04:26:36 +0530 Subject: [PATCH 01/26] feat: add time-series-preprocessor agent kit --- .../time-series-preprocessor/.env.example | 4 + .../time-series-preprocessor/.gitignore | 27 + .../time-series-preprocessor/README.md | 162 ++ .../actions/orchestrate.ts | 27 + .../time-series-preprocessor/app/globals.css | 15 + .../time-series-preprocessor/app/layout.tsx | 24 + .../time-series-preprocessor/app/page.tsx | 225 +++ .../time-series-preprocessor/components.json | 21 + .../components/header.tsx | 47 + .../components/theme-provider.tsx | 11 + .../components/ui/accordion.tsx | 66 + .../components/ui/alert-dialog.tsx | 157 ++ .../components/ui/alert.tsx | 66 + .../components/ui/aspect-ratio.tsx | 11 + .../components/ui/avatar.tsx | 53 + .../components/ui/badge.tsx | 46 + .../components/ui/breadcrumb.tsx | 109 ++ .../components/ui/button-group.tsx | 83 + .../components/ui/button.tsx | 60 + .../components/ui/calendar.tsx | 213 +++ .../components/ui/card.tsx | 92 ++ .../components/ui/carousel.tsx | 241 +++ .../components/ui/chart.tsx | 353 +++++ .../components/ui/checkbox.tsx | 32 + .../components/ui/collapsible.tsx | 33 + .../components/ui/command.tsx | 184 +++ .../components/ui/context-menu.tsx | 252 +++ .../components/ui/dialog.tsx | 143 ++ .../components/ui/drawer.tsx | 135 ++ .../components/ui/dropdown-menu.tsx | 257 ++++ .../components/ui/empty.tsx | 104 ++ .../components/ui/field.tsx | 244 +++ .../components/ui/form.tsx | 167 ++ .../components/ui/hover-card.tsx | 44 + .../components/ui/input-group.tsx | 169 ++ .../components/ui/input-otp.tsx | 77 + .../components/ui/input.tsx | 21 + .../components/ui/item.tsx | 193 +++ .../components/ui/kbd.tsx | 28 + .../components/ui/label.tsx | 24 + .../components/ui/menubar.tsx | 276 ++++ .../components/ui/navigation-menu.tsx | 166 ++ .../components/ui/pagination.tsx | 127 ++ .../components/ui/popover.tsx | 48 + .../components/ui/progress.tsx | 31 + .../components/ui/radio-group.tsx | 45 + .../components/ui/resizable.tsx | 56 + .../components/ui/scroll-area.tsx | 58 + .../components/ui/select.tsx | 185 +++ .../components/ui/separator.tsx | 28 + .../components/ui/sheet.tsx | 139 ++ .../components/ui/sidebar.tsx | 726 +++++++++ .../components/ui/skeleton.tsx | 13 + .../components/ui/slider.tsx | 63 + .../components/ui/sonner.tsx | 25 + .../components/ui/spinner.tsx | 16 + .../components/ui/switch.tsx | 31 + .../components/ui/table.tsx | 116 ++ .../components/ui/tabs.tsx | 66 + .../components/ui/textarea.tsx | 18 + .../components/ui/toast.tsx | 129 ++ .../components/ui/toaster.tsx | 35 + .../components/ui/toggle-group.tsx | 73 + .../components/ui/toggle.tsx | 47 + .../components/ui/tooltip.tsx | 61 + .../components/ui/use-mobile.tsx | 19 + .../components/ui/use-toast.ts | 191 +++ .../time-series-preprocessor/config.json | 22 + .../time-series-preprocessor/config.json | 122 ++ .../time-series-preprocessor/inputs.json | 26 + .../flows/time-series-preprocessor/meta.json | 12 + .../hooks/use-mobile.ts | 19 + .../hooks/use-toast.ts | 191 +++ .../lib/lamatic-client.ts | 67 + .../time-series-preprocessor/lib/utils.ts | 6 + .../time-series-preprocessor/next.config.mjs | 11 + .../package-lock.json | 1356 +++++++++++++++++ .../time-series-preprocessor/package.json | 27 + .../postcss.config.js | 6 + .../tailwind.config.js | 11 + .../time-series-preprocessor/tsconfig.json | 23 + package-lock.json | 6 + 82 files changed, 8913 insertions(+) create mode 100644 kits/automation/time-series-preprocessor/.env.example create mode 100644 kits/automation/time-series-preprocessor/.gitignore create mode 100644 kits/automation/time-series-preprocessor/README.md create mode 100644 kits/automation/time-series-preprocessor/actions/orchestrate.ts create mode 100644 kits/automation/time-series-preprocessor/app/globals.css create mode 100644 kits/automation/time-series-preprocessor/app/layout.tsx create mode 100644 kits/automation/time-series-preprocessor/app/page.tsx create mode 100644 kits/automation/time-series-preprocessor/components.json create mode 100644 kits/automation/time-series-preprocessor/components/header.tsx create mode 100644 kits/automation/time-series-preprocessor/components/theme-provider.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/accordion.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/alert-dialog.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/alert.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/aspect-ratio.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/avatar.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/badge.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/breadcrumb.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/button-group.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/button.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/calendar.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/card.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/carousel.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/chart.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/checkbox.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/collapsible.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/command.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/context-menu.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/dialog.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/drawer.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/dropdown-menu.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/empty.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/field.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/form.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/hover-card.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/input-group.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/input-otp.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/input.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/item.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/kbd.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/label.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/menubar.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/navigation-menu.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/pagination.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/popover.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/progress.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/radio-group.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/resizable.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/scroll-area.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/select.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/separator.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/sheet.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/sidebar.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/skeleton.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/slider.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/sonner.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/spinner.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/switch.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/table.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/tabs.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/textarea.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/toast.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/toaster.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/toggle-group.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/toggle.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/tooltip.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/use-mobile.tsx create mode 100644 kits/automation/time-series-preprocessor/components/ui/use-toast.ts create mode 100644 kits/automation/time-series-preprocessor/config.json create mode 100644 kits/automation/time-series-preprocessor/flows/time-series-preprocessor/config.json create mode 100644 kits/automation/time-series-preprocessor/flows/time-series-preprocessor/inputs.json create mode 100644 kits/automation/time-series-preprocessor/flows/time-series-preprocessor/meta.json create mode 100644 kits/automation/time-series-preprocessor/hooks/use-mobile.ts create mode 100644 kits/automation/time-series-preprocessor/hooks/use-toast.ts create mode 100644 kits/automation/time-series-preprocessor/lib/lamatic-client.ts create mode 100644 kits/automation/time-series-preprocessor/lib/utils.ts create mode 100644 kits/automation/time-series-preprocessor/next.config.mjs create mode 100644 kits/automation/time-series-preprocessor/package-lock.json create mode 100644 kits/automation/time-series-preprocessor/package.json create mode 100644 kits/automation/time-series-preprocessor/postcss.config.js create mode 100644 kits/automation/time-series-preprocessor/tailwind.config.js create mode 100644 kits/automation/time-series-preprocessor/tsconfig.json create mode 100644 package-lock.json diff --git a/kits/automation/time-series-preprocessor/.env.example b/kits/automation/time-series-preprocessor/.env.example new file mode 100644 index 00000000..c7058322 --- /dev/null +++ b/kits/automation/time-series-preprocessor/.env.example @@ -0,0 +1,4 @@ +TIME_SERIES_PREPROCESSOR="Your Flow ID from Lamatic Studio" +LAMATIC_API_URL="Your API Endpoint URL" +LAMATIC_PROJECT_ID="Your Project ID" +LAMATIC_API_KEY="Your API Key" \ No newline at end of file diff --git a/kits/automation/time-series-preprocessor/.gitignore b/kits/automation/time-series-preprocessor/.gitignore new file mode 100644 index 00000000..b28ea810 --- /dev/null +++ b/kits/automation/time-series-preprocessor/.gitignore @@ -0,0 +1,27 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules + +# next.js +/.next/ +/out/ + +# production +/build + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* + +# env files +.env + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts \ No newline at end of file diff --git a/kits/automation/time-series-preprocessor/README.md b/kits/automation/time-series-preprocessor/README.md new file mode 100644 index 00000000..c3d849af --- /dev/null +++ b/kits/automation/time-series-preprocessor/README.md @@ -0,0 +1,162 @@ +# Time-Series Preprocessor — Lamatic AgentKit + +An automation kit that analyzes time-series dataset schemas and generates production-ready Python preprocessing pipelines using `pandas` and `scikit-learn`. Paste a JSON summary of your dataset and receive executable code in seconds. + +--- + +## What It Does + +By providing a JSON summary of your dataset, the agent generates a complete Python script that handles: + +- **Missing value imputation** — forward-fill, mean, and median strategies selected based on column type +- **Feature scaling** — MinMaxScaler or StandardScaler applied appropriately +- **Datetime parsing and index management** — automatic timestamp detection and alignment +- **Categorical encoding** — label or one-hot encoding based on cardinality +- **Standardized implementation** — clean, readable `pandas` + `scikit-learn` code ready to run + +--- + +## Project Background + +This kit was developed to solve the repetitive nature of data cleaning in time-series projects. + +The concept originated during the development of a **water demand forecasting model** for a college located in a rural area near Bhopal. Due to aging sensor hardware and inconsistent data streams, significant time was spent manually handling missing values and aligning disparate data sources — rainfall readings, local water levels, and consumption logs from different systems with mismatched timestamps. + +The goal was to automate the boilerplate preprocessing code, allowing engineers to focus on model performance rather than manual cleanup. This kit is the result of that experience. + +--- + +## Who Is It For + +Data engineers and machine learning engineers who frequently work with time-series data and need a fast way to generate reliable, repeatable preprocessing pipelines without writing boilerplate code from scratch. + +--- + +## Tech Stack + +| Tool | Role | +|---|---| +| [Lamatic.ai](https://lamatic.ai) | Flow orchestration and Edge deployment | +| Gemini 2.5 Pro | AI-driven Python code generation | +| Next.js 14 | Interactive frontend sandbox | +| pandas + scikit-learn | Target libraries for generated pipelines | + +--- + +## Setup + +### 1. Build and Deploy Flow in Lamatic Studio + +1. Sign in at [lamatic.ai](https://lamatic.ai) +2. Create a new project (if you don't have one) +3. Click **+ New Flow** and select **API Request** as the trigger +4. Add a **Generate Text** node and select **Gemini 2.5 Pro** +5. Set the input variable to `dataset_summary` +6. Configure the system prompt to act as an expert data engineer +7. Deploy the flow and copy your credentials from the Studio dashboard + +### 2. Environment Variables + +Create a `.env.local` file in the kit root directory: + +```env +TIME_SERIES_PREPROCESSOR="Your Flow ID from Lamatic Studio" +LAMATIC_API_URL="Your API Endpoint URL" +LAMATIC_PROJECT_ID="Your Project ID" +LAMATIC_API_KEY="Your API Key" +``` + +| Variable | Where to Find It | +|---|---| +| `TIME_SERIES_PREPROCESSOR` | Studio → Your Flow → Settings | +| `LAMATIC_API_URL` | Studio → Your Flow → API Endpoint | +| `LAMATIC_PROJECT_ID` | Studio → Project Settings | +| `LAMATIC_API_KEY` | Studio → Project Settings → API Keys | + +### 3. Install and Run + +```bash +npm install +npm run dev +``` + +Open [http://localhost:3000](http://localhost:3000) to access the frontend interface. + +--- + +## Example Input + +Provide a JSON object describing your dataset structure: + +```json +{ + "dataset_name": "sensor_readings", + "frequency": "1min", + "columns": [ + {"name": "timestamp", "type": "datetime"}, + {"name": "temperature", "type": "float", "missing_pct": 5}, + {"name": "pressure", "type": "float", "missing_pct": 2}, + {"name": "status", "type": "categorical", "missing_pct": 0} + ], + "rows": 50000, + "target_column": "temperature" +} +``` + +## Example Output + +The agent returns a fully executable Python script: + +```python +import pandas as pd +from sklearn.preprocessing import MinMaxScaler + +# Load and index +df = pd.read_csv("sensor_readings.csv", parse_dates=["timestamp"]) +df.set_index("timestamp", inplace=True) + +# Impute missing values +df["temperature"].fillna(method="ffill", inplace=True) +df["pressure"].fillna(df["pressure"].mean(), inplace=True) + +# Scale numerical features +scaler = MinMaxScaler() +df[["temperature", "pressure"]] = scaler.fit_transform(df[["temperature", "pressure"]]) + +print("Preprocessing complete.") +print(df.head()) +``` + +--- + +## Project Structure + +``` +time-series-preprocessor/ +├── actions/ +│ └── orchestrate.ts # Server action calling the Lamatic flow +├── app/ +│ └── page.tsx # Main UI — input form and output display +├── components/ +│ └── ui/ # shadcn/ui components +├── flows/ +│ └── time-series-preprocessor/ +│ ├── config.json # Exported Lamatic flow graph +│ ├── inputs.json # Input schema definition +│ └── meta.json # Flow metadata +├── lib/ +│ └── lamatic-client.ts # Lamatic SDK client +├── .env.example # Environment variable template +├── config.json # Kit metadata +└── README.md +``` + +--- + +## Contributing + +Contributions are welcome. Open an issue or pull request in the [AgentKit repository](https://github.com/Lamatic/AgentKit). + +## License + +MIT License — see [LICENSE](../../../../LICENSE). \ No newline at end of file diff --git a/kits/automation/time-series-preprocessor/actions/orchestrate.ts b/kits/automation/time-series-preprocessor/actions/orchestrate.ts new file mode 100644 index 00000000..264b2c47 --- /dev/null +++ b/kits/automation/time-series-preprocessor/actions/orchestrate.ts @@ -0,0 +1,27 @@ +"use server"; + +import { createLamaticClient } from "@/lib/lamatic-client"; + +const client = createLamaticClient(); + +export async function preprocessTimeSeries(datasetSummary: string) { + try { + const response = await client.executeFlow({ + flowId: process.env.TIME_SERIES_PREPROCESSOR!, + inputs: { + dataset_summary: datasetSummary, + }, + }); + + return { + success: true, + result: response?.data?.generatedText || "", + }; + } catch (error) { + console.error("Error calling Lamatic flow:", error); + return { + success: false, + result: "Failed to generate preprocessing pipeline. Please try again.", + }; + } +} \ No newline at end of file diff --git a/kits/automation/time-series-preprocessor/app/globals.css b/kits/automation/time-series-preprocessor/app/globals.css new file mode 100644 index 00000000..90357922 --- /dev/null +++ b/kits/automation/time-series-preprocessor/app/globals.css @@ -0,0 +1,15 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + font-family: 'Inter', sans-serif; + background-color: #f5f5f5; + color: #111; +} \ No newline at end of file diff --git a/kits/automation/time-series-preprocessor/app/layout.tsx b/kits/automation/time-series-preprocessor/app/layout.tsx new file mode 100644 index 00000000..50a39ad0 --- /dev/null +++ b/kits/automation/time-series-preprocessor/app/layout.tsx @@ -0,0 +1,24 @@ +import type { Metadata } from "next"; +import "./globals.css"; + +export const metadata: Metadata = { + title: "Time-Series Preprocessor — Lamatic AgentKit", + description: "AI-powered time-series preprocessing pipeline generator", +}; + +export default function RootLayout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + + + + + + + {children} + + ); +} \ No newline at end of file diff --git a/kits/automation/time-series-preprocessor/app/page.tsx b/kits/automation/time-series-preprocessor/app/page.tsx new file mode 100644 index 00000000..0634c4df --- /dev/null +++ b/kits/automation/time-series-preprocessor/app/page.tsx @@ -0,0 +1,225 @@ +"use client"; + +import { useState } from "react"; +import { preprocessTimeSeries } from "@/actions/orchestrate"; + +const EXAMPLE_INPUT = `{ + "dataset_name": "sensor_readings", + "frequency": "1min", + "columns": [ + {"name": "timestamp", "type": "datetime"}, + {"name": "temperature", "type": "float", "missing_pct": 5}, + {"name": "pressure", "type": "float", "missing_pct": 2}, + {"name": "status", "type": "categorical", "missing_pct": 0} + ], + "rows": 50000, + "target_column": "temperature" +}`; + +const FEATURES = [ + { title: "Missing value imputation", desc: "Forward-fill, mean, and median strategies selected based on column type" }, + { title: "Feature scaling", desc: "MinMaxScaler or StandardScaler applied appropriately" }, + { title: "Datetime parsing and index management", desc: "Automatic timestamp detection and alignment" }, + { title: "Categorical encoding", desc: "Label or one-hot encoding based on cardinality" }, + { title: "Standardized implementation", desc: "Clean, readable pandas + scikit-learn code ready to run" }, +]; + +export default function Home() { + const [input, setInput] = useState(""); + const [output, setOutput] = useState(""); + const [loading, setLoading] = useState(false); + const [error, setError] = useState(""); + const [copied, setCopied] = useState(false); + + async function handleSubmit() { + if (!input.trim()) { setError("Please enter a dataset summary."); return; } + setLoading(true); setError(""); setOutput(""); + const result = await preprocessTimeSeries(input); + if (result.success) { + setOutput(result.result); + setTimeout(() => { + document.getElementById("output")?.scrollIntoView({ behavior: "smooth" }); + }, 100); + } else { + setError(result.result); + } + setLoading(false); + } + + function handleCopy() { + navigator.clipboard.writeText(output); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + } + + return ( +
+ + {/* Navbar */} + + + {/* Hero */} +
+
+ AgentKit — Automation Kit +
+

+ Turn Dataset Schemas into
+ Python Pipelines Instantly +

+

+ Paste a JSON summary of your time-series dataset and receive a production-ready preprocessing script using pandas and scikit-learn. +

+
+ {["Saves Hours of Boilerplate", "Preprocessing Pipelines", "Ready-to-Run Python Scripts"].map(tag => ( + {tag} + ))} +
+ + Try It Now ↓ + +
+ + {/* Main Content */} +
+ + {/* What It Does */} +
+

+ What It Does +

+

+ By providing a JSON summary of your dataset, the agent generates a complete Python script that handles: +

+
+ {FEATURES.map(item => ( +
+ {item.icon} +
+ {item.title} + — {item.desc} +
+
+ ))} +
+
+ + {/* Input Card */} +
+
+
+
+ Dataset Summary + JSON +
+ +
+