behive 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
behive-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 qa10devteam
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
behive-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,632 @@
1
+ Metadata-Version: 2.4
2
+ Name: behive
3
+ Version: 0.1.0
4
+ Summary: Research engine that builds structured knowledge graphs from any topic
5
+ Author-email: QA10 <hello@qa10.io>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/qa10devteam/behive
8
+ Project-URL: Documentation, https://behive.dev
9
+ Project-URL: Repository, https://github.com/qa10devteam/behive
10
+ Keywords: research,knowledge-graph,ai,mcp,deep-research
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: aiohttp>=3.9
22
+ Requires-Dist: boto3>=1.28
23
+ Requires-Dist: psycopg2-binary>=2.9
24
+ Requires-Dist: pydantic>=2.0
25
+ Requires-Dist: httpx>=0.25
26
+ Provides-Extra: mcp
27
+ Requires-Dist: fastmcp>=3.0; extra == "mcp"
28
+ Provides-Extra: api
29
+ Requires-Dist: fastapi>=0.100; extra == "api"
30
+ Requires-Dist: uvicorn>=0.20; extra == "api"
31
+ Provides-Extra: qdrant
32
+ Requires-Dist: qdrant-client>=1.7; extra == "qdrant"
33
+ Requires-Dist: sentence-transformers>=2.2; extra == "qdrant"
34
+ Provides-Extra: all
35
+ Requires-Dist: behive[api,mcp,qdrant]; extra == "all"
36
+ Provides-Extra: dev
37
+ Requires-Dist: pytest>=7.0; extra == "dev"
38
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
39
+ Dynamic: license-file
40
+
41
+ <p align="center">
42
+ <img src="demo.gif" alt="BeHive โ€” Deep Research Engine" width="720" />
43
+ </p>
44
+
45
+ <h1 align="center">๐Ÿ BeHive</h1>
46
+
47
+ <p align="center">
48
+ <strong>Open-source research engine that extracts structured knowledge from any topic.</strong><br />
49
+ Feed it a question. Get back scored claims, entity graphs, and a synthesized report โ€” not paragraphs of slop.
50
+ </p>
51
+
52
+ <p align="center">
53
+ <a href="https://pypi.org/project/behive"><img src="https://img.shields.io/badge/pip_install-behive-FFB300?style=for-the-badge&logo=python&logoColor=white" /></a>
54
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-22c55e?style=for-the-badge" /></a>
55
+ <a href="https://api.yu-na.io/docs"><img src="https://img.shields.io/badge/API-Live-4FC3F7?style=for-the-badge&logo=fastapi&logoColor=white" /></a>
56
+ <a href="#mcp-integration"><img src="https://img.shields.io/badge/MCP-Native-AB47BC?style=for-the-badge" /></a>
57
+ </p>
58
+
59
+ <p align="center">
60
+ <a href="#quick-start">Quick Start</a> โ€ข
61
+ <a href="#use-with-claude--chatgpt--gemini">Use with AI Assistants</a> โ€ข
62
+ <a href="#benchmarks">Benchmarks</a> โ€ข
63
+ <a href="#architecture">Architecture</a> โ€ข
64
+ <a href="#api-reference">API</a> โ€ข
65
+ <a href="#mcp-integration">MCP</a>
66
+ </p>
67
+
68
+ ---
69
+
70
+ ## The Problem
71
+
72
+ You ask Claude to research a topic. It gives you a confident-sounding summary based on training data that's months old. No sources. No structure. No way to verify.
73
+
74
+ You ask Perplexity. Better โ€” it cites sources. But the output is still unstructured text. You can't query it, cross-reference it, or build on it.
75
+
76
+ **BeHive is different.** It produces **machine-readable intelligence**: typed claims with confidence scores, entity relationship graphs, and structured JSON you can pipe into any downstream system.
77
+
78
+ ```
79
+ Your AI assistant โ†’ BeHive โ†’ Verified, structured, scored knowledge
80
+ โ”œโ”€โ”€ 363 claims (avg quality 0.824)
81
+ โ”œโ”€โ”€ 42 entities with relationships
82
+ โ””โ”€โ”€ Synthesized report with citations
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Quick Start
88
+
89
+ ```bash
90
+ pip install behive
91
+
92
+ # Configure your LLM (pick one)
93
+ export BEHIVE_LLM=bedrock # AWS Bedrock Claude (recommended)
94
+ export BEHIVE_LLM=openai # OpenAI GPT-4o
95
+ export BEHIVE_LLM=local # Self-hosted via SGLang/vLLM
96
+
97
+ # Run research from CLI
98
+ behive research "NVIDIA Blackwell GPU production 2026" --scale 30
99
+
100
+ # Or from Python
101
+ python -c "
102
+ from behive import research
103
+ import asyncio
104
+
105
+ result = asyncio.run(research('NVIDIA Blackwell GPU production 2026'))
106
+ print(f'{result.claims_count} claims, avg quality {result.avg_quality:.3f}')
107
+ for claim in result.top_claims(5):
108
+ print(f' [{claim.score:.2f}] {claim.text}')
109
+ "
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Use with Claude / ChatGPT / Gemini
115
+
116
+ BeHive turns any AI assistant into a **verified research machine**. Three integration paths:
117
+
118
+ ### ๐ŸŸฃ Claude (via MCP โ€” zero-code)
119
+
120
+ Add to your Claude Desktop `config.json` or Cursor settings:
121
+
122
+ ```json
123
+ {
124
+ "mcpServers": {
125
+ "behive": {
126
+ "url": "http://localhost:8090/mcp",
127
+ "transport": "streamable-http"
128
+ }
129
+ }
130
+ }
131
+ ```
132
+
133
+ Now Claude can call BeHive natively:
134
+
135
+ > **You:** "Research the EU Carbon Border Adjustment Mechanism โ€” what are the compliance deadlines and industry impacts?"
136
+ >
137
+ > **Claude** *(calls `research_topic`)* **:** "I've launched a deep research mission. BeHive found 312 claims across 156 sources. Here are the key findings, scored by confidence:
138
+ > - [0.94] CBAM transitional phase runs Jan 2024โ€“Dec 2025; full enforcement begins Jan 2026
139
+ > - [0.91] Importers must purchase CBAM certificates matching embedded COโ‚‚ at EU ETS price
140
+ > - [0.88] Steel, cement, aluminium, fertilizers, electricity, and hydrogen are covered sectors
141
+ > ..."
142
+
143
+ Claude's responses shift from "based on my training data" to **"verified against 156 live sources with per-claim confidence scores."**
144
+
145
+ ### ๐ŸŸข ChatGPT (via Custom GPT / Function Calling)
146
+
147
+ Create a Custom GPT with this action:
148
+
149
+ ```yaml
150
+ openapi: 3.0.0
151
+ info:
152
+ title: BeHive Research
153
+ version: 1.0.0
154
+ servers:
155
+ - url: https://your-server.com/api/v1
156
+ paths:
157
+ /research:
158
+ post:
159
+ operationId: startResearch
160
+ requestBody:
161
+ content:
162
+ application/json:
163
+ schema:
164
+ type: object
165
+ properties:
166
+ query:
167
+ type: string
168
+ depth:
169
+ type: integer
170
+ default: 3
171
+ responses:
172
+ '200':
173
+ description: Mission started
174
+ /research/{job_id}/report:
175
+ get:
176
+ operationId: getReport
177
+ parameters:
178
+ - name: job_id
179
+ in: path
180
+ required: true
181
+ schema:
182
+ type: string
183
+ responses:
184
+ '200':
185
+ description: Research report
186
+ ```
187
+
188
+ Or call from the OpenAI API with function calling:
189
+
190
+ ```python
191
+ import openai
192
+ import requests
193
+
194
+ # Start BeHive research
195
+ mission = requests.post("http://localhost:8091/research", json={
196
+ "query": "Quantum computing error correction breakthroughs 2026",
197
+ "depth": 3
198
+ }).json()
199
+
200
+ # Wait for completion, then feed to GPT-4o
201
+ report = requests.get(f"http://localhost:8091/research/{mission['job_id']}/report").json()
202
+
203
+ response = openai.chat.completions.create(
204
+ model="gpt-4o",
205
+ messages=[
206
+ {"role": "system", "content": "You are an analyst. Use the research data below to answer questions. Cite claim IDs."},
207
+ {"role": "user", "content": f"Research data:\n{report['synthesis']}\n\nQuestion: What's the most promising approach to fault-tolerant quantum computing?"}
208
+ ]
209
+ )
210
+ ```
211
+
212
+ ### ๐Ÿ”ต Gemini (via API or Vertex AI)
213
+
214
+ ```python
215
+ import google.generativeai as genai
216
+ import requests
217
+
218
+ # BeHive produces the research
219
+ claims = requests.get("http://localhost:8091/search", params={
220
+ "query": "autonomous vehicles regulations 2026",
221
+ "limit": 50
222
+ }).json()
223
+
224
+ # Gemini synthesizes with verified data
225
+ model = genai.GenerativeModel("gemini-2.0-flash")
226
+ response = model.generate_content(
227
+ f"Based on these verified research claims (each with a confidence score), "
228
+ f"write a briefing on autonomous vehicle regulation trends:\n\n"
229
+ f"{claims['results']}"
230
+ )
231
+ ```
232
+
233
+ ### Why this matters
234
+
235
+ | Without BeHive | With BeHive |
236
+ |---|---|
237
+ | "Based on my training data..." | "Based on 234 live sources, scored 0.79 avg..." |
238
+ | Hallucination risk | Every claim traced to source URL |
239
+ | Stale knowledge (months old) | Real-time web research |
240
+ | Unstructured text blob | Typed claims, entities, relationships |
241
+ | One-shot, forgotten | Cumulative knowledge graph across sessions |
242
+
243
+ ---
244
+
245
+ ## Drone Arsenal
246
+
247
+ BeHive doesn't just search the web. It deploys **stealth drones** โ€” multi-layered fetch agents that break through anti-bot defenses, paywalls, and rate limits.
248
+
249
+ ### 8-Layer Evasion Stack
250
+
251
+ Every URL goes through an **escalation cascade**. If Layer 1 gets blocked, Layer 2 fires. All the way to Layer 8.
252
+
253
+ ```
254
+ Layer 1 โ”‚ DIRECT โ€” aiohttp + full Chrome 131 headers
255
+ Layer 2 โ”‚ UA ROTATION โ€” 10 browser fingerprints (Chrome/Firefox/Safari/Edge)
256
+ Layer 3 โ”‚ curl_cffi โ€” TLS impersonation (JA3/JA4 fingerprint matching)
257
+ Layer 4 โ”‚ primp โ€” Rust-native TLS, newer fingerprints than curl_cffi
258
+ Layer 5 โ”‚ nodriver โ€” Headless Chrome via CDP, passes Cloudflare Bot Management
259
+ Layer 6 โ”‚ patchright โ€” Stealth Playwright (no Runtime.enable/Console.enable leak)
260
+ Layer 7 โ”‚ Jina relay โ€” r.jina.ai proxy (paywall + captcha bypass)
261
+ Layer 8 โ”‚ Archives โ€” Wayback Machine + archive.org fallback
262
+ ```
263
+
264
+ ### What they bypass
265
+
266
+ | Defense | How |
267
+ |---------|-----|
268
+ | Cloudflare | Detected โ†’ escalate to nodriver/patchright (JS challenge solved) |
269
+ | DataDome | TLS fingerprint rotation (primp/curl_cffi) |
270
+ | Akamai Bot Manager | CDP-based headless + real browser UA pool |
271
+ | Rate limits | Automatic backoff + UA rotation + parallel diversification |
272
+ | Paywalls | Jina relay proxy + archive.org cache |
273
+ | Turnstile CAPTCHA | patchright stealth Playwright |
274
+ | 403/429 blocks | Smart retry with escalation, never hammer the same layer |
275
+
276
+ ### Parallel fetch architecture
277
+
278
+ ```
279
+ โ”Œโ”€โ”€โ”€ HEAD sweep (974+ URLs, async semaphore) โ”€โ”€โ”€โ”
280
+ โ”‚ โ”‚
281
+ โ–ผ โ–ผ
282
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
283
+ โ”‚ Resource Router โ”‚ โ”‚ Domain Recon โ”‚
284
+ โ”‚ (8 resource โ”‚ โ”‚ (tier scoring โ”‚
285
+ โ”‚ types detected)โ”‚ โ”‚ reputation) โ”‚
286
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
287
+ โ”‚ โ”‚
288
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
289
+ โ–ผ โ–ผ โ–ผ โ–ผ โ–ผ
290
+ api_bee pdf_drone std_drone heavy_drone domain_score
291
+ (70 APIs) (VLM parse) (Layer 1-8) (patchright) (0.0 - 1.0)
292
+ ```
293
+
294
+ **Routing decisions per resource type:**
295
+ - `api_endpoint` โ†’ Direct API bee (structured JSON, no parsing needed)
296
+ - `pdf` โ†’ PDF drone (Vision LLM extraction)
297
+ - `static_html` โ†’ Standard drone (Layer 1-4 usually sufficient)
298
+ - `spa` โ†’ Heavy drone (Layer 5-6, needs JS execution)
299
+ - `paywall` โ†’ Jina relay or archive fallback
300
+ - `rss_feed` โ†’ RSS bee (structured, fast)
301
+ - `database_portal` โ†’ Dedicated connector (custom scraping logic)
302
+
303
+ ### 70+ API Sources
304
+
305
+ Scout bees don't just Google. They query **specialized APIs** across 37 categories:
306
+
307
+ | Category | APIs | Examples |
308
+ |----------|------|----------|
309
+ | Academic | 5 | arXiv, Semantic Scholar, CrossRef, OpenAlex, CORE |
310
+ | Financial | 6 | SEC EDGAR, Yahoo Finance, FRED, ECB, World Bank |
311
+ | Government | 5 | TED (EU procurement), SAM.gov, UK FTS, BZP (Poland), GUS |
312
+ | Security | 6 | CVE/NVD, Shodan, VirusTotal, AbuseIPDB |
313
+ | Development | 8 | GitHub, npm, PyPI, crates.io, Docker Hub, Homebrew |
314
+ | ML/AI | 5 | HuggingFace, Papers With Code, Replicate, Ollama |
315
+ | News | 4 | NewsAPI, GNews, TheNewsAPI, Mediastack |
316
+ | Crypto | 2 | CoinGecko, CoinMarketCap |
317
+ | Patents | 1 | Google Patents (via SerpAPI) |
318
+ | Medical | 1 | PubMed/NCBI |
319
+ | ... | 25+ | Trade, geopolitics, environment, demographics, ... |
320
+
321
+ **Total: 70 APIs, 125 endpoints** โ€” each checked per-mission based on topic relevance.
322
+
323
+ ---
324
+
325
+ ## Benchmarks
326
+
327
+ Real results. No cherry-picking. Scale 30 (standard depth).
328
+
329
+ **Hardware:** EC2 g6.24xlarge โ€” 4ร— NVIDIA L4 (92 GB VRAM), 96 vCPU, 384 GB RAM
330
+ **Models:** Bedrock Claude Haiku (bulk extraction) + Sonnet (enrichment), SGLang/Qwen on local GPUs
331
+
332
+ | Topic | Claims | Avg Quality | Duration | Sources |
333
+ |:------|-------:|:-----------:|---------:|--------:|
334
+ | NVIDIA GPU market 2026 | 290 | **0.797** | 8 min | 234 |
335
+ | OpenAI GPT-5 capabilities | 574 | **0.789** | 12 min | 174 |
336
+ | EU AI Act enforcement | 267 | **0.759** | 6 min | 130 |
337
+ | Perplexity AI business model | 267 | **0.759** | 7 min | 150 |
338
+ | Meta Llama 4 architecture | 568 | **0.821** | 11 min | 198 |
339
+
340
+ **Quality score meaning:**
341
+ - `0.90+` โ€” Exceptional: specific numbers, dates, sources, fully verifiable
342
+ - `0.82+` โ€” Excellent: multi-dimensional, publication-ready
343
+ - `0.75+` โ€” Good: useful intelligence with some specifics
344
+ - `0.65+` โ€” Acceptable: general facts, entered into DB
345
+ - `<0.55` โ€” Rejected: too vague, not stored
346
+
347
+ > **Honest scoring, no tricks.** No sigmoid rescaling, no artificial inflation. The score is a weighted average of specificity, information density, uniqueness, verifiability, and structure.
348
+
349
+ ---
350
+
351
+ ## Architecture
352
+
353
+ ```
354
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
355
+ โ”‚ BeHive Pipeline โ”‚
356
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
357
+ โ”‚
358
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
359
+ โ–ผ โ–ผ โ–ผ โ–ผ โ–ผ โ–ผ
360
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
361
+ โ”‚ SCOUT โ”‚ โ”‚ HARVEST โ”‚ โ”‚ PROCESS โ”‚ โ”‚ V4 โ”‚ โ”‚ SYNTH โ”‚ โ”‚ GRAPH โ”‚
362
+ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚
363
+ โ”‚ Queen โ”‚ โ”‚ Parallelโ”‚ โ”‚ BeeHive โ”‚ โ”‚ Haiku โ”‚ โ”‚ Claude โ”‚ โ”‚ Neo4j โ”‚
364
+ โ”‚ plans โ”‚ โ”‚ HTTP โ”‚ โ”‚ fast โ”‚ โ”‚ extract โ”‚ โ”‚ report โ”‚ โ”‚ entity โ”‚
365
+ โ”‚ 5 axes โ”‚ โ”‚ 1000+ โ”‚ โ”‚ extract โ”‚ โ”‚ + Sonnet โ”‚ โ”‚ + cite โ”‚ โ”‚ fuse โ”‚
366
+ โ”‚ ร— N โ”‚ โ”‚ URLs โ”‚ โ”‚ + score โ”‚ โ”‚ enrich โ”‚ โ”‚ โ”‚ โ”‚ โ”‚
367
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
368
+ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚
369
+ โ”‚ โ”‚ โ–ผ โ”‚ โ”‚ โ”‚
370
+ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚
371
+ โ”‚ โ”‚ โ”‚ Quality Gate โ”‚ โ”‚ โ”‚ โ”‚
372
+ โ”‚ โ”‚ โ”‚ conf โ‰ฅ 0.55 โ”‚ โ”‚ โ”‚ โ”‚
373
+ โ”‚ โ”‚ โ”‚ dedup 0.60 โ”‚ โ”‚ โ”‚ โ”‚
374
+ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚
375
+ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚
376
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
377
+ โ”‚
378
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
379
+ โ”‚ PostgreSQL โ”‚
380
+ โ”‚ Claims + KG โ”‚
381
+ โ”‚ 25K+ records โ”‚
382
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
383
+ ```
384
+
385
+ **What makes it different from GPT-Researcher:**
386
+
387
+ 1. **Dual-model extraction** โ€” Fast model (Haiku) for bulk extraction, powerful model (Sonnet) for enriching thin claims. Not just "summarize this page."
388
+ 2. **Quality scoring** โ€” Every claim gets a 0.0-1.0 score. Below threshold = rejected. No filler.
389
+ 3. **Knowledge graph** โ€” Entities and relationships persist across missions. Research compounds.
390
+ 4. **70+ API sources** โ€” Not just web search. SEC filings, arXiv, patent databases, government APIs.
391
+ 5. **Deduplication** โ€” Jaccard 0.60 threshold prevents the same fact from different sources inflating counts.
392
+
393
+ ---
394
+
395
+ ## API Reference
396
+
397
+ BeHive exposes a REST API (port 8091) and MCP server (port 8090).
398
+
399
+ ### Start Research
400
+
401
+ ```bash
402
+ curl -X POST http://localhost:8091/research \
403
+ -H "Content-Type: application/json" \
404
+ -d '{
405
+ "query": "SpaceX Starship launch cadence 2026",
406
+ "depth": 3,
407
+ "scale": 30
408
+ }'
409
+ # โ†’ {"job_id": "hive_1785227949_815112", "status": "started"}
410
+ ```
411
+
412
+ ### Stream Progress (SSE)
413
+
414
+ ```bash
415
+ curl -N http://localhost:8091/research/hive_1785227949_815112/events
416
+ ```
417
+
418
+ ```
419
+ event: start
420
+ data: {"topic": "SpaceX Starship...", "status": "scout"}
421
+
422
+ event: phase
423
+ data: {"phase": "process", "event": "started"}
424
+
425
+ event: claims
426
+ data: {"count": 142, "avg_quality": 0.791, "above_082": 23, "new_since_last": 18}
427
+
428
+ event: done
429
+ data: {"total_claims": 363, "avg_quality": 0.824, "sources": 64}
430
+ ```
431
+
432
+ ### Get Report
433
+
434
+ ```bash
435
+ curl http://localhost:8091/research/hive_1785227949_815112/report
436
+ # โ†’ {"synthesis": "## SpaceX Starship...", "claims_count": 363, ...}
437
+ ```
438
+
439
+ ### Search Knowledge
440
+
441
+ ```bash
442
+ # Full-text search across all missions
443
+ curl "http://localhost:8091/search?query=NVIDIA+revenue&limit=20"
444
+
445
+ # Entity intelligence
446
+ curl http://localhost:8091/intelligence/entity/NVIDIA
447
+
448
+ # Network graph (2-hop neighborhood)
449
+ curl "http://localhost:8091/intelligence/network/OpenAI?depth=2"
450
+ ```
451
+
452
+ ### All Endpoints
453
+
454
+ | Method | Path | Description |
455
+ |--------|------|-------------|
456
+ | `POST` | `/research` | Start new mission |
457
+ | `GET` | `/research/{id}/status` | Check progress |
458
+ | `GET` | `/research/{id}/events` | SSE stream |
459
+ | `GET` | `/research/{id}/report` | Get synthesis |
460
+ | `GET` | `/search` | Query claims |
461
+ | `GET` | `/intelligence/entity/{name}` | Entity details |
462
+ | `GET` | `/intelligence/network/{name}` | Relationship graph |
463
+ | `GET` | `/intelligence/stats` | System statistics |
464
+
465
+ Full Swagger docs: `http://localhost:8091/docs`
466
+
467
+ ---
468
+
469
+ ## MCP Integration
470
+
471
+ BeHive implements the [Model Context Protocol](https://modelcontextprotocol.io) โ€” the emerging standard for AI tool connectivity.
472
+
473
+ ```json
474
+ {
475
+ "mcpServers": {
476
+ "behive": {
477
+ "url": "http://localhost:8090/mcp",
478
+ "transport": "streamable-http"
479
+ }
480
+ }
481
+ }
482
+ ```
483
+
484
+ **Compatible with:**
485
+ - Claude Desktop / Claude Code
486
+ - Cursor IDE
487
+ - Windsurf
488
+ - n8n (via MCP node)
489
+ - Any MCP-compatible client
490
+
491
+ **Tools exposed:**
492
+
493
+ | Tool | Description |
494
+ |------|-------------|
495
+ | `research_topic` | Start deep research on any topic |
496
+ | `mission_status` | Poll progress (phase, quality, claims) |
497
+ | `get_report` | Get the synthesized markdown report |
498
+ | `search_knowledge` | Query claims across all missions |
499
+ | `list_missions` | See completed research history |
500
+
501
+ ---
502
+
503
+ ## Self-Hosting
504
+
505
+ ### Requirements
506
+
507
+ - Python 3.10+
508
+ - PostgreSQL 14+ (claims storage)
509
+ - LLM access (Bedrock, OpenAI, or local SGLang/vLLM)
510
+ - Optional: Neo4j (knowledge graph), Qdrant (embeddings)
511
+
512
+ ### Docker (coming soon)
513
+
514
+ ```bash
515
+ docker compose up -d
516
+ behive research "your topic" --scale 30
517
+ ```
518
+
519
+ ### Manual Setup
520
+
521
+ ```bash
522
+ git clone https://github.com/qa10devteam/behive.git
523
+ cd behive
524
+ pip install -e .
525
+
526
+ # PostgreSQL
527
+ createdb hive
528
+ behive db init
529
+
530
+ # Configure
531
+ export BEHIVE_DB_URL="postgresql://user:pass@localhost:5432/hive"
532
+ export BEHIVE_LLM=bedrock # or openai, local
533
+
534
+ # Start services
535
+ behive api start # REST API on :8091
536
+ behive mcp start # MCP server on :8090
537
+ ```
538
+
539
+ ---
540
+
541
+ ## How It Works (for humans)
542
+
543
+ 1. **You give it a topic.** "NVIDIA GPU market 2026"
544
+
545
+ 2. **Scout bees plan the research.** The Queen decomposes it into 5 axes (market share, financials, products, competition, supply chain). Generates 12-14 search queries per axis. Checks 70+ APIs.
546
+
547
+ 3. **Harvest bees collect sources.** Parallel HTTP fetches ~1000 URLs. HEAD sweep first (fast), then full content extraction on promising ones. Typically lands 60-90 usable documents.
548
+
549
+ 4. **Worker bees extract claims.** This is where BeHive shines:
550
+ - Every document gets parsed into atomic, verifiable claims
551
+ - Each claim scored on 5 dimensions (specificity, density, uniqueness, verifiability, structure)
552
+ - Claims below 0.55 quality โ†’ rejected
553
+ - Thin claims (missing dates/numbers) โ†’ enriched by Sonnet
554
+ - Duplicate claims (Jaccard >0.60) โ†’ merged
555
+
556
+ 5. **The Queen synthesizes.** Claude weaves the verified claims into a structured report with inline citations. No hallucination โ€” every statement maps to a scored claim.
557
+
558
+ 6. **Knowledge graph grows.** Entities (companies, people, products, amounts) and their relationships are stored in Neo4j. Next research mission on a related topic starts with existing context.
559
+
560
+ ---
561
+
562
+ ## Configuration
563
+
564
+ | Variable | Default | Description |
565
+ |----------|---------|-------------|
566
+ | `BEHIVE_DB_URL` | `postgresql://localhost/hive` | PostgreSQL connection |
567
+ | `BEHIVE_LLM` | `bedrock` | LLM provider: `bedrock`, `openai`, `local` |
568
+ | `BEHIVE_LLM_URL` | โ€” | Local LLM endpoint (for `local` mode) |
569
+ | `BEHIVE_NEO4J_URI` | `bolt://localhost:7687` | Neo4j (optional) |
570
+ | `BEHIVE_QDRANT_URL` | `http://localhost:6333` | Qdrant (optional) |
571
+ | `BEHIVE_SCALE` | `30` | Default research scale (30-300) |
572
+ | `BEHIVE_QUALITY_GATE` | `0.55` | Minimum claim quality to store |
573
+ | `AWS_PROFILE` | `default` | For Bedrock authentication |
574
+ | `OPENAI_API_KEY` | โ€” | For OpenAI mode |
575
+
576
+ ---
577
+
578
+ ## Comparison
579
+
580
+ | | BeHive | GPT-Researcher | Tavily | Perplexity | STORM |
581
+ |---|:---:|:---:|:---:|:---:|:---:|
582
+ | Output format | Structured JSON | Markdown text | JSON snippets | Text | Wiki article |
583
+ | Per-claim scoring | โœ… 0.0-1.0 | โŒ | โŒ | โŒ | โŒ |
584
+ | Knowledge graph | โœ… Neo4j | โŒ | โŒ | โŒ | โŒ |
585
+ | Cross-session memory | โœ… Cumulative | โŒ | โŒ | โŒ | โŒ |
586
+ | MCP native | โœ… | โŒ | โŒ | โŒ | โŒ |
587
+ | API sources (70+) | โœ… | โŒ Web only | โš ๏ธ Search | โš ๏ธ Search | โŒ Web only |
588
+ | Self-hosted | โœ… Full | โš ๏ธ Needs API keys | โŒ Cloud | โŒ Cloud | โœ… |
589
+ | Quality deduplication | โœ… Jaccard 0.60 | โŒ | โŒ | โŒ | โŒ |
590
+ | SSE streaming | โœ… Real-time | โŒ | โŒ | โŒ | โŒ |
591
+ | Pricing | **Free (MIT)** | Free (MIT) | $0.01/search | $20/mo+ | Free (MIT) |
592
+
593
+ ---
594
+
595
+ ## Roadmap
596
+
597
+ - [x] V4 pipeline (Haiku + Sonnet extraction)
598
+ - [x] Quality scoring (avg 0.82+ achieved)
599
+ - [x] REST API (27 endpoints)
600
+ - [x] MCP Server (Streamable HTTP)
601
+ - [x] SSE streaming (real-time progress)
602
+ - [x] Knowledge graph (Neo4j)
603
+ - [x] 70+ API sources
604
+ - [ ] `pip install behive` (PyPI)
605
+ - [ ] Docker Compose one-liner
606
+ - [ ] n8n community node
607
+ - [ ] Web UI dashboard
608
+ - [ ] Multi-tenant API keys
609
+ - [ ] Webhook callbacks
610
+
611
+ ---
612
+
613
+ ## Contributing
614
+
615
+ ```bash
616
+ git clone https://github.com/qa10devteam/behive.git
617
+ cd behive
618
+ pip install -e ".[dev]"
619
+ pytest
620
+ ```
621
+
622
+ ---
623
+
624
+ ## License
625
+
626
+ MIT โ€” use it, fork it, ship it, sell it.
627
+
628
+ ---
629
+
630
+ <p align="center">
631
+ <sub>Built by <a href="https://qa10.io">QA10</a> ยท Structured knowledge, not text soup.</sub>
632
+ </p>