HydraDB
The RAG engine powering this app
HydraDB is a multi-tenant vector database with hybrid recall, memory management, and an edge-native API. This page shows exactly how H1BAgent uses it to turn 30+ USCIS documents into instant, cited answers.
<80ms
Recall Latency (p50)
Full recall endpoint
~50 docs/min
Ingest Throughput
PDF extraction + embedding
High
Chunk Precision
Tunable via alpha parameter
Parallel
Concurrency
Both recall endpoints simultaneously
Bearer Token
Auth
Single API key per tenant
Edge-native
Runtime
No Node.js dependency for recall
System Architecture
How H1BAgent uses HydraDB for RAG
RAG Pipeline
End-to-end flow from data to answer
How H1BAgent Uses HydraDB
Real production architecture — not a demo
What's Inside the Knowledge Base
30+ documents ingested via upload.knowledge() and upload.addMemory()— here's what the workbench queries against
is_markdown: true and upsert: true for idempotent updates. At query time, both sources are searched in parallel via full_recall + recall_preferences, with the alpha parameter controlling the semantic vs keyword balance. The top chunks are injected into the LLM system prompt.Live Workbench
Query HydraDB in real time — tune parameters, compare endpoints
Core Capabilities
Click to expand code examples and implementation details
Every tenant gets its own isolated namespace. Sub-tenants enable hierarchical data organization — perfect for per-user, per-org, or per-project knowledge separation.
// Create isolated tenant
await hydra.tenant.create({
tenant_id: "H1B"
});
// Data always scoped to tenant
await hydra.upload.knowledge({
files: [pdfBuffer],
tenant_id: "H1B",
// Optional sub-tenant for finer isolation
sub_tenant_id: "user_123"
});- +Complete data isolation between tenants
- +Hierarchical sub-tenant support for nested workspaces
- +409 conflict handling for idempotent tenant creation
- +Tenant-scoped queries — no data leakage across boundaries
With HydraDB vs. Without
const result = streamText({
model: google("gemini-2.0-flash"),
system: "You are an H-1B expert.",
// No context — LLM hallucinates
// outdated data, wrong numbers
messages,
});LLM invents numbers, cites non-existent reports, mixes up fiscal years
// Retrieve grounding context
const chunks = await hydraRecall(query);
const result = streamText({
model: google("gemini-2.0-flash"),
system: `You are an H-1B expert.
## Retrieved USCIS Data:
${chunks.join("\n---\n")}`,
messages,
});Every answer grounded in official USCIS data with correct fiscal year citations