Note: All code in this guide is production-ready and uses real HydraDB endpoints. Base URL: https://api.hydradb.com. Get your API key at app.hydradb.com.
Goal: Build an agent that ingests four signal types from competitor sources, verifies indexing, and answers competitive queries usingPOST /recall/full_recallwithrecency_biastuned per query type - point-in-time or trend. Full round-trip under 200ms.
Prerequisites
Required knowledge: Python basics, REST APIs, environment variablesRequired tools:
- HydraDB API key
- Python 3.11 or 3.12 (
python --version) pip install hydradb-sdk
What You’ll Build
By the end of this cookbook, you’ll be able to:- Ingest press releases, job postings, customer reviews, and earnings transcripts into a per-competitor HydraDB sub-tenant
- Verify indexing before running recall queries so you never query against stale data
- Answer point-in-time queries (“What has Acme announced about enterprise?”) using
recency_bias: 0.8 - Answer trend queries (“How has their messaging shifted since Q1?”) using
recency_bias: 0.3 - Deliver a weekly Slack briefing to sales and product channels with AI-summarized competitor signals
The Problem with Manual Competitive Research
Most competitive intelligence today is a manual process - a researcher Googles, copies links into a Notion page, and writes a monthly summary. Ask “What did Competitor X say about enterprise last quarter?” and there’s no system to answer it. Standard RAG pipelines don’t solve this either. A vector store treats a press release from 18 months ago identically to one from last week - they produce similar embeddings. Ask “how has their messaging shifted?” and you get a random mix of old and new signals with no temporal ranking. Ask “what are they announcing right now?” and stale results pollute the top of the list. HydraDB fixes this with three capabilities that standard vector search can’t replicate:- Timestamp-aware ranking - every uploaded source is ranked by recency at query time. Set
recency_bias: 0.8to surface the latest signals first. Setrecency_bias: 0.3to pull historical signals for trend comparison. - Context graph - HydraDB automatically extracts entities and links them across sources. A job posting mentioning “enterprise security”, a press release announcing an enterprise tier, and a G2 review complaining about enterprise onboarding are automatically connected - so a query about enterprise strategy surfaces all three.
- Sub-tenant isolation - each competitor gets their own
sub_tenant_idwithin a sharedcompetitive-inteltenant. Query one competitor in isolation or compare across all of them in a single call.
Architecture Overview
- Signal Sources: Press releases via RSS, job postings from LinkedIn/Greenhouse, customer reviews from G2/Capterra, earnings transcripts as plain text or PDF.
- Ingestion Layer: Connector scripts that format content and upload to HydraDB via
POST /ingestion/upload_knowledge. - HydraDB: Stores all signals with timestamps, builds a context graph, and ranks results by recency at query time.
- Analyst / Agent: A human analyst, a Slack bot, or an LLM that calls
POST /recall/full_recallwith a natural language query.
Step 1 - Create Tenant
One tenant for all competitive intelligence. Sub-tenants isolate by competitor and are created automatically on the first upload - no setup required.Sub-tenant pattern: Usesub_tenant_id: "acme-corp",sub_tenant_id: "betacorp"on every upload. This lets you query a single competitor (sub_tenant_id: "acme-corp") or all competitors at once (omitsub_tenant_id). Sub-tenants are created automatically on first write.
Step 2 - Ingest Competitor Signals
All four signal types usePOST /ingestion/upload_knowledge. This endpoint uses multipart form-data, not JSON. tenant_id and sub_tenant_id are form fields, not body keys.
Important: Do not setContent-Type: application/jsonon ingestion requests. The endpoint expectsmultipart/form-data. Let your HTTP client set the boundary automatically - only passAuthorizationin headers.
Batch limit: Max 20 sources per request. Wait 1 second between batches. Always call POST /ingestion/verify_processing before running recall - queries against unindexed sources return empty results.
The upload response looks like this for all signal types:
source_id from results[0].source_id - you need it to verify indexing.
2.1 Press Releases & Blog Posts
Press releases are the most explicit signal. Prepend signal metadata to the content so HydraDB’s graph extractor tags entities correctly and links them to related sources.2.2 Job Postings
Job postings are one of the strongest competitive signals - they reveal exactly what a company is building before any press release. A spike in “enterprise security engineer” roles signals an enterprise push. “ML platform engineer” roles signal AI product investment. Include the job title and department in the content so HydraDB’s graph links related roles across uploads.2.3 Customer Reviews (G2 / Capterra / Trustpilot)
Customer reviews are the most honest signal - they surface real objections, real pain points, and what customers actually value. None of this appears in official press releases. Negative reviews (rating ≤ 2) are especially valuable for building sales battlecards.2.4 Earnings Call Transcripts
For public competitors, earnings calls contain the most explicit strategic signals - pricing changes, market focus, competitive responses, and financial trajectory. Upload as plain text. HydraDB handles chunking and indexing automatically.Step 3 - Verify Indexing
After uploading, pollPOST /ingestion/verify_processing until indexing_status is completed. HydraDB indexes asynchronously - typically 10–30 seconds per file. Do not query until indexing is complete; unindexed sources return empty results.
Note:verify_processinguses POST withfile_idsandtenant_idas URL query parameters - not in the request body. Pass an empty JSON body{}.
Step 4 - Query: Point-in-Time Questions
UsePOST /recall/full_recall to answer “What is Competitor X doing right now?”. Set recency_bias: 0.8 so HydraDB strongly weights the most recent signals. Set mode: "thinking" to enable multi-query reranking.
Reading graph_context: The chunk_relations array shows entities HydraDB automatically extracted and linked across all your uploaded sources. A press release mentioning “AcmeShield” is connected to a job posting mentioning “SAML/SSO” and a G2 review mentioning “enterprise onboarding” - no manual tagging required. This is what surfaces all three when you ask about “enterprise strategy”.
Step 5 - Query: Trend & Temporal Questions
For trend and comparison questions, reducerecency_bias to 0.3 so HydraDB surfaces both old and new signals. This gives it the historical range it needs to answer “how has X changed?” - a question that naive RAG cannot reliably answer at all.
recency_bias guide:
0.8–1.0- Point-in-time: “What is X doing now?” Strongly weights the latest signals.0.3–0.5- Trend: “How has X changed?” Surfaces old and new for comparison.0.0- No bias: equal weight across all time periods.
Multi-competitor comparison: To compare two competitors in one query, omit sub_tenant_id entirely and ask “How does acme-corp’s enterprise positioning compare to betacorp’s?” HydraDB searches across all sub-tenants within the tenant and surfaces signals from both.
Step 6 - Weekly Briefing Agent
Push a proactive Monday-morning briefing to each analyst’s Slack channel. Each analyst profile runs a set of questions throughfull_recall with recency_bias: 0.85 to surface the freshest signals.
API Reference
All endpoints used in this cookbook. Base URL:https://api.hydradb.com · Header: Authorization: Bearer YOUR_API_KEY
Create Tenant
Upload Knowledge (form-data)
Do not use Content-Type: application/json. This is a multipart upload.
Verify Processing (URL params + empty body)
Full Recall - Point-in-Time
Full Recall - Trend
Benchmarks
Tested across 3 competitor corpora (150+ sources each: press releases, job postings, reviews, earnings PDFs). Compared against a manual analyst workflow and a naive vector search baseline.
The 28% accuracy for temporal questions in naive RAG is a structural limitation - embedding a Q2 press release and a Q4 press release produces similar vectors. They look alike semantically. HydraDB’s recency_bias parameter and timestamp-aware ranking distinguish them at query time.
Benchmark methodology: Figures are based on internal HydraDB testing. See research.hydradb.com/hydradb.pdf for the full methodology. Results will vary by corpus size, content quality, and query distribution.
File Structure
Requirements
Next Steps
- Run
setup.pyto create your tenant and verify the connection. - Run each connector script with real competitor data - start with one competitor and two signal types.
- Verify all uploads are indexed before querying.
- Run
python query/recall.pyto confirm results look correct. - Schedule
briefing/weekly.pyvia cron (0 8 * * 1) or a workflow tool like n8n.