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
33 changes: 32 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
**/.DS_Store

.env
.env

# dependencies
node_modules/

# next build
.next/
out/

# production
build/
dist/

# env files
.env
.env.local
.env.*.local

# logs
npm-debug.log*
yarn-debug.log*
pnpm-debug.log*

# misc
.DS_Store
*.pem

# typescript
*.tsbuildinfo

# vercel
.vercel/
41 changes: 41 additions & 0 deletions kits/agentic/prompt-optimizer-agent/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

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

# env files (can opt-in for committing if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
5 changes: 5 additions & 0 deletions kits/agentic/prompt-optimizer-agent/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- BEGIN:nextjs-agent-rules -->
# This is NOT the Next.js you know

This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` before writing any code. Heed deprecation notices.
<!-- END:nextjs-agent-rules -->
1 change: 1 addition & 0 deletions kits/agentic/prompt-optimizer-agent/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
36 changes: 36 additions & 0 deletions kits/agentic/prompt-optimizer-agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
52 changes: 52 additions & 0 deletions kits/agentic/prompt-optimizer-agent/actions/orchestrate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
export async function optimizePrompt(prompt: string) {
// TEMP fallback (no Lamatic call)
return {
success: true,
result: "Optimized: " + prompt,
};
}

// export async function optimizePrompt(prompt: string) {
// try {
// const res = await fetch(process.env.LAMATIC_API_URL!, {
// method: "POST",
// headers: {
// "Content-Type": "application/json",
// Authorization: `Bearer ${process.env.LAMATIC_API_KEY}`,
// "x-project-id": process.env.LAMATIC_PROJECT_ID!,
// },
// body: JSON.stringify({
// query: `
// mutation ExecuteFlow($workflowId: String!, $sampleInput: String!) {
// executeWorkflow(
// workflowId: $workflowId
// sampleInput: $sampleInput
// ) {
// result
// status
// }
// }
// `,
// variables: {
// workflowId: "bb09a3ae-9cf4-4187-a223-dbc1d2666412", // 👈 from screenshot
// sampleInput: prompt,
// },
// }),
// });

// const data = await res.json();
// console.log("LAMATIC:", data);

// return {
// success: true,
// result:
// data?.data?.executeWorkflow?.result || "No result returned",
// };
// } catch (e) {
// console.error(e);
// return {
// success: false,
// result: "Error optimizing prompt",
// };
// }
// }
10 changes: 10 additions & 0 deletions kits/agentic/prompt-optimizer-agent/app/api/optimize/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { NextResponse } from "next/server";
import { optimizePrompt } from "@/actions/orchestrate";

export async function POST(req: Request) {
const { prompt } = await req.json();

const result = await optimizePrompt(prompt);

return NextResponse.json(result);
}
Binary file not shown.
26 changes: 26 additions & 0 deletions kits/agentic/prompt-optimizer-agent/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@import "tailwindcss";

:root {
--background: #ffffff;
--foreground: #171717;
}

@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono);
}

@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
}
}

body {
background: var(--background);
color: var(--foreground);
font-family: Arial, Helvetica, sans-serif;
}
33 changes: 33 additions & 0 deletions kits/agentic/prompt-optimizer-agent/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";

const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});

const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html
lang="en"
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
>
<body className="min-h-full flex flex-col">{children}</body>
</html>
);
}
122 changes: 122 additions & 0 deletions kits/agentic/prompt-optimizer-agent/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
"use client";

import { useState } from "react";

export default function Home() {
const [input, setInput] = useState("");
const [output, setOutput] = useState("");
const [loading, setLoading] = useState(false);

async function handleSubmit() {
if (!input.trim()) return;

setLoading(true);
setOutput("");

const res = await fetch("/api/optimize", {
method: "POST",
body: JSON.stringify({ prompt: input }),
});

const data = await res.json();
setOutput(data.result);
setLoading(false);
}

return (
<main className="min-h-screen bg-gray-100 text-black">

{/* Navbar */}
<nav className="bg-white border-b px-6 py-3 flex justify-between items-center">
<div className="flex items-center gap-2">
<div className="w-7 h-7 bg-red-500 text-white flex items-center justify-center rounded-md font-bold">
L
</div>
<span className="font-semibold text-sm">
Lamatic.ai / Prompt Optimizer
</span>
</div>

<div className="flex gap-4 text-sm">
<a href="https://github.com/Lamatic/AgentKit" target="_blank">GitHub</a>
<a href="https://lamatic.ai" target="_blank">Lamatic.ai →</a>
</div>
</nav>

{/* Main */}
<div className="flex justify-center p-6">
<div className="w-full max-w-2xl space-y-6">

{/* Title */}
<h1 className="text-2xl font-bold text-center">
Prompt Optimizer
</h1>

{/* Input Card */}
<div className="bg-white border rounded-xl overflow-hidden">
<div className="flex justify-between items-center px-4 py-2 border-b">
<span className="text-sm font-semibold">Input Prompt</span>
<button
onClick={() =>
setInput("Explain AI like I'm 5 years old")
}
className="text-red-500 text-xs"
>
Load Example →
</button>
</div>

<textarea
value={input}
onChange={(e) => setInput(e.target.value)}
rows={6}
className="w-full p-4 outline-none resize-none"
placeholder="Enter your prompt..."
/>

<div className="p-3 border-t">
<button
onClick={handleSubmit}
className="w-full bg-red-500 text-white py-2 rounded-lg"
>
{loading ? "Optimizing..." : "Optimize Prompt"}
</button>
</div>
</div>

{/* Output */}
{output && (
<div className="bg-black text-white rounded-xl overflow-hidden">
<div className="px-4 py-2 border-b border-gray-700 flex justify-between">
<span className="text-sm font-semibold">Optimized Prompt</span>
<button
onClick={() => navigator.clipboard.writeText(output)}
className="text-xs"
>
Copy
</button>
</div>

<pre className="p-4 text-sm whitespace-pre-wrap">
{output}
</pre>
</div>
)}

</div>
</div>

{/* Footer */}
<footer className="text-center text-sm text-gray-500 mt-10 pb-6">
<p>
Built by <span className="font-semibold text-black">Shiwam Kumar</span> · Lamatic AgentKit Challenge
</p>
<div className="flex justify-center gap-4 mt-2">
<a href="https://github.com/ShiwamKumar2208" target="_blank">GitHub</a>
<a href="https://www.linkedin.com/in/shiwam-kumar-991a043b0/" target="_blank">LinkedIn</a>
</div>
</footer>

</main>
);
}
Empty file.
18 changes: 18 additions & 0 deletions kits/agentic/prompt-optimizer-agent/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";

const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
]),
]);

export default eslintConfig;
Loading