Skip to main content
An IT question like “why did we change the VPN policy?” may span a Slack discussion, a Confluence incident report, and a Notion runbook. HydraDB links those workspace sources in a context graph. POST /query returns relevant chunks for your application to pass to an LLM. It also returns graph context, which you can add to the prompt when you need those relationships.
API setup: Base URL: https://api.hydradb.com. Get your API key at app.hydradb.com.

Prerequisites

Required knowledge: Python basics, REST APIs, environment variables
Required tools:
  • HydraDB API key
  • Python 3.11 or 3.12 (python --version)
  • pip install hydradb-sdk
Per-source dependencies. Each connector below needs its own client library and credentials. Install and export only the ones you actually wire up: the snippets read these directly, so a missing one fails immediately:

What You’ll Build

By the end of this cookbook, you’ll be able to:
  • Ingest Notion pages, Confluence docs, and Slack threads into a unified HydraDB workspace
  • Answer “why did we decide X?” by retrieving decision context across linked documents
  • Batch-upload documents with verified indexing before any search query
  • Build a conversational interface grounded in your team’s actual knowledge

How HydraDB Works

Before writing code, understand the three primitives you’ll use throughout this cookbook:
  • Database: your workspace. All data is isolated per database. Think of it as your “company” in HydraDB. Create one per application.
  • Memory: any unit of context: a Notion page, a Confluence doc, a Slack thread, a user preference. HydraDB automatically chunks, embeds, and connects memories into a context graph.
  • Search: the retrieval call your agent makes before acting. HydraDB’s search runs a multi-stage pipeline: metadata filtering, then graph traversal, then semantic retrieval, then personalized ranking.
LongMemEvals search accuracy: 90%

Step 01: Create a Database

Every HydraDB workspace starts with a database. Create one for your knowledge base; it provides complete data isolation and multi-tenant support out of the box. Endpoint: POST /databases: create your workspace

Bash

Python

Collections for teams: Use collection to isolate data by department. Engineering, Sales, HR each get their own namespace within your database. No configuration needed; just pass the ID on upload.

Step 02: Upload Knowledge Memories

HydraDB automatically parses, chunks, embeds, and connects your content into a context graph. You don’t manage embeddings or vector indexes. You just upload.

Notion Connector

Fetch pages from Notion, format them into HydraDB’s app source structure, and batch upload. HydraDB builds the context graph automatically; no edge creation needed.
Batch size: Send about 20 sources per request and wait 1 second between batches to stay under your plan’s rate limits. An oversized batch returns 413; throttling returns 429.

Confluence Connector

Confluence pages follow the same upload format. Set additional_metadata.source to "confluence" so you can filter to Confluence at search time.

Verify Indexing

After uploading, always verify that HydraDB has fully processed and indexed your content before running search queries. A source is searchable from graph_creation; the code below waits for completed and stops on errored. Endpoint: GET /context/status?ids=ID&database=DATABASE: check indexing status

Step 03: Add User Memories

Beyond documents, HydraDB stores user memories: preferences, habits, and patterns that personalize search per user. Set infer: true to let HydraDB extract implicit signals from text. Set infer: false to store facts verbatim. Endpoint: POST /context/ingest: add a user memory

Bash

Python

After a few interactions, HydraDB builds a behavioral model per user. To use it, query the user’s collection with type: "memory" (see Search user memories) and pass the results to your LLM along with the knowledge context. A knowledge query on another collection does not read them.

Step 04: Search Context

This is the call your agent makes before answering any question. POST /query runs HydraDB’s full multi-stage pipeline and returns ranked, contextually relevant chunks, including graph context showing relationships between entities. Endpoint: POST /query: retrieve agent context

Step 05: Search and Answer Generation

For conversational, AI-generated answers, first retrieve context with POST /query. Then pass the returned chunks and sources into your application-layer LLM prompt. Key parameters: alpha (0-1, balance semantic vs keyword bm25), recency_bias (0-1, prefer newer content), and graph_context. The source filter below matches the additional_metadata.source value set on each item at upload. Endpoint: POST /query: retrieved context for app-layer answer generation
Maintaining conversation context: Store chat history in your application and include relevant prior turns in your LLM prompt. HydraDB returns retrieval context; your app owns the final answer and conversation state.

Step 06: Slack Interface

Expose your knowledge base as a Slack bot. When a user mentions @wiki, the bot calls ask_workspace() to retrieve context, then your application can pass that context to an LLM for the final Slack response.

API Reference

All endpoints used in this cookbook. Base URL: https://api.hydradb.com. Header: Authorization: Bearer YOUR_API_KEY

Database management

POST /databases: create workspace (returns 409 if it already exists)

Upload app sources (Notion, Slack, Confluence…)

POST /context/ingest: sent as the app_knowledge form field (a JSON string array). About 20 per call, 1s between batches

Upload a single file (PDF / DOCX)

POST /context/ingest: single file with database as form field

Verify processing

GET /context/status?ids=ID&database=YOUR_DATABASE: poll until status = “completed” POST /query: searches knowledge base, returns chunks + graph_context

Search for answer generation

POST /query: retrieved context for app-layer answer generation

Add user memory

POST /context/ingest: multipart form with type=memory; memories is a JSON string array

Search user memories

POST /query: type: "memory", scoped to the user’s collection

Delete memory

DELETE /context: remove stale or incorrect memory data with type: "memory", the ids to delete, and the collection they live in (omitting collection targets the default collection)

Benchmarks

HydraDB leads LongMemEvals with 90% search accuracy. Compared to a naive RAG pipeline over the same 12,400-document corpus:
Benchmark methodology. Figures are based on internal HydraDB testing. For the formal benchmark paper see research.hydradb.com/hydradb.pdf. Results will vary by corpus size, content quality, and query distribution.