Skip to main content
This guide walks you through building a competitive intelligence agent with persistent temporal memory powered by HydraDB. Unlike a static market research doc or a naive RAG pipeline, this agent continuously ingests competitor signals and answers both point-in-time questions (“What has Acme Corp announced about enterprise?”) and trend questions (“How has their pricing messaging shifted since Q1?”) - with full context across press releases, job postings, customer reviews, and earnings calls unified in one retrieval layer.
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 using POST /query with recency_bias tuned per query type - point-in-time or trend. Full round-trip under 200ms.

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

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 collection
  • Verify indexing before running search 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:
  1. Timestamp-aware ranking - every uploaded source is ranked by recency at query time. Set recency_bias: 0.8 to surface the latest signals first. Set recency_bias: 0.3 to pull historical signals for trend comparison.
  2. 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.
  3. Collection isolation - each competitor gets their own collection within a shared competitive-intel database. 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 /context/ingest.
  • 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 /query with a natural language query.

Step 1 - Create Database

One database for all competitive intelligence. Collections isolate by competitor and are created automatically on the first upload - no setup required.
Output:
Collection pattern: Use collection: "acme-corp", collection: "betacorp" on every upload. This lets you query a single competitor (collection: "acme-corp") or all competitors at once (omit collection). Collections are created automatically on first write.

Step 2 - Ingest Competitor Signals

All four signal types use POST /context/ingest. This endpoint uses multipart form-data, not JSON. database and collection are form fields, not body keys.
Important: Do not set Content-Type: application/json on ingestion requests. The endpoint expects multipart/form-data. Let your HTTP client set the boundary automatically - only pass Authorization in headers.
Batch limit: Max 20 sources per request. Wait 1 second between batches. Always call GET /context/status before running search - queries against unindexed sources return empty results.
The upload response looks like this for all signal types:
Save the id from results[0].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, poll GET /context/status 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: GET /context/status takes ids and database as query parameters. Pass multiple ids to check a batch in one call.
Response when indexed:
Output (typical run with 1 source):

Step 4 - Query: Point-in-Time Questions

Use POST /query 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.
Response structure:
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, reduce recency_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 collection entirely and ask “How does acme-corp’s enterprise positioning compare to betacorp’s?” HydraDB searches across all collections within the database 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 through /query 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 Database

Upload Knowledge (form-data)

Do not use Content-Type: application/json. This is a multipart upload.

Verify Processing (query params)

Full Search - Point-in-Time

Full Search - 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

  1. Run setup.py to create your database and verify the connection.
  2. Run each connector script with real competitor data - start with one competitor and two signal types.
  3. Verify all uploads are indexed before querying.
  4. Run python query/search.py to confirm results look correct.
  5. Schedule briefing/weekly.py via cron (0 8 * * 1) or a workflow tool like n8n.
The agent improves as you add more signals - each new press release, job posting, or review adds to the context graph that HydraDB builds automatically. There is no retraining step. Run the connector scripts on a schedule and the intelligence layer stays current without any manual curation.