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
21 changes: 21 additions & 0 deletions kits/live-api-debugger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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
Comment thread
coderabbitai[bot] marked this conversation as resolved.

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`
12 changes: 12 additions & 0 deletions kits/live-api-debugger/agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +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.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
4. **API Response**: Returns a JSON object with a `fix` field containing the generated markdown.
5 changes: 5 additions & 0 deletions kits/live-api-debugger/constitutions/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default `
# Default Constitution
1. Be helpful and professional.
2. Provide code fixes that are safe and secure.
`;
140 changes: 140 additions & 0 deletions kits/live-api-debugger/flows/live-api-debugger.ts
Original file line number Diff line number Diff line change
@@ -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 };
14 changes: 14 additions & 0 deletions kits/live-api-debugger/lamatic.config.ts
Original file line number Diff line number Diff line change
@@ -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"
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
"provider": "openai",
"model": "gpt-4o",
"temperature": 0.2
};
Original file line number Diff line number Diff line change
@@ -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'.
Original file line number Diff line number Diff line change
@@ -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.
Loading