From e413a3f4efa4ee6994200832ed963b1fdaeafd70 Mon Sep 17 00:00:00 2001 From: aniketku23 Date: Thu, 9 Jul 2026 17:59:58 +0530 Subject: [PATCH 1/2] feat: Add live-api-debugger template --- kits/live-api-debugger/README.md | 18 +++ kits/live-api-debugger/agent.md | 10 ++ .../constitutions/default.md | 5 + .../flows/live-api-debugger.ts | 140 ++++++++++++++++++ kits/live-api-debugger/lamatic.config.ts | 14 ++ .../live-api-debugger_generate-text.ts | 5 + .../live-api-debugger_generate-text_system.md | 1 + .../live-api-debugger_generate-text_user.md | 12 ++ 8 files changed, 205 insertions(+) create mode 100644 kits/live-api-debugger/README.md create mode 100644 kits/live-api-debugger/agent.md create mode 100644 kits/live-api-debugger/constitutions/default.md create mode 100644 kits/live-api-debugger/flows/live-api-debugger.ts create mode 100644 kits/live-api-debugger/lamatic.config.ts create mode 100644 kits/live-api-debugger/model-configs/live-api-debugger_generate-text.ts create mode 100644 kits/live-api-debugger/prompts/live-api-debugger_generate-text_system.md create mode 100644 kits/live-api-debugger/prompts/live-api-debugger_generate-text_user.md diff --git a/kits/live-api-debugger/README.md b/kits/live-api-debugger/README.md new file mode 100644 index 000000000..97d8dbe5b --- /dev/null +++ b/kits/live-api-debugger/README.md @@ -0,0 +1,18 @@ +# Live API Debugger 🐛 -> 🦋 + +An advanced developer tool that fixes your broken API integration code by directly reading the live official API documentation. + +## Why this exists +APIs update constantly. LLMs often hallucinate deprecated code because their training data is outdated. By forcing the agent to scrape the live documentation URL you provide, you guarantee the AI writes code for the exact, newest version of the API. + +## How it works +1. **Trigger**: Accepts `error_message`, `failing_code`, and `api_docs_url`. +2. **Scraper (Firecrawl)**: Visits the `api_docs_url` and extracts the main Markdown content. +3. **LLM**: Analyzes the error and failing code against the fresh documentation context to generate a Root Cause Analysis, rewritten code, and verification steps. + +## How to test it +1. Create a flow in Lamatic Studio based on this template. +2. Provide test values: + - `error_message`: `{"error": "Missing required param: currency."}` + - `failing_code`: `stripe.paymentIntents.create({ amount: 2000 })` + - `api_docs_url`: `https://docs.stripe.com/api/payment_intents/create` diff --git a/kits/live-api-debugger/agent.md b/kits/live-api-debugger/agent.md new file mode 100644 index 000000000..085735cbf --- /dev/null +++ b/kits/live-api-debugger/agent.md @@ -0,0 +1,10 @@ +# Live API Debugger + +## Overview +This template implements a synchronous, request-response pipeline for debugging code. It accepts an error message, code snippet, and documentation URL via a GraphQL API Request. It uses Firecrawl to fetch the live documentation page, and an LLM to reason over the documentation to fix the user's code. + +## Flow +1. **API Request**: Receives `error_message`, `failing_code`, and `api_docs_url`. +2. **Firecrawl Scraper**: Fetches `api_docs_url` and extracts the main text. +3. **Generate Text (LLM)**: Analyzes the context and generates the markdown fix. +4. **API Response**: Returns the generated markdown. diff --git a/kits/live-api-debugger/constitutions/default.md b/kits/live-api-debugger/constitutions/default.md new file mode 100644 index 000000000..48eae2c33 --- /dev/null +++ b/kits/live-api-debugger/constitutions/default.md @@ -0,0 +1,5 @@ +export default ` +# Default Constitution +1. Be helpful and professional. +2. Provide code fixes that are safe and secure. +`; diff --git a/kits/live-api-debugger/flows/live-api-debugger.ts b/kits/live-api-debugger/flows/live-api-debugger.ts new file mode 100644 index 000000000..aa7cccb7f --- /dev/null +++ b/kits/live-api-debugger/flows/live-api-debugger.ts @@ -0,0 +1,140 @@ +export const meta = { + "name": "Live API Debugger", + "description": "Advanced API Error Troubleshooter. Scrapes live docs to fix failing code.", + "tags": ["developer-tools", "debugging"], + "testInput": null, + "githubUrl": "https://github.com/Lamatic/AgentKit/tree/main/kits/live-api-debugger", + "documentationUrl": "", + "deployUrl": "", + "author": { + "name": "Lamatic Intern Candidate", + "email": "candidate@example.com" + } +}; + +export const inputs = {}; + +export const references = { + "constitutions": { + "default": "@constitutions/default.md" + }, + "prompts": { + "live_api_debugger_generate_text_user": "@prompts/live-api-debugger_generate-text_user.md", + "live_api_debugger_generate_text_system": "@prompts/live-api-debugger_generate-text_system.md" + }, + "modelConfigs": { + "live_api_debugger_generate_text": "@model-configs/live-api-debugger_generate-text.ts" + } +}; + +export const nodes = [ + { + "id": "triggerNode_1", + "type": "triggerNode", + "position": { "x": 0, "y": 0 }, + "data": { + "nodeId": "graphqlNode", + "trigger": true, + "values": { + "nodeName": "API Request", + "responeType": "realtime", + "advance_schema": "{\"error_message\":\"string\",\"failing_code\":\"string\",\"api_docs_url\":\"string\"}" + } + } + }, + { + "id": "scraperNode_2", + "type": "dynamicNode", + "position": { "x": 0, "y": 0 }, + "data": { + "nodeId": "scraperNode", + "values": { + "nodeName": "Scraper", + "url": "{{triggerNode_1.output.api_docs_url}}", + "mobile": false, + "waitFor": 2000, + "credentials": null, + "excludeTags": [], + "includeTags": [], + "onlyMainContent": true, + "skipTLsVerification": false + } + } + }, + { + "id": "LLMNode_3", + "type": "dynamicNode", + "position": { "x": 0, "y": 0 }, + "data": { + "nodeId": "LLMNode", + "values": { + "nodeName": "Generate Text", + "tools": [], + "prompts": [ + { + "id": "user-prompt", + "role": "user", + "content": "@prompts/live-api-debugger_generate-text_user.md" + }, + { + "id": "system-prompt", + "role": "system", + "content": "@prompts/live-api-debugger_generate-text_system.md" + } + ], + "memories": "@model-configs/live-api-debugger_generate-text.ts", + "messages": "@model-configs/live-api-debugger_generate-text.ts", + "generativeModelName": "@model-configs/live-api-debugger_generate-text.ts" + } + } + }, + { + "id": "graphqlResponseNode_4", + "type": "dynamicNode", + "position": { "x": 0, "y": 0 }, + "data": { + "nodeId": "graphqlResponseNode", + "values": { + "nodeName": "API Response", + "outputMapping": "{\n \"fix\": \"{{LLMNode_3.output.generatedResponse}}\"\n}" + } + } + } +]; + +export const edges = [ + { + "id": "triggerNode_1-scraperNode_2", + "source": "triggerNode_1", + "target": "scraperNode_2", + "sourceHandle": "bottom", + "targetHandle": "top", + "type": "defaultEdge" + }, + { + "id": "scraperNode_2-LLMNode_3", + "source": "scraperNode_2", + "target": "LLMNode_3", + "sourceHandle": "bottom", + "targetHandle": "top", + "type": "defaultEdge" + }, + { + "id": "LLMNode_3-graphqlResponseNode_4", + "source": "LLMNode_3", + "target": "graphqlResponseNode_4", + "sourceHandle": "bottom", + "targetHandle": "top", + "type": "defaultEdge" + }, + { + "id": "response-graphqlResponseNode_4", + "source": "triggerNode_1", + "target": "graphqlResponseNode_4", + "sourceHandle": "to-response", + "targetHandle": "from-trigger", + "type": "responseEdge" + } +]; + +export default { meta, inputs, references, nodes, edges }; diff --git a/kits/live-api-debugger/lamatic.config.ts b/kits/live-api-debugger/lamatic.config.ts new file mode 100644 index 000000000..7c20d6814 --- /dev/null +++ b/kits/live-api-debugger/lamatic.config.ts @@ -0,0 +1,14 @@ +export default { + name: "Live API Debugger", + description: "Advanced API Error Troubleshooter. Analyzes an error message, failing code snippet, and scrapes the live official API documentation using Firecrawl to provide a precise code fix.", + version: '1.0.0', + type: 'template' as const, + author: {"name":"Lamatic Intern Candidate","email":"candidate@example.com"}, + tags: ["developer-tools", "debugging", "agentic-coding"], + steps: [ + { id: "live-api-debugger", type: 'mandatory' as const } + ], + links: { + "github": "https://github.com/Lamatic/AgentKit/tree/main/kits/live-api-debugger" + }, +}; diff --git a/kits/live-api-debugger/model-configs/live-api-debugger_generate-text.ts b/kits/live-api-debugger/model-configs/live-api-debugger_generate-text.ts new file mode 100644 index 000000000..a9473afb2 --- /dev/null +++ b/kits/live-api-debugger/model-configs/live-api-debugger_generate-text.ts @@ -0,0 +1,5 @@ +export default { + "provider": "openai", + "model": "gpt-4o", + "temperature": 0.2 +}; diff --git a/kits/live-api-debugger/prompts/live-api-debugger_generate-text_system.md b/kits/live-api-debugger/prompts/live-api-debugger_generate-text_system.md new file mode 100644 index 000000000..fb96923a2 --- /dev/null +++ b/kits/live-api-debugger/prompts/live-api-debugger_generate-text_system.md @@ -0,0 +1 @@ +You are an elite Senior Backend Engineer. Your job is to debug failing code based on an error message and the official API documentation. Be concise, accurate, and professional. Format your response in clean Markdown with three sections: 'Root Cause Analysis', 'The Fix (Code)', and 'Verification'. diff --git a/kits/live-api-debugger/prompts/live-api-debugger_generate-text_user.md b/kits/live-api-debugger/prompts/live-api-debugger_generate-text_user.md new file mode 100644 index 000000000..b453be391 --- /dev/null +++ b/kits/live-api-debugger/prompts/live-api-debugger_generate-text_user.md @@ -0,0 +1,12 @@ +**Error Message:** +{{triggerNode_1.output.error_message}} + +**Failing Code:** +``` +{{triggerNode_1.output.failing_code}} +``` + +**API Docs Context:** +{{scraperNode_2.output.markdown}} + +Please analyze the context and provide the working code to fix the error. From 5ba0ad15156cdbc4f02f120f9aee67a2cc21202d Mon Sep 17 00:00:00 2001 From: aniketku23 Date: Thu, 9 Jul 2026 18:23:32 +0530 Subject: [PATCH 2/2] fix: Resolve markdown lint and update docs --- kits/live-api-debugger/README.md | 3 +++ kits/live-api-debugger/agent.md | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/kits/live-api-debugger/README.md b/kits/live-api-debugger/README.md index 97d8dbe5b..e46ae7048 100644 --- a/kits/live-api-debugger/README.md +++ b/kits/live-api-debugger/README.md @@ -3,14 +3,17 @@ An advanced developer tool that fixes your broken API integration code by directly reading the live official API documentation. ## Why this exists + APIs update constantly. LLMs often hallucinate deprecated code because their training data is outdated. By forcing the agent to scrape the live documentation URL you provide, you guarantee the AI writes code for the exact, newest version of the API. ## How it works + 1. **Trigger**: Accepts `error_message`, `failing_code`, and `api_docs_url`. 2. **Scraper (Firecrawl)**: Visits the `api_docs_url` and extracts the main Markdown content. 3. **LLM**: Analyzes the error and failing code against the fresh documentation context to generate a Root Cause Analysis, rewritten code, and verification steps. ## How to test it + 1. Create a flow in Lamatic Studio based on this template. 2. Provide test values: - `error_message`: `{"error": "Missing required param: currency."}` diff --git a/kits/live-api-debugger/agent.md b/kits/live-api-debugger/agent.md index 085735cbf..928cc6191 100644 --- a/kits/live-api-debugger/agent.md +++ b/kits/live-api-debugger/agent.md @@ -1,10 +1,12 @@ # Live API Debugger ## Overview + This template implements a synchronous, request-response pipeline for debugging code. It accepts an error message, code snippet, and documentation URL via a GraphQL API Request. It uses Firecrawl to fetch the live documentation page, and an LLM to reason over the documentation to fix the user's code. ## Flow + 1. **API Request**: Receives `error_message`, `failing_code`, and `api_docs_url`. 2. **Firecrawl Scraper**: Fetches `api_docs_url` and extracts the main text. 3. **Generate Text (LLM)**: Analyzes the context and generates the markdown fix. -4. **API Response**: Returns the generated markdown. +4. **API Response**: Returns a JSON object with a `fix` field containing the generated markdown.