API-Halluzinationen bei Coding-Agenten vermeiden: Hoppscotch-Connector für Cognee vorgestellt
Entwickler, die einen Agenten einen Client für interne Dienste schreiben lassen, erhalten oft fiktive Endpunkte. Ein Hoppscotch-Connector für Cognee soll die Agenten auf echte API-Definitionen zugreifen lassen.

Autonome KI-Coding-Agents wie Claude Code, Cursor, GitHub Copilot und andere KI-gestützte Entwicklungstools verändern schnell die Art, wie wir Software bauen. Dennoch begegnen Entwickler, die einen Agenten bitten, einen Client zu schreiben, der unseren internen Billing- und User-Service aufruft, häufig demselben Problem: API-Halluzination.
Ein Agent kann nicht existierende Query-Parameter erfinden, erforderliche Header wie X-Workspace-ID auslassen, die falsche Authentifizierungsmethode wählen oder Anfragen an veraltete Endpoints generieren.
Große Sprachmodelle (LLMs) erzeugen Antworten auf Grundlage gelernter Muster und des ihnen bereitgestellten Kontexts. Ohne verlässliche, aktuelle API-Spezifikationen können sie plausibel wirkende, aber fehlerhafte Integrationen produzieren.
Was wäre, wenn KI-Coding-Agents strukturiertes API-Wissen abrufen könnten, statt zu raten?
Im Rahmen von Mergetober habe ich einen dedizierten Hoppscotch-Datenquellen-Connector für Cognee entwickelt, um dieses Problem zu lösen.
In diesem Artikel erläutere ich, warum API-Schema-Memory wichtig ist, wie der Connector in die Architektur passt und wie API-Sammlungen in Cognee aufgenommen werden können, um verlässlichen Kontext für KI-generierten Integrationscode bereitzustellen.
Hoppscotch ist eine Open-Source-Plattform für die API-Entwicklung, die Entwicklern hilft, API-Anfragen zu erstellen, zu organisieren und zu testen.
Hoppscotch-Sammlungen enthalten entscheidende Informationen darüber, wie eine API verwendet werden sollte:
Wenn API-Sammlungen in exportierten JSON-Dateien oder Desktop-Tools isoliert bleiben, kann ein KI-Agent nicht auf sie verweisen. Das Einfügen eines gesamten JSON-Exports mit 10.000 Zeilen in einen Prompt überflutet das Kontextfenster, verbrennt Tokens und verschlechtert die Aufmerksamkeit.
Ein besserer Ansatz besteht darin, API-Wissen bedarfsgesteuert aufzunehmen, zu strukturieren, zu indexieren und abzurufen.
Cognee ist ein Open-Source-Framework zum Aufbau von KI-Memory-Systemen auf Basis strukturierter Wissens- und Retrieval-Ansätze.
Statt sich ausschließlich auf rohe Textblöcke in einer Vektordatenbank zu verlassen, organisiert Cognee API-Informationen in einem hybriden System aus Wissensgraph und Vektorindex:
Der Connector verbindet exportierte API-Sammlungen mit Cognees Memory-Pipeline:
Hoppscotch API Collection (.json) │ ▼ Hoppscotch Connector (cognee-community) │ ▼ Parse, Normalize & Resolve Variables │ ▼ Cognee Ingestion Pipeline (dlt resource) │ ▼ Knowledge Graph + Vector Store │ ▼ AI Coding Agent (Claude, Cursor, Devin) │ ▼ Schema-Grounded, Hallucination-Free Code Wesentliche Designüberlegungen 3.1. Stabile Endpoint-Identifikatoren Der Connector vergibt für jede API-Anfrage einen deterministischen zusammengesetzten Identifikator:
hoppscotch:{collection_slug}:{folder_path}:{request_name} Stabile IDs gewährleisten idempotente Synchronisierungen. Wenn du deine Sammlung erneut exportierst, werden vorhandene Graphknoten sauber aktualisiert, statt dupliziert zu werden.
APIs entwickeln sich kontinuierlich weiter. Der Connector setzt write_disposition="replace", sodass veraltete Endpoints, die upstream gelöscht werden, durch Cognees automatische Aufräumlogik sowohl aus dem Vektorindex als auch aus dem Wissensgraph entfernt werden.
Hoppscotch-Umgebungen verwenden die <<variable>>-Syntax. Der Connector löst nicht sensible Basis-URLs auf (z. B. <<baseUrl>>/v1/orders ➔ https://api.example.com/v1/orders ), während sichergestellt wird, dass echte Produktions-Credentials und Access-Tokens nicht in den Memory hochgeladen werden.
Jeder Endpoint wird in eine saubere Markdown-Darstellung formatiert:
### POST /v1/orders Collection: E-Commerce / Orders Headers: - Content-Type: application/json - Idempotency-Key: <uuid> Request Body: { "customer_id": "string", "items": [ { "sku": "string", "qty": 1 } ], "currency": "USD" } 4. Schritt für Schritt: Eine Hoppscotch-Sammlung aufnehmen Schritt 1: Abhängigkeiten installieren pip install cognee cognee-community-connector-hoppscotch Schritt 2: Deinen Hoppscotch-Workspace exportieren Öffne in Hoppscotch Collections ➔ klicke auf Export ➔ speichere als collection.json. (Optional) Exportiere deine aktive Umgebung als environment.json. api-memory-project/ ├── collection.json ├── environment.json └── main.py Schritt 3: Die Sammlung aufnehmen und abfragen import asyncio import cognee from cognee_community_connector_hoppscotch import hoppscotch_source async def main (): # 1. Load the exported API collection print ( " Loading Hoppscotch collection...
" ) source = hoppscotch_source ( collection_path = "./collection.json ", environment_path = "./environment.json ", # optional ) # 2. Ingest into Cognee memory await cognee. remember ( source, dataset_name = " api_documentation ", ) # 3. Cognify: Build the semantic knowledge graph print ( " Processing API knowledge graph...
" ) await cognee. cognify ( dataset_name = " api_documentation ", ) # 4. Search API memory with natural language print ( " Searching API memory... " ) results = await cognee. search ( " Which endpoint creates a customer order, and what headers and request fields are required?
", dataset_name = " api_documentation ", ) for result in results: print ( result ) if __name__ == " __main__ ": asyncio. run ( main ()) 5. Wie sieht besseres API-Grounding aus? Mit einem durchsuchbaren API-Memory-System ruft der Agent den exakten Endpoint-Contract ab, bevor er Code schreibt:
{ "customer_id": "string", "items": [{ "sku": "string", "qty": 1 }], "currency": "USD" } Statt Query-Parameter zu raten oder Auth-Header zu erfinden, schreibt der Coding-Agent beim allerersten Versuch korrekte, produktionsreife Integrations-Clients.
API-Dokumentation ist nur das erste Puzzleteil. Als Nächstes befassen wir uns in dieser Mergetober-Serie mit Datenbankschema-Halluzinationen, indem wir Prisma ORM ( schema.prisma ) an Cognee anbinden!
Was ist in deinen KI-Coding-Workflows die größte Quelle für Halluzinationen: API-Contracts, Datenbankschemas oder Infrastruktur-Konfigurationen? Lass es mich in den Kommentaren wissen!
Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.
Original (Englisch) anzeigen
Autonomous AI coding agents such as Claude Code, Cursor, GitHub Copilot, and other AI-powered development tools are rapidly changing how we build software. Yet, developers who ask an agent to "write a client to call our internal billing and user service" often encounter the same problem: API hallucination.
An agent might invent nonexistent query parameters, omit required headers like X-Workspace-ID, choose the wrong authentication method, or generate requests for outdated endpoints.
Large language models (LLMs) generate responses based on learned patterns and the context provided to them. Without reliable, up-to-date API specifications, they may produce plausible-looking but incorrect integrations.
What if AI coding agents could retrieve structured API knowledge instead of guessing?
As part of Mergetober, I worked on a dedicated Hoppscotch data-source connector for Cognee to address this problem.
In this article, I'll explain why API schema memory matters, how the connector fits into the architecture, and how API collections can be ingested into Cognee to provide reliable context for AI-generated integration code.
Hoppscotch is an open-source API development platform that helps developers create, organize, and test API requests.
Hoppscotch collections contain critical information about how an API should be used:
When API collections remain isolated in exported JSON files or desktop tools, an AI agent cannot reference them. Pasting an entire 10,000-line JSON export into a prompt floods the context window, burns tokens, and degrades attention.
A better approach is to ingest, structure, index, and retrieve API knowledge on demand.
Cognee is an open-source framework for building AI memory systems using structured knowledge and retrieval.
Instead of relying exclusively on raw text chunks in a vector database, Cognee organizes API information into a hybrid knowledge graph + vector index:
The connector bridges exported API collections and Cognee's memory pipeline:
Hoppscotch API Collection (.json) │ ▼ Hoppscotch Connector (cognee-community) │ ▼ Parse, Normalize & Resolve Variables │ ▼ Cognee Ingestion Pipeline (dlt resource) │ ▼ Knowledge Graph + Vector Store │ ▼ AI Coding Agent (Claude, Cursor, Devin) │ ▼ Schema-Grounded, Hallucination-Free Code Enter fullscreen mode Exit fullscreen mode Key Design Considerations 3.1. Stable Endpoint Identifiers The connector assigns a deterministic composite identifier to each API request:
hoppscotch:{collection_slug}:{folder_path}:{request_name} Enter fullscreen mode Exit fullscreen mode Stable IDs ensure idempotent syncs. When you re-export your collection, existing graph nodes are cleanly updated rather than duplicated.
APIs evolve continuously. The connector sets write_disposition="replace" so that when an obsolete endpoint is deleted upstream, Cognee's automatic orphan cleanup purges it from both the vector index and the knowledge graph.
Hoppscotch environments use <<variable>> syntax. The connector resolves non-sensitive base URLs (e.g., <<baseUrl>>/v1/orders ➔ https://api.example.com/v1/orders ) while ensuring real production credentials and access tokens are not uploaded to memory.
Each endpoint is formatted into a clean, markdown representation:
### POST /v1/orders Collection: E-Commerce / Orders Headers: - Content-Type: application/json - Idempotency-Key: <uuid> Request Body: { "customer_id": "string", "items": [ { "sku": "string", "qty": 1 } ], "currency": "USD" } Enter fullscreen mode Exit fullscreen mode 4. Step-by-Step: Ingesting a Hoppscotch Collection Step 1: Install Dependencies pip install cognee cognee-community-connector-hoppscotch Enter fullscreen mode Exit fullscreen mode Step 2: Export Your Hoppscotch Workspace In Hoppscotch, open Collections ➔ click Export ➔ save as collection.json. (Optional) Export your active environment as environment.json. api-memory-project/ ├── collection.json ├── environment.json └── main.py Enter fullscreen mode Exit fullscreen mode Step 3: Ingest and Query the Collection import asyncio import cognee from cognee_community_connector_hoppscotch import hoppscotch_source async def main (): # 1. Load the exported API collection print ( " Loading Hoppscotch collection...
" ) source = hoppscotch_source ( collection_path = "./collection.json ", environment_path = "./environment.json ", # optional ) # 2. Ingest into Cognee memory await cognee. remember ( source, dataset_name = " api_documentation ", ) # 3. Cognify: Build the semantic knowledge graph print ( " Processing API knowledge graph...
" ) await cognee. cognify ( dataset_name = " api_documentation ", ) # 4. Search API memory with natural language print ( " Searching API memory... " ) results = await cognee. search ( " Which endpoint creates a customer order, and what headers and request fields are required?
", dataset_name = " api_documentation ", ) for result in results: print ( result ) if __name__ == " __main__ ": asyncio. run ( main ()) Enter fullscreen mode Exit fullscreen mode 5. What Does Better API Grounding Look Like? With a searchable API memory system, the agent retrieves the exact endpoint contract before writing code:
{ "customer_id": "string", "items": [{ "sku": "string", "qty": 1 }], "currency": "USD" } Enter fullscreen mode Exit fullscreen mode Instead of guessing query params or inventing auth headers, the coding agent writes correct, production-ready integration clients on the very first try.
API documentation is only the first piece of the puzzle. Next in this Mergetober series, we will tackle database schema hallucinations by connecting Prisma ORM ( schema.prisma ) to Cognee!
What is the biggest source of hallucinations in your AI coding workflows: API contracts, database schemas, or infrastructure configs? Let me know in the comments!