\ No newline at end of file
diff --git a/site/api/agents/index.html b/site/api/agents/index.html
index 1001855..5f6acf4 100644
--- a/site/api/agents/index.html
+++ b/site/api/agents/index.html
@@ -1,52 +1 @@
- Agents API Reference - The DETERMINATOR
Evaluates research completeness and identifies outstanding knowledge gaps.
Parameters: - query: Research query string - background_context: Background context for the query - conversation_history: Conversation history with previous iterations - iteration: Current iteration number - time_elapsed_minutes: Elapsed time in minutes - max_time_minutes: Maximum time limit in minutes
Returns: KnowledgeGapOutput with: - research_complete: Boolean indicating if research is complete - outstanding_gaps: List of remaining knowledge gaps
Generates a markdown report from research findings.
Parameters: - query: Research query string - findings: Research findings to include in report - output_length: Desired output length ("short", "medium", "long") - output_instructions: Additional instructions for report generation
Parameters: - query: Research query string - draft: Current report draft - section_title: Title of the section to write - section_content: Content/guidance for the section
Returns: ParsedQuery with: - original_query: Original query string - improved_query: Refined query string - research_mode: "iterative" or "deep" - key_entities: List of key entities - research_questions: List of research questions
Evaluates research completeness and identifies outstanding knowledge gaps.
Parameters: - query: Research query string - background_context: Background context for the query (default: "") - conversation_history: History of actions, findings, and thoughts as string (default: "") - iteration: Current iteration number (default: 0) - time_elapsed_minutes: Elapsed time in minutes (default: 0.0) - max_time_minutes: Maximum time limit in minutes (default: 10)
Returns: KnowledgeGapOutput with: - research_complete: Boolean indicating if research is complete - outstanding_gaps: List of remaining knowledge gaps
Parameters: - gap: The knowledge gap to address - query: Research query string - background_context: Optional background context (default: "") - conversation_history: History of actions, findings, and thoughts as string (default: "")
Returns: AgentSelectionPlan with list of AgentTask objects.
Generates a markdown report from research findings.
Parameters: - query: Research query string - findings: Research findings to include in report - output_length: Optional description of desired output length (default: "") - output_instructions: Optional additional instructions for report generation (default: "")
Parameters: - original_query: The original research query - report_draft: Current report draft as string (all sections written so far) - next_section_title: Title of the section to write - next_section_draft: Draft content for the next section
Returns: LongWriterOutput with formatted section and references.
Parameters: - query: Research query string - background_context: Optional background context (default: "") - conversation_history: History of actions, findings, and thoughts as string (default: "") - iteration: Current iteration number (default: 1)
Returns: ParsedQuery with: - original_query: Original query string - improved_query: Refined query string - research_mode: "iterative" or "deep" - key_entities: List of key entities - research_questions: List of research questions
\ No newline at end of file
diff --git a/site/api/models/index.html b/site/api/models/index.html
index 51613ec..863fc63 100644
--- a/site/api/models/index.html
+++ b/site/api/models/index.html
@@ -1 +1 @@
- Models API Reference - The DETERMINATOR
Fields: - original_query: Original query string - improved_query: Refined query string - research_mode: Research mode ("iterative" or "deep") - key_entities: List of key entities - research_questions: List of research questions
Fields: - tokens_used: Tokens used so far - tokens_limit: Token limit - time_elapsed_seconds: Elapsed time in seconds - time_limit_seconds: Time limit in seconds - iterations: Current iteration count - iterations_limit: Iteration limit
Fields: - gap: The knowledge gap being addressed (optional) - agent: Name of agent to use - query: The specific query for the agent - entity_website: The website of the entity being researched, if known (optional)
Fields: - original_query: Original query string - improved_query: Refined query string - research_mode: Research mode ("iterative" or "deep") - key_entities: List of key entities - research_questions: List of research questions
Fields: - gap: The gap addressed in the iteration - tool_calls: The tool calls made - findings: The findings collected from tool calls - thought: The thinking done to reflect on the success of the iteration and next steps
Fields: - tokens_used: Total tokens used - tokens_limit: Token budget limit - time_elapsed_seconds: Time elapsed in seconds - time_limit_seconds: Time budget limit (default: 600.0 seconds / 10 minutes) - iterations: Number of iterations completed - iterations_limit: Maximum iterations (default: 10) - iteration_tokens: Tokens used per iteration (iteration number -> token count)
\ No newline at end of file
diff --git a/site/api/orchestrators/index.html b/site/api/orchestrators/index.html
index 9311993..2398678 100644
--- a/site/api/orchestrators/index.html
+++ b/site/api/orchestrators/index.html
@@ -1,35 +1 @@
- Orchestrators API Reference - The DETERMINATOR
Parameters: - query: Research query string - background_context: Background context (default: "") - max_iterations: Maximum iterations (default: from settings) - max_time_minutes: Maximum time in minutes (default: from settings) - token_budget: Token budget (default: from settings)
Yields: AgentEvent objects for: - started: Research started - search_complete: Search completed - judge_complete: Evidence evaluation completed - synthesizing: Generating report - complete: Research completed - error: Error occurred
Parameters: - query: Research query string - background_context: Background context (default: "") - max_iterations_per_section: Maximum iterations per section (default: from settings) - max_time_minutes: Maximum time in minutes (default: from settings) - token_budget: Token budget (default: from settings)
Yields: AgentEvent objects for: - started: Research started - planning: Creating research plan - looping: Running parallel research loops - synthesizing: Synthesizing results - complete: Research completed - error: Error occurred
Parameters: - query: Research query string - research_mode: Research mode ("iterative", "deep", or "auto") - use_graph: Whether to use graph execution (default: True)
Yields: AgentEvent objects during graph execution.
Modes: - "simple": Legacy orchestrator - "advanced" or "magentic": Magentic orchestrator (requires OpenAI API key) - None: Auto-detect based on API key availability
Parameters: - search_handler: Search handler protocol implementation (optional, required for simple mode) - judge_handler: Judge handler protocol implementation (optional, required for simple mode) - config: Configuration object (optional) - mode: Orchestrator mode ("simple", "advanced", "magentic", "iterative", "deep", "auto", or None for auto-detect) - oauth_token: Optional OAuth token from HuggingFace login (takes priority over env vars)
Returns: Orchestrator instance.
Raises: - ValueError: If requirements not met
Modes: - "simple": Legacy orchestrator - "advanced" or "magentic": Magentic orchestrator (requires OpenAI API key) - None: Auto-detect based on API key availability
\ No newline at end of file
diff --git a/site/api/services/index.html b/site/api/services/index.html
index e86cf38..1207a98 100644
--- a/site/api/services/index.html
+++ b/site/api/services/index.html
@@ -1,30 +1,49 @@
- Services API Reference - The DETERMINATOR
Parameters: - new_evidence: List of evidence items to deduplicate - threshold: Similarity threshold (default: 0.9, where 0.9 = 90% similar is duplicate)
Returns: List of unique evidence items (not already in vector store).
Analyzes a research question using statistical methods.
Parameters: - query: The research question - evidence: List of Evidence objects to analyze - hypothesis: Optional hypothesis dict with drug, target, pathway, effect, confidence keys
Returns: AnalysisResult with: - verdict: SUPPORTED, REFUTED, or INCONCLUSIVE - confidence: Confidence in verdict (0.0-1.0) - statistical_evidence: Summary of statistical findings - code_generated: Python code that was executed - execution_output: Output from code execution - key_takeaways: Key takeaways from analysis - limitations: List of limitations
Note: Requires Modal credentials for sandbox execution.
\ No newline at end of file
diff --git a/site/api/tools/index.html b/site/api/tools/index.html
index 30dd049..b7d76db 100644
--- a/site/api/tools/index.html
+++ b/site/api/tools/index.html
@@ -1,44 +1,51 @@
- Tools API Reference - The DETERMINATOR
Parameters: - query: Search query string - tools: List of tools to use (default: all available tools) - max_results_per_tool: Maximum results per tool (default: 10)
Returns: SearchResult with: - evidence: Aggregated list of evidence - tool_results: Results per tool - total_count: Total number of results
Note: Uses asyncio.gather() for parallel execution. Handles tool failures gracefully.
Parameters: - query: Search query string - max_results: Maximum number of results to return (default: 10)
Returns: List of Evidence objects with articles/preprints.
Note: Includes both preprints (marked with [PREPRINT - Not peer-reviewed]) and peer-reviewed articles. Handles preprint markers. Builds URLs from DOI or PMID.
Raises: - SearchError: If search fails (HTTP error, connection error)
Parameters: - rag_service: Optional RAG service instance. If None, will be lazy-initialized. - oauth_token: Optional OAuth token from HuggingFace login (for RAG LLM)
Parameters: - tools: List of search tools to use - timeout: Timeout for each search in seconds (default: 30.0) - include_rag: Whether to include RAG tool in searches (default: False) - auto_ingest_to_rag: Whether to automatically ingest results into RAG (default: True) - oauth_token: Optional OAuth token from HuggingFace login (for RAG LLM)
Parameters: - query: Search query string - max_results_per_tool: Maximum results per tool (default: 10)
Returns: SearchResult with: - query: The search query - evidence: Aggregated list of evidence - sources_searched: List of source names searched - total_found: Total number of results - errors: List of error messages from failed tools
Raises: - SearchError: If search times out
Note: Uses asyncio.gather() for parallel execution. Handles tool failures gracefully (returns errors in SearchResult.errors). Automatically ingests evidence into RAG if enabled.
\ No newline at end of file
diff --git a/site/architecture/agents/index.html b/site/architecture/agents/index.html
index bd43b2d..bcc3d61 100644
--- a/site/architecture/agents/index.html
+++ b/site/architecture/agents/index.html
@@ -1 +1 @@
- Agents - The DETERMINATOR
Purpose: Selects appropriate tools for addressing knowledge gaps.
Output: AgentSelectionPlan with list of AgentTask objects.
Available Agents: - WebSearchAgent: General web search for fresh information - SiteCrawlerAgent: Research specific entities/companies - RAGAgent: Semantic search within collected evidence
Features: - Removes duplicate content across sections - Adds executive summary if multiple sections - Preserves all references and citations - Improves flow and readability
Purpose: Parses and improves user queries, detects research mode.
Output: ParsedQuery with: - original_query: Original query string - improved_query: Refined query string - research_mode: "iterative" or "deep" - key_entities: List of key entities - research_questions: List of research questions
Purpose: Selects appropriate tools for addressing knowledge gaps.
Output: AgentSelectionPlan with list of AgentTask objects.
Available Agents: - WebSearchAgent: General web search for fresh information - SiteCrawlerAgent: Research specific entities/companies - RAGAgent: Semantic search within collected evidence
Features: - Removes duplicate content across sections - Adds executive summary if multiple sections - Preserves all references and citations - Improves flow and readability
Purpose: Parses and improves user queries, detects research mode.
Output: ParsedQuery with: - original_query: Original query string - improved_query: Refined query string - research_mode: "iterative" or "deep" - key_entities: List of key entities - research_questions: List of research questions
Features: - Uses internal Pydantic AI Agent with HypothesisAssessment output type - Accesses shared evidence_store for evidence - Uses embedding service for diverse evidence selection (MMR algorithm) - Stores hypotheses in shared context
Features: - Executes searches via SearchHandlerProtocol - Deduplicates evidence using embedding service - Searches for semantically related evidence - Updates shared evidence store
Features: - Uses internal Pydantic AI Agent with ResearchReport output type - Accesses shared evidence store and hypotheses - Validates citations before returning - Formats report as markdown
All agents have factory functions in src/agent_factory/agents.py:
Factory functions: - Use get_model() if no model provided - Accept oauth_token parameter for HuggingFace authentication - Raise ConfigurationError if creation fails - Log agent creation
Phase 4 implements a graph-based orchestration system for research workflows using Pydantic AI agents as nodes. This enables better parallel execution, conditional routing, and state management compared to simple agent chains.
USE_GRAPH_EXECUTION=true: Use graph-based execution
USE_GRAPH_EXECUTION=false: Use agent chain execution (existing)
This allows gradual migration and fallback if needed.
\ No newline at end of file
diff --git a/site/architecture/graph_orchestration/index.html b/site/architecture/graph_orchestration/index.html
index b090d72..e54981e 100644
--- a/site/architecture/graph_orchestration/index.html
+++ b/site/architecture/graph_orchestration/index.html
@@ -1,12 +1,12 @@
- Graph Orchestration - The DETERMINATOR
DeepCritical implements a graph-based orchestration system for research workflows using Pydantic AI agents as nodes. This enables better parallel execution, conditional routing, and state management compared to simple agent chains.
Node IDs: thinking → knowledge_gap → continue_decision → tool_selector/writer → execute_tools → (loop back to thinking)
Special Node Handling: - execute_tools: State node that uses search_handler to execute searches and add evidence to workflow state - continue_decision: Decision node that routes based on research_complete flag from KnowledgeGapOutput
Special Node Handling: - planner: Agent node that creates ReportPlan with report outline - store_plan: State node that stores ReportPlan in context for parallel loops - parallel_loops: Parallel node that executes IterativeResearchFlow instances for each section - collect_drafts: State node that collects section drafts from parallel loops - synthesizer: Agent node that calls LongWriterAgent.write_report() directly with ReportDraft
The GraphExecutionContext class manages execution state during graph traversal:
State: Current WorkflowState instance
Budget Tracker: BudgetTracker instance for budget enforcement
Node Results: Dictionary storing results from each node execution
Visited Nodes: Set of node IDs that have been executed
Current Node: ID of the node currently being executed
Methods: - set_node_result(node_id, result): Store result from node execution - get_node_result(node_id): Retrieve stored result - has_visited(node_id): Check if node was visited - mark_visited(node_id): Mark node as visited - update_state(updater, data): Update workflow state
\ No newline at end of file
diff --git a/site/architecture/middleware/index.html b/site/architecture/middleware/index.html
index 69cae34..928003f 100644
--- a/site/architecture/middleware/index.html
+++ b/site/architecture/middleware/index.html
@@ -1,20 +1,40 @@
- Middleware - The DETERMINATOR
Methods: - add_loop(loop: ResearchLoop): Add a research loop to manage - async run_loops_parallel() -> list[ResearchLoop]: Run all loops in parallel - update_loop_status(loop_id: str, status: str): Update loop status - sync_loop_evidence_to_state(): Synchronize evidence from loops to global state
Features: - Uses asyncio.gather() for parallel execution - Handles errors per loop (doesn't fail all if one fails) - Tracks loop status: pending, running, completed, failed, cancelled - Evidence deduplication across parallel loops
Purpose: Thread-safe state management for research workflows
Implementation: Uses ContextVar for thread-safe isolation
State Components: - evidence: list[Evidence]: Collected evidence from searches - conversation: Conversation: Iteration history (gaps, tool calls, findings, thoughts) - embedding_service: Any: Embedding service for semantic search
Methods: - add_evidence(new_evidence: list[Evidence]) -> int: Adds evidence with URL-based deduplication. Returns the number of new items added (excluding duplicates). - async search_related(query: str, n_results: int = 5) -> list[Evidence]: Semantic search for related evidence using embedding service
Methods: - async add_loop(loop_id: str, query: str) -> ResearchLoop: Add a new research loop to manage - async run_loops_parallel(loop_configs: list[dict], loop_func: Callable, judge_handler: Any | None = None, budget_tracker: Any | None = None) -> list[Any]: Run multiple research loops in parallel. Takes configuration dicts and a loop function. - async update_loop_status(loop_id: str, status: LoopStatus, error: str | None = None): Update loop status - async sync_loop_evidence_to_state(loop_id: str): Synchronize evidence from a specific loop to global state
Features: - Uses asyncio.gather() for parallel execution - Handles errors per loop (doesn't fail all if one fails) - Tracks loop status: pending, running, completed, failed, cancelled - Evidence deduplication across parallel loops
Budget Components: - Tokens: LLM token usage - Time: Elapsed time in seconds - Iterations: Number of iterations
Methods: - create_budget(loop_id: str, tokens_limit: int = 100000, time_limit_seconds: float = 600.0, iterations_limit: int = 10) -> BudgetStatus: Create a budget for a specific loop - add_tokens(loop_id: str, tokens: int): Add token usage to a loop's budget - start_timer(loop_id: str): Start time tracking for a loop - update_timer(loop_id: str): Update elapsed time for a loop - increment_iteration(loop_id: str): Increment iteration count for a loop - check_budget(loop_id: str) -> tuple[bool, str]: Check if a loop's budget has been exceeded. Returns (exceeded: bool, reason: str) - can_continue(loop_id: str) -> bool: Check if a loop can continue based on budget
\ No newline at end of file
diff --git a/site/architecture/orchestrators/index.html b/site/architecture/orchestrators/index.html
index 2270d50..c02ded5 100644
--- a/site/architecture/orchestrators/index.html
+++ b/site/architecture/orchestrators/index.html
@@ -1 +1 @@
- Orchestrators - The DETERMINATOR
Agents Used: - KnowledgeGapAgent: Evaluates research completeness - ToolSelectorAgent: Selects tools for addressing gaps - ThinkingAgent: Generates observations - WriterAgent: Creates final report - JudgeHandler: Assesses evidence sufficiency
Features: - Tracks iterations, time, budget - Supports graph execution (use_graph=True) and agent chains (use_graph=False) - Iterates until research complete or constraints met
Pattern: Planner → Parallel iterative loops per section → Synthesizer
Agents Used: - PlannerAgent: Breaks query into report sections - IterativeResearchFlow: Per-section research (parallel) - LongWriterAgent or ProofreaderAgent: Final synthesis
Features: - Uses WorkflowManager for parallel execution - Budget tracking per section and globally - State synchronization across parallel loops - Supports graph execution and agent chains
Purpose: Graph-based execution using Pydantic AI agents as nodes
Features: - Uses Pydantic AI Graphs (when available) or agent chains (fallback) - Routes based on research mode (iterative/deep/auto) - Streams AgentEvent objects for UI
Node Types: - Agent Nodes: Execute Pydantic AI agents - State Nodes: Update or read workflow state - Decision Nodes: Make routing decisions - Parallel Nodes: Execute multiple nodes concurrently
Edge Types: - Sequential Edges: Always traversed - Conditional Edges: Traversed based on condition - Parallel Edges: Used for parallel execution branches
Purpose: Hierarchical orchestrator using middleware and sub-teams
Features: - Uses SubIterationMiddleware with ResearchTeam and LLMSubIterationJudge - Adapts Magentic ChatAgent to SubIterationTeam protocol - Event-driven via asyncio.Queue for coordination - Supports sub-iteration patterns for complex research tasks
Agents Used: - KnowledgeGapAgent: Evaluates research completeness - ToolSelectorAgent: Selects tools for addressing gaps - ThinkingAgent: Generates observations - WriterAgent: Creates final report - JudgeHandler: Assesses evidence sufficiency
Features: - Tracks iterations, time, budget - Supports graph execution (use_graph=True) and agent chains (use_graph=False) - Iterates until research complete or constraints met
Pattern: Planner → Parallel iterative loops per section → Synthesizer
Agents Used: - PlannerAgent: Breaks query into report sections - IterativeResearchFlow: Per-section research (parallel) - LongWriterAgent or ProofreaderAgent: Final synthesis
Features: - Uses WorkflowManager for parallel execution - Budget tracking per section and globally - State synchronization across parallel loops - Supports graph execution and agent chains
Purpose: Graph-based execution using Pydantic AI agents as nodes
Features: - Uses graph execution (use_graph=True) or agent chains (use_graph=False) as fallback - Routes based on research mode (iterative/deep/auto) - Streams AgentEvent objects for UI - Uses GraphExecutionContext to manage execution state
Node Types: - Agent Nodes: Execute Pydantic AI agents - State Nodes: Update or read workflow state - Decision Nodes: Make routing decisions - Parallel Nodes: Execute multiple nodes concurrently
Edge Types: - Sequential Edges: Always traversed - Conditional Edges: Traversed based on condition - Parallel Edges: Used for parallel execution branches
Special Node Handling:
The GraphOrchestrator has special handling for certain nodes:
execute_tools node: State node that uses search_handler to execute searches and add evidence to workflow state
parallel_loops node: Parallel node that executes IterativeResearchFlow instances for each section in deep research mode
synthesizer node: Agent node that calls LongWriterAgent.write_report() directly with ReportDraft instead of using agent.run()
writer node: Agent node that calls WriterAgent.write_report() directly with findings instead of using agent.run()
GraphExecutionContext:
The orchestrator uses GraphExecutionContext to manage execution state: - Tracks current node, visited nodes, and node results - Manages workflow state and budget tracker - Provides methods to store and retrieve node execution results
Purpose: Multi-agent coordination using Microsoft Agent Framework
Features: - Uses agent-framework-core - ChatAgent pattern with internal LLMs per agent - MagenticBuilder with participants: - searcher: SearchAgent (wraps SearchHandler) - hypothesizer: HypothesisAgent (generates hypotheses) - judge: JudgeAgent (evaluates evidence) - reporter: ReportAgent (generates final report) - Manager orchestrates agents via chat client (OpenAI or HuggingFace) - Event-driven: converts Magentic events to AgentEvent for UI streaming via _process_event() method - Supports max rounds, stall detection, and reset handling
Event Processing:
The orchestrator processes Magentic events and converts them to AgentEvent: - MagenticOrchestratorMessageEvent → AgentEvent with type based on message content - MagenticAgentMessageEvent → AgentEvent with type based on agent name - MagenticAgentDeltaEvent → AgentEvent for streaming updates - MagenticFinalResultEvent → AgentEvent with type "complete"
Requirements: - agent-framework-core package - OpenAI API key or HuggingFace authentication
Purpose: Hierarchical orchestrator using middleware and sub-teams
Features: - Uses SubIterationMiddleware with ResearchTeam and LLMSubIterationJudge - Adapts Magentic ChatAgent to SubIterationTeam protocol - Event-driven via asyncio.Queue for coordination - Supports sub-iteration patterns for complex research tasks
\ No newline at end of file
diff --git a/site/architecture/services/index.html b/site/architecture/services/index.html
index 44fe943..31b4851 100644
--- a/site/architecture/services/index.html
+++ b/site/architecture/services/index.html
@@ -1,29 +1,30 @@
- Services - The DETERMINATOR
Purpose: Local sentence-transformers for semantic search and deduplication
Features: - No API Key Required: Uses local sentence-transformers models - Async-Safe: All operations use run_in_executor() to avoid blocking - ChromaDB Storage: Vector storage for embeddings - Deduplication: 0.85 similarity threshold (85% similarity = duplicate)
Model: Configurable via settings.local_embedding_model (default: all-MiniLM-L6-v2)
Purpose: Local sentence-transformers for semantic search and deduplication
Features: - No API Key Required: Uses local sentence-transformers models - Async-Safe: All operations use run_in_executor() to avoid blocking the event loop - ChromaDB Storage: In-memory vector storage for embeddings - Deduplication: 0.9 similarity threshold by default (90% similarity = duplicate, configurable)
Model: Configurable via settings.local_embedding_model (default: all-MiniLM-L6-v2)
\ No newline at end of file
diff --git a/site/architecture/tools/index.html b/site/architecture/tools/index.html
index 89dded2..e535c5c 100644
--- a/site/architecture/tools/index.html
+++ b/site/architecture/tools/index.html
@@ -1,18 +1,19 @@
- Tools - The DETERMINATOR
Features: - Handles preprint markers: [PREPRINT - Not peer-reviewed] - Builds URLs from DOI or PMID - Checks pubTypeList for preprint detection - Includes both preprints and peer-reviewed articles
Features: - Handles preprint markers: [PREPRINT - Not peer-reviewed] - Builds URLs from DOI or PMID - Checks pubTypeList for preprint detection - Includes both preprints and peer-reviewed articles
Purpose: Orchestrates parallel searches across multiple tools
Initialization Parameters: - tools: list[SearchTool]: List of search tools to use - timeout: float = 30.0: Timeout for each search in seconds - include_rag: bool = False: Whether to include RAG tool in searches - auto_ingest_to_rag: bool = True: Whether to automatically ingest results into RAG - oauth_token: str | None = None: Optional OAuth token from HuggingFace login (for RAG LLM)
Methods: - async def execute(query: str, max_results_per_tool: int = 10) -> SearchResult: Execute search across all tools in parallel
Features: - Uses asyncio.gather() with return_exceptions=True for parallel execution - Aggregates results into SearchResult with evidence and metadata - Handles tool failures gracefully (continues with other tools) - Deduplicates results by URL - Automatically ingests results into RAG if auto_ingest_to_rag=True - Can add RAG tool dynamically via add_rag_tool() method
\ No newline at end of file
diff --git a/site/architecture/workflow-diagrams/index.html b/site/architecture/workflow-diagrams/index.html
index 17f6d1e..e9729db 100644
--- a/site/architecture/workflow-diagrams/index.html
+++ b/site/architecture/workflow-diagrams/index.html
@@ -1,4 +1,4 @@
- Workflow Diagrams - The DETERMINATOR
stateDiagram-v2
[*] --> Initialization: User Query
Initialization --> Planning: Manager starts
@@ -391,7 +391,7 @@
Stall = no new progress
after agent execution
Triggers plan reset
- end note
DeepCritical uses Pydantic Settings for centralized configuration management. All settings are defined in the Settings class in src/utils/config.py and can be configured via environment variables or a .env file.
The configuration system provides:
Type Safety: Strongly-typed fields with Pydantic validation
Environment File Support: Automatically loads from .env file (if present)
Case-Insensitive: Environment variables are case-insensitive
Singleton Pattern: Global settings instance for easy access throughout the codebase
Validation: Automatic validation on load with helpful error messages
fromsrc.utils.configimportsettings
-
-# Check if API keys are available
-ifsettings.has_openai_key:
-# Use OpenAI
-pass
-
-# Access configuration values
-max_iterations=settings.max_iterations
-web_search_provider=settings.web_search_provider
-
DeepCritical supports multiple embedding providers for semantic search and RAG:
# Embedding Provider: "openai", "local", or "huggingface"
-EMBEDDING_PROVIDER=local
-
-# OpenAI Embedding Model (used by LlamaIndex RAG)
-OPENAI_EMBEDDING_MODEL=text-embedding-3-small
-
-# Local Embedding Model (sentence-transformers, used by EmbeddingService)
-LOCAL_EMBEDDING_MODEL=all-MiniLM-L6-v2
-
-# HuggingFace Embedding Model
-HUGGINGFACE_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
-
The embedding provider configuration:
Note: OpenAI embeddings require OPENAI_API_KEY. The local provider (default) uses sentence-transformers and requires no API key.
Control agent behavior and research loop execution:
# Maximum iterations per research loop (1-50, default: 10)
-MAX_ITERATIONS=10
-
-# Search timeout in seconds
-SEARCH_TIMEOUT=30
-
-# Use graph-based execution for research flows
-USE_GRAPH_EXECUTION=false
-
# Default token budget per research loop (1000-1000000, default: 100000)
-DEFAULT_TOKEN_LIMIT=100000
-
-# Default time limit per research loop in minutes (1-120, default: 10)
-DEFAULT_TIME_LIMIT_MINUTES=10
-
-# Default iterations limit per research loop (1-50, default: 10)
-DEFAULT_ITERATIONS_LIMIT=10
-
Configure the Retrieval-Augmented Generation service:
# ChromaDB collection name for RAG
-RAG_COLLECTION_NAME=deepcritical_evidence
-
-# Number of top results to retrieve from RAG (1-50, default: 5)
-RAG_SIMILARITY_TOP_K=5
-
-# Automatically ingest evidence into RAG
-RAG_AUTO_INGEST=true
-
fromsrc.utils.configimportsettings
-
-# Check API key availability
-ifsettings.has_openai_key:
-# Use OpenAI
-pass
-
-ifsettings.has_anthropic_key:
-# Use Anthropic
-pass
-
-ifsettings.has_huggingface_key:
-# Use HuggingFace
-pass
-
-ifsettings.has_any_llm_key:
-# At least one LLM is available
-pass
-
Model Selection: Reasoning/main/fast model configuration
Service Integration: Additional service integrations and configurations
\ No newline at end of file
diff --git a/site/configuration/index.html b/site/configuration/index.html
index 58bf165..bbcb61c 100644
--- a/site/configuration/index.html
+++ b/site/configuration/index.html
@@ -1,124 +1,124 @@
- Configuration Guide - The DETERMINATOR
DeepCritical uses Pydantic Settings for centralized configuration management. All settings are defined in the Settings class in src/utils/config.py and can be configured via environment variables or a .env file.
The configuration system provides:
Type Safety: Strongly-typed fields with Pydantic validation
Environment File Support: Automatically loads from .env file (if present)
Case-Insensitive: Environment variables are case-insensitive
Singleton Pattern: Global settings instance for easy access throughout the codebase
Validation: Automatic validation on load with helpful error messages
fromsrc.utils.configimportsettings
-
-# Check if API keys are available
-ifsettings.has_openai_key:
-# Use OpenAI
-pass
-
-# Access configuration values
-max_iterations=settings.max_iterations
-web_search_provider=settings.web_search_provider
-
DeepCritical supports multiple embedding providers for semantic search and RAG:
# Embedding Provider: "openai", "local", or "huggingface"
-EMBEDDING_PROVIDER=local
-
-# OpenAI Embedding Model (used by LlamaIndex RAG)
-OPENAI_EMBEDDING_MODEL=text-embedding-3-small
-
-# Local Embedding Model (sentence-transformers, used by EmbeddingService)
-LOCAL_EMBEDDING_MODEL=all-MiniLM-L6-v2
-
-# HuggingFace Embedding Model
-HUGGINGFACE_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
-
The embedding provider configuration:
Note: OpenAI embeddings require OPENAI_API_KEY. The local provider (default) uses sentence-transformers and requires no API key.
Control agent behavior and research loop execution:
# Maximum iterations per research loop (1-50, default: 10)
-MAX_ITERATIONS=10
-
-# Search timeout in seconds
-SEARCH_TIMEOUT=30
-
-# Use graph-based execution for research flows
-USE_GRAPH_EXECUTION=false
-
# Default token budget per research loop (1000-1000000, default: 100000)
-DEFAULT_TOKEN_LIMIT=100000
-
-# Default time limit per research loop in minutes (1-120, default: 10)
-DEFAULT_TIME_LIMIT_MINUTES=10
-
-# Default iterations limit per research loop (1-50, default: 10)
-DEFAULT_ITERATIONS_LIMIT=10
-
Configure the Retrieval-Augmented Generation service:
# ChromaDB collection name for RAG
-RAG_COLLECTION_NAME=deepcritical_evidence
-
-# Number of top results to retrieve from RAG (1-50, default: 5)
-RAG_SIMILARITY_TOP_K=5
-
-# Automatically ingest evidence into RAG
-RAG_AUTO_INGEST=true
-
fromsrc.utils.configimportsettings
-
-# Check API key availability
-ifsettings.has_openai_key:
-# Use OpenAI
-pass
-
-ifsettings.has_anthropic_key:
-# Use Anthropic
-pass
-
-ifsettings.has_huggingface_key:
-# Use HuggingFace
-pass
-
-ifsettings.has_any_llm_key:
-# At least one LLM is available
-pass
-
DeepCritical uses Pydantic Settings for centralized configuration management. All settings are defined in the Settings class in src/utils/config.py and can be configured via environment variables or a .env file.
The configuration system provides:
Type Safety: Strongly-typed fields with Pydantic validation
Environment File Support: Automatically loads from .env file (if present)
Case-Insensitive: Environment variables are case-insensitive
Singleton Pattern: Global settings instance for easy access throughout the codebase
Validation: Automatic validation on load with helpful error messages
fromsrc.utils.configimportsettings
+
+# Check if API keys are available
+ifsettings.has_openai_key:
+# Use OpenAI
+pass
+
+# Access configuration values
+max_iterations=settings.max_iterations
+web_search_provider=settings.web_search_provider
+
DeepCritical supports multiple embedding providers for semantic search and RAG:
# Embedding Provider: "openai", "local", or "huggingface"
+EMBEDDING_PROVIDER=local
+
+# OpenAI Embedding Model (used by LlamaIndex RAG)
+OPENAI_EMBEDDING_MODEL=text-embedding-3-small
+
+# Local Embedding Model (sentence-transformers, used by EmbeddingService)
+LOCAL_EMBEDDING_MODEL=all-MiniLM-L6-v2
+
+# HuggingFace Embedding Model
+HUGGINGFACE_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
+
The embedding provider configuration:
Note: OpenAI embeddings require OPENAI_API_KEY. The local provider (default) uses sentence-transformers and requires no API key.
Control agent behavior and research loop execution:
# Maximum iterations per research loop (1-50, default: 10)
+MAX_ITERATIONS=10
+
+# Search timeout in seconds
+SEARCH_TIMEOUT=30
+
+# Use graph-based execution for research flows
+USE_GRAPH_EXECUTION=false
+
# Default token budget per research loop (1000-1000000, default: 100000)
+DEFAULT_TOKEN_LIMIT=100000
+
+# Default time limit per research loop in minutes (1-120, default: 10)
+DEFAULT_TIME_LIMIT_MINUTES=10
+
+# Default iterations limit per research loop (1-50, default: 10)
+DEFAULT_ITERATIONS_LIMIT=10
+
Configure the Retrieval-Augmented Generation service:
# ChromaDB collection name for RAG
+RAG_COLLECTION_NAME=deepcritical_evidence
+
+# Number of top results to retrieve from RAG (1-50, default: 5)
+RAG_SIMILARITY_TOP_K=5
+
+# Automatically ingest evidence into RAG
+RAG_AUTO_INGEST=true
+
fromsrc.utils.configimportsettings
+
+# Check API key availability
+ifsettings.has_openai_key:
+# Use OpenAI
+pass
+
+ifsettings.has_anthropic_key:
+# Use Anthropic
+pass
+
+ifsettings.has_huggingface_key:
+# Use HuggingFace
+pass
+
+ifsettings.has_any_llm_key:
+# At least one LLM is available
+pass
+
Model Selection: Reasoning/main/fast model configuration
Service Integration: Additional service integrations and configurations
\ No newline at end of file
diff --git a/site/contributing/code-quality/index.html b/site/contributing/code-quality/index.html
index 29f5c7f..a7d5d11 100644
--- a/site/contributing/code-quality/index.html
+++ b/site/contributing/code-quality/index.html
@@ -1 +1,12 @@
- Code Quality & Documentation - The DETERMINATOR
\ No newline at end of file
diff --git a/site/contributing/code-style/index.html b/site/contributing/code-style/index.html
index 6520bd2..8b09f8f 100644
--- a/site/contributing/code-style/index.html
+++ b/site/contributing/code-style/index.html
@@ -1,3 +1,23 @@
- Code Style & Conventions - The DETERMINATOR
\ No newline at end of file
diff --git a/site/contributing/error-handling/index.html b/site/contributing/error-handling/index.html
index 4ee75b2..b5e359e 100644
--- a/site/contributing/error-handling/index.html
+++ b/site/contributing/error-handling/index.html
@@ -1,9 +1,9 @@
- Error Handling & Logging - The DETERMINATOR
\ No newline at end of file
diff --git a/site/contributing/implementation-patterns/index.html b/site/contributing/implementation-patterns/index.html
index 92110c8..eb36b7a 100644
--- a/site/contributing/implementation-patterns/index.html
+++ b/site/contributing/implementation-patterns/index.html
@@ -1,10 +1,10 @@
- Implementation Patterns - The DETERMINATOR
\ No newline at end of file
diff --git a/site/contributing/index.html b/site/contributing/index.html
index 06c9c33..3d16a3f 100644
--- a/site/contributing/index.html
+++ b/site/contributing/index.html
@@ -1,15 +1,52 @@
- Contributing to DeepCritical - The DETERMINATOR
makeinstall# Install dependencies + pre-commit
-makecheck# Lint + typecheck + test (MUST PASS)
-maketest# Run unit tests
-makelint# Run ruff
-makeformat# Format with ruff
-maketypecheck# Run mypy
-maketest-cov# Test with coverage
-
Thank you for your interest in contributing to The DETERMINATOR! This guide will help you get started.
Note on Project Names: "The DETERMINATOR" is the product name, "DeepCritical" is the organization/project name, and "determinator" is the Python package name.
# Clone from GitHub
+gitclonehttps://github.com/DeepCritical/GradioDemo.git
+cdGradioDemo
+
+# Add HuggingFace remote (optional, for deployment)
+gitremoteaddhuggingface-upstreamhttps://huggingface.co/spaces/DataQuests/DeepCritical
+
Important: Never push directly to main or dev on HuggingFace. Always work through GitHub PRs. GitHub is the source of truth; HuggingFace is for deployment/demo only.
# Installation
+uvsync--all-extras# Install all dependencies including dev
+uvrunpre-commitinstall# Install pre-commit hooks
+
+# Code Quality Checks (run all before committing)
+uvrunruffchecksrctests# Lint with ruff
+uvrunruffformatsrctests# Format with ruff
+uvrunmypysrc# Type checking
+uvrunpytest--cov=src--cov-report=term-missingtests/unit/-v-m"not openai"-pno:logfire# Tests with coverage
+
+# Testing Commands
+uvrunpytesttests/unit/-v-m"not openai"-pno:logfire# Run unit tests (excludes OpenAI tests)
+uvrunpytesttests/-v-m"huggingface"-pno:logfire# Run HuggingFace tests
+uvrunpytesttests/-v-pno:logfire# Run all tests
+uvrunpytest--cov=src--cov-report=term-missingtests/unit/-v-m"not openai"-pno:logfire# Tests with terminal coverage
+uvrunpytest--cov=src--cov-report=html-pno:logfire# Generate HTML coverage report (opens htmlcov/index.html)
+
+# Documentation Commands
+uvrunmkdocsbuild# Build documentation
+uvrunmkdocsserve# Serve documentation locally (http://127.0.0.1:8000)
+
\ No newline at end of file
diff --git a/site/contributing/testing/index.html b/site/contributing/testing/index.html
index d34e59d..b840011 100644
--- a/site/contributing/testing/index.html
+++ b/site/contributing/testing/index.html
@@ -1,13 +1,37 @@
- Testing Requirements - The DETERMINATOR
# Run only unit tests (excludes OpenAI tests by default)
+uvrunpytesttests/unit/-v-m"not openai"-pno:logfire
+
+# Run HuggingFace tests
+uvrunpytesttests/-v-m"huggingface"-pno:logfire
+
+# Run all tests
+uvrunpytesttests/-v-pno:logfire
+
+# Run only local embedding tests
+uvrunpytesttests/-v-m"local_embeddings"-pno:logfire
+
+# Exclude slow tests
+uvrunpytesttests/-v-m"not slow"-pno:logfire
+
Note: The -p no:logfire flag disables the logfire plugin to avoid conflicts during testing.
# Run unit tests (default, excludes OpenAI tests)
+uvrunpytesttests/unit/-v-m"not openai"-pno:logfire
+
+# Run HuggingFace tests
+uvrunpytesttests/-v-m"huggingface"-pno:logfire
+
+# Run all tests
+uvrunpytesttests/-v-pno:logfire
+
\ No newline at end of file
diff --git a/site/getting-started/examples/index.html b/site/getting-started/examples/index.html
index 6ac4769..88d4916 100644
--- a/site/getting-started/examples/index.html
+++ b/site/getting-started/examples/index.html
@@ -1,49 +1,49 @@
- Examples - The DETERMINATOR
What are the latest treatments for Alzheimer's disease?
-
What DeepCritical Does: 1. Searches PubMed for recent papers 2. Searches ClinicalTrials.gov for active trials 3. Evaluates evidence quality 4. Synthesizes findings into a comprehensive report
What clinical trials are investigating metformin for cancer prevention?
-
What DeepCritical Does: 1. Searches ClinicalTrials.gov for relevant trials 2. Searches PubMed for supporting literature 3. Provides trial details and status 4. Summarizes findings
# Run research query
-query="What are the latest treatments for Alzheimer's disease?"
-asyncforeventinorchestrator.run(query):
-print(f"Event: {event.type} - {event.data}")
-
What are the latest treatments for Alzheimer's disease?
+
What The DETERMINATOR Does: 1. Searches PubMed for recent papers 2. Searches ClinicalTrials.gov for active trials 3. Evaluates evidence quality 4. Synthesizes findings into a comprehensive report
Review the evidence for using metformin as an anti-aging intervention,
+including clinical trials, mechanisms of action, and safety profile.
+
What The DETERMINATOR Does: 1. Uses deep research mode (multi-section) 2. Searches multiple sources in parallel 3. Generates sections on: - Clinical trials - Mechanisms of action - Safety profile 4. Synthesizes comprehensive report
# Run research query
+query="What are the latest treatments for Alzheimer's disease?"
+asyncforeventinorchestrator.run(query):
+print(f"Event: {event.type} - {event.data}")
+
\ No newline at end of file
diff --git a/site/getting-started/installation/index.html b/site/getting-started/installation/index.html
index 77fdfbc..c702d58 100644
--- a/site/getting-started/installation/index.html
+++ b/site/getting-started/installation/index.html
@@ -1,21 +1,27 @@
- Installation - The DETERMINATOR
# Required: At least one LLM provider
-LLM_PROVIDER=openai# or "anthropic" or "huggingface"
-OPENAI_API_KEY=your_openai_api_key_here
-
-# Optional: Other services
-NCBI_API_KEY=your_ncbi_api_key_here# For higher PubMed rate limits
-MODAL_TOKEN_ID=your_modal_token_id
-MODAL_TOKEN_SECRET=your_modal_token_secret
-
Import Errors: - Ensure you've installed all required dependencies - Check that Python 3.11+ is being used
API Key Errors: - Verify your .env file is in the project root - Check that API keys are correctly formatted - Ensure at least one LLM provider is configured
Module Not Found: - Run uv sync or pip install -e . again - Check that you're in the correct virtual environment
Port Already in Use: - Change the port in src/app.py or use environment variable - Kill the process using port 7860
# Required: At least one LLM provider
+LLM_PROVIDER=openai# or "anthropic" or "huggingface"
+OPENAI_API_KEY=your_openai_api_key_here
+
+# Optional: Other services
+NCBI_API_KEY=your_ncbi_api_key_here# For higher PubMed rate limits
+MODAL_TOKEN_ID=your_modal_token_id
+MODAL_TOKEN_SECRET=your_modal_token_secret
+
Import Errors: - Ensure you've installed all required dependencies - Check that Python 3.11+ is being used
API Key Errors: - Verify your .env file is in the project root - Check that API keys are correctly formatted - Ensure at least one LLM provider is configured
Module Not Found: - Run uv sync or pip install -e . again - Check that you're in the correct virtual environment
Port Already in Use: - Change the port in src/app.py or use environment variable - Kill the process using port 7860
\ No newline at end of file
diff --git a/site/getting-started/mcp-integration/index.html b/site/getting-started/mcp-integration/index.html
index 157a588..9c98dcd 100644
--- a/site/getting-started/mcp-integration/index.html
+++ b/site/getting-started/mcp-integration/index.html
@@ -1,35 +1,35 @@
- MCP Integration - The DETERMINATOR
The Model Context Protocol (MCP) is a standard for connecting AI assistants to external tools and data sources. DeepCritical implements an MCP server that exposes its search capabilities as MCP tools.
In Claude Desktop, you should see DeepCritical tools available: - search_pubmed - search_clinical_trials - search_biorxiv - search_all - analyze_hypothesis
Server Not Found: - Ensure DeepCritical is running (uv run gradio run src/app.py) - Verify the URL in claude_desktop_config.json is correct - Check that port 7860 is not blocked by firewall
Tools Not Appearing: - Restart Claude Desktop after configuration changes - Check Claude Desktop logs for errors - Verify MCP server is accessible at the configured URL
The DETERMINATOR exposes a Model Context Protocol (MCP) server, allowing you to use its search tools directly from Claude Desktop or other MCP clients.
The Model Context Protocol (MCP) is a standard for connecting AI assistants to external tools and data sources. The DETERMINATOR implements an MCP server that exposes its search capabilities as MCP tools.
In Claude Desktop, you should see The DETERMINATOR tools available: - search_pubmed - search_clinical_trials - search_biorxiv - search_all - analyze_hypothesis
Server Not Found: - Ensure DeepCritical is running (uv run gradio run src/app.py) - Verify the URL in claude_desktop_config.json is correct - Check that port 7860 is not blocked by firewall
Tools Not Appearing: - Restart Claude Desktop after configuration changes - Check Claude Desktop logs for errors - Verify MCP server is accessible at the configured URL
\ No newline at end of file
diff --git a/site/getting-started/quick-start/index.html b/site/getting-started/quick-start/index.html
index 2b66ea1..f3fadf4 100644
--- a/site/getting-started/quick-start/index.html
+++ b/site/getting-started/quick-start/index.html
@@ -1,6 +1,44 @@
- Quick Start Guide - The DETERMINATOR
Type your research question in the chat interface, for example: - "What are the latest treatments for Alzheimer's disease?" - "Review the evidence for metformin in cancer prevention" - "What clinical trials are investigating COVID-19 vaccines?"
Submit the Query
Click "Submit" or press Enter. The system will: - Generate observations about your query - Identify knowledge gaps - Search multiple sources (PubMed, ClinicalTrials.gov, Europe PMC) - Evaluate evidence quality - Synthesize findings into a report
Review Results
Watch the real-time progress in the chat interface: - Search operations and results - Evidence evaluation - Report generation - Final research report with citations
Type your research question in the chat interface, for example: - "What are the latest treatments for Alzheimer's disease?" - "Review the evidence for metformin in cancer prevention" - "What clinical trials are investigating COVID-19 vaccines?"
Submit the Query
Click "Submit" or press Enter. The system will: - Generate observations about your query - Identify knowledge gaps - Search multiple sources (PubMed, ClinicalTrials.gov, Europe PMC) - Evaluate evidence quality - Synthesize findings into a report
Review Results
Watch the real-time progress in the chat interface: - Search operations and results - Evidence evaluation - Report generation - Final research report with citations
\ No newline at end of file
diff --git a/site/index.html b/site/index.html
index 7ce7805..5e2f78d 100644
--- a/site/index.html
+++ b/site/index.html
@@ -1,9 +1,16 @@
- The DETERMINATOR
DeepCritical is a deep research agent system that uses iterative search-and-judge loops to comprehensively answer research questions. The system supports multiple orchestration patterns, graph-based execution, parallel research workflows, and long-running task management with real-time streaming.
Generalist Deep Research Agent - Stops at Nothing Until Finding Precise Answers
The DETERMINATOR is a powerful generalist deep research agent system that uses iterative search-and-judge loops to comprehensively investigate any research question. It stops at nothing until finding precise answers, only stopping at configured limits (budget, time, iterations).
Key Features: - Generalist: Handles queries from any domain (medical, technical, business, scientific, etc.) - Automatic Source Selection: Automatically determines if medical knowledge sources (PubMed, ClinicalTrials.gov) are needed - Multi-Source Search: Web search, PubMed, ClinicalTrials.gov, Europe PMC, RAG - Iterative Refinement: Continues searching and refining until precise answers are found - Evidence Synthesis: Comprehensive reports with proper citations
Important: The DETERMINATOR is a research tool that synthesizes evidence. It cannot provide medical advice or answer medical questions directly.
\ No newline at end of file
diff --git a/site/license/index.html b/site/license/index.html
index 277a05d..a352fec 100644
--- a/site/license/index.html
+++ b/site/license/index.html
@@ -1 +1 @@
- License - The DETERMINATOR
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
+ License - The DETERMINATOR
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/site/overview/architecture/index.html b/site/overview/architecture/index.html
index 8a6eedd..b7a56c1 100644
--- a/site/overview/architecture/index.html
+++ b/site/overview/architecture/index.html
@@ -1 +1 @@
- Architecture Overview - The DETERMINATOR
DeepCritical is a deep research agent system that uses iterative search-and-judge loops to comprehensively answer research questions. The system supports multiple orchestration patterns, graph-based execution, parallel research workflows, and long-running task management with real-time streaming.
The DETERMINATOR is a powerful generalist deep research agent system that uses iterative search-and-judge loops to comprehensively investigate any research question. It stops at nothing until finding precise answers, only stopping at configured limits (budget, time, iterations). The system automatically determines if medical knowledge sources are needed and adapts its search strategy accordingly. It supports multiple orchestration patterns, graph-based execution, parallel research workflows, and long-running task management with real-time streaming.
Note: The UI provides separate controls for orchestrator mode and graph research mode. When using graph-based orchestrators (iterative/deep/auto), the graph research mode determines the specific pattern used within the graph execution.
\ No newline at end of file
diff --git a/site/overview/features/index.html b/site/overview/features/index.html
index 26bc6ad..de754ff 100644
--- a/site/overview/features/index.html
+++ b/site/overview/features/index.html
@@ -1 +1 @@
- Features - The DETERMINATOR
Graph-Based Execution: Flexible graph orchestration with conditional routing
Parallel Research Loops: Run multiple research tasks concurrently
Iterative Research: Single-loop research with search-judge-synthesize cycles that continues until precise answers are found
Deep Research: Multi-section parallel research with planning and synthesis
Magentic Orchestration: Multi-agent coordination using Microsoft Agent Framework (alias: "advanced" mode)
Stops at Nothing: Only stops at configured limits (budget, time, iterations), otherwise continues until finding precise answers
Orchestrator Modes: - simple: Legacy linear search-judge loop - advanced (or magentic): Multi-agent coordination (requires OpenAI API key) - iterative: Knowledge-gap-driven research with single loop - deep: Parallel section-based research with planning - auto: Intelligent mode detection based on query complexity
Graph Research Modes (used within graph orchestrator): - iterative: Single research loop pattern - deep: Multi-section parallel research pattern - auto: Auto-detect pattern based on query complexity
Execution Modes: - use_graph=True: Graph-based execution with parallel and conditional routing - use_graph=False: Agent chains with sequential execution (backward compatible)
\ No newline at end of file
diff --git a/site/overview/quick-start/index.html b/site/overview/quick-start/index.html
index b8629df..4a1744a 100644
--- a/site/overview/quick-start/index.html
+++ b/site/overview/quick-start/index.html
@@ -1,15 +1,22 @@
- Quick Start - The DETERMINATOR
HuggingFace OAuth Login: - Click the "Sign in with HuggingFace" button at the top of the app - Your HuggingFace API token will be automatically used for AI inference - No need to manually enter API keys when logged in
Manual API Key (BYOK): - Provide your own API key in the Settings accordion - Supports HuggingFace, OpenAI, or Anthropic API keys - Manual keys take priority over OAuth tokens
Authentication is mandatory - you must authenticate before using the application. The app will display an error message if you try to use it without authentication.
HuggingFace OAuth Login (Recommended): - Click the "Sign in with HuggingFace" button at the top of the app - Your HuggingFace API token will be automatically used for AI inference - No need to manually enter API keys when logged in
Manual API Key (Alternative): - Set environment variable HF_TOKEN or HUGGINGFACE_API_KEY before starting the app - The app will automatically use these tokens if OAuth login is not available - Supports HuggingFace API keys only (OpenAI/Anthropic keys are not used in the current implementation)
Enter your research question in the chat interface
Text Input: Type your question directly
Image Input: Click the 📷 icon to upload images (OCR will extract text)
Audio Input: Click the 🎤 icon to record or upload audio (STT will transcribe to text)
Click "Submit" or press Enter
Watch the real-time progress as the system:
Generates observations
Identifies knowledge gaps
Searches multiple sources
Evaluates evidence
Synthesizes findings
Review the final research report
Audio Output: If enabled, the final response will include audio synthesis (TTS)
Multimodal Features: - Configure image/audio input and output in the sidebar settings - Image OCR and audio STT/TTS can be enabled/disabled independently - TTS voice and speed can be customized in the Audio Output settings
search_pubmed: Search peer-reviewed biomedical literature
search_clinical_trials: Search ClinicalTrials.gov
search_biorxiv: Search bioRxiv/medRxiv preprints
search_neo4j: Search Neo4j knowledge graph for papers and disease relationships
search_all: Search all sources simultaneously
analyze_hypothesis: Secure statistical analysis using Modal sandboxes
Note: The application automatically uses all available search tools (Neo4j, PubMed, ClinicalTrials.gov, Europe PMC, Web search, RAG) based on query analysis. Neo4j knowledge graph search is included by default for biomedical queries.
\ No newline at end of file
diff --git a/site/search/search_index.json b/site/search/search_index.json
index 992482b..306ac34 100644
--- a/site/search/search_index.json
+++ b/site/search/search_index.json
@@ -1 +1 @@
-{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"],"fields":{"title":{"boost":1000.0},"text":{"boost":1.0},"tags":{"boost":1000000.0}}},"docs":[{"location":"","title":"DeepCritical","text":"
AI-Native Drug Repurposing Research Agent
DeepCritical is a deep research agent system that uses iterative search-and-judge loops to comprehensively answer research questions. The system supports multiple orchestration patterns, graph-based execution, parallel research workflows, and long-running task management with real-time streaming.
"},{"location":"CONTRIBUTING/","title":"Contributing to DeepCritical","text":"
Thank you for your interest in contributing to DeepCritical! This guide will help you get started.
"},{"location":"CONTRIBUTING/#table-of-contents","title":"Table of Contents","text":"
Git Workflow
Getting Started
Development Commands
MCP Integration
Common Pitfalls
Key Principles
Pull Request Process
Note: Additional sections (Code Style, Error Handling, Testing, Implementation Patterns, Code Quality, and Prompt Engineering) are available as separate pages in the navigation sidebar.
git commit -m \"Description of changes\"\ngit push origin yourname-feature-name\n
8. Create a pull request on GitHub"},{"location":"CONTRIBUTING/#development-commands","title":"Development Commands","text":"
make install # Install dependencies + pre-commit\nmake check # Lint + typecheck + test (MUST PASS)\nmake test # Run unit tests\nmake lint # Run ruff\nmake format # Format with ruff\nmake typecheck # Run mypy\nmake test-cov # Test with coverage\nmake docs-build # Build documentation\nmake docs-serve # Serve documentation locally\n
logger.info(\"Starting search\", query=query, tools=[t.name for t in tools])\nlogger.warning(\"Search tool failed\", tool=tool.name, error=str(result))\nlogger.error(\"Assessment failed\", error=str(e))\n
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"},{"location":"team/","title":"Team","text":"
DeepCritical is developed by a team of researchers and developers working on AI-assisted research.
The DeepCritical team met online in the Alzheimer's Critical Literature Review Group in the Hugging Science initiative. We're building the agent framework we want to use for AI-assisted research to turn the vast amounts of clinical data into cures.
Evaluates research completeness and identifies outstanding knowledge gaps.
Parameters: - query: Research query string - background_context: Background context for the query - conversation_history: Conversation history with previous iterations - iteration: Current iteration number - time_elapsed_minutes: Elapsed time in minutes - max_time_minutes: Maximum time limit in minutes
Returns: KnowledgeGapOutput with: - research_complete: Boolean indicating if research is complete - outstanding_gaps: List of remaining knowledge gaps
Generates a markdown report from research findings.
Parameters: - query: Research query string - findings: Research findings to include in report - output_length: Desired output length (\"short\", \"medium\", \"long\") - output_instructions: Additional instructions for report generation
Parameters: - query: Research query string - draft: Current report draft - section_title: Title of the section to write - section_content: Content/guidance for the section
Returns: ParsedQuery with: - original_query: Original query string - improved_query: Refined query string - research_mode: \"iterative\" or \"deep\" - key_entities: List of key entities - research_questions: List of research questions
Fields: - original_query: Original query string - improved_query: Refined query string - research_mode: Research mode (\"iterative\" or \"deep\") - key_entities: List of key entities - research_questions: List of research questions
Fields: - tokens_used: Tokens used so far - tokens_limit: Token limit - time_elapsed_seconds: Elapsed time in seconds - time_limit_seconds: Time limit in seconds - iterations: Current iteration count - iterations_limit: Iteration limit
Parameters: - query: Research query string - background_context: Background context (default: \"\") - max_iterations: Maximum iterations (default: from settings) - max_time_minutes: Maximum time in minutes (default: from settings) - token_budget: Token budget (default: from settings)
Yields: AgentEvent objects for: - started: Research started - search_complete: Search completed - judge_complete: Evidence evaluation completed - synthesizing: Generating report - complete: Research completed - error: Error occurred
Parameters: - query: Research query string - background_context: Background context (default: \"\") - max_iterations_per_section: Maximum iterations per section (default: from settings) - max_time_minutes: Maximum time in minutes (default: from settings) - token_budget: Token budget (default: from settings)
Yields: AgentEvent objects for: - started: Research started - planning: Creating research plan - looping: Running parallel research loops - synthesizing: Synthesizing results - complete: Research completed - error: Error occurred
Parameters: - query: Research query string - research_mode: Research mode (\"iterative\", \"deep\", or \"auto\") - use_graph: Whether to use graph execution (default: True)
Yields: AgentEvent objects during graph execution.
Modes: - \"simple\": Legacy orchestrator - \"advanced\" or \"magentic\": Magentic orchestrator (requires OpenAI API key) - None: Auto-detect based on API key availability
Parameters: - query: Search query string - tools: List of tools to use (default: all available tools) - max_results_per_tool: Maximum results per tool (default: 10)
Returns: SearchResult with: - evidence: Aggregated list of evidence - tool_results: Results per tool - total_count: Total number of results
Note: Uses asyncio.gather() for parallel execution. Handles tool failures gracefully.
Agents use structured output types from src/utils/models.py:
KnowledgeGapOutput: Research completeness evaluation
AgentSelectionPlan: Tool selection plan
ReportDraft: Long-form report structure
ParsedQuery: Query parsing and mode detection
For text output (writer agents), agents return str directly.
"},{"location":"architecture/agents/#agent-types","title":"Agent Types","text":""},{"location":"architecture/agents/#knowledge-gap-agent","title":"Knowledge Gap Agent","text":"
File: src/agents/knowledge_gap.py
Purpose: Evaluates research state and identifies knowledge gaps.
Output: KnowledgeGapOutput with: - research_complete: Boolean indicating if research is complete - outstanding_gaps: List of remaining knowledge gaps
Purpose: Selects appropriate tools for addressing knowledge gaps.
Output: AgentSelectionPlan with list of AgentTask objects.
Available Agents: - WebSearchAgent: General web search for fresh information - SiteCrawlerAgent: Research specific entities/companies - RAGAgent: Semantic search within collected evidence
Features: - Removes duplicate content across sections - Adds executive summary if multiple sections - Preserves all references and citations - Improves flow and readability
Purpose: Parses and improves user queries, detects research mode.
Output: ParsedQuery with: - original_query: Original query string - improved_query: Refined query string - research_mode: \"iterative\" or \"deep\" - key_entities: List of key entities - research_questions: List of research questions
Phase 4 implements a graph-based orchestration system for research workflows using Pydantic AI agents as nodes. This enables better parallel execution, conditional routing, and state management compared to simple agent chains.
Example: If research complete \u2192 go to writer, else \u2192 continue loop
Parallel Edges: Used for parallel execution branches
From: Parallel node
To: Multiple target nodes
Execution: All targets run concurrently
"},{"location":"architecture/graph-orchestration/#graph-patterns","title":"Graph Patterns","text":""},{"location":"architecture/graph-orchestration/#iterative-research-graph","title":"Iterative Research Graph","text":"
Methods: - add_loop(loop: ResearchLoop): Add a research loop to manage - async run_loops_parallel() -> list[ResearchLoop]: Run all loops in parallel - update_loop_status(loop_id: str, status: str): Update loop status - sync_loop_evidence_to_state(): Synchronize evidence from loops to global state
Features: - Uses asyncio.gather() for parallel execution - Handles errors per loop (doesn't fail all if one fails) - Tracks loop status: pending, running, completed, failed, cancelled - Evidence deduplication across parallel loops
Usage:
from src.middleware.workflow_manager import WorkflowManager\n\nmanager = WorkflowManager()\nmanager.add_loop(loop1)\nmanager.add_loop(loop2)\ncompleted_loops = await manager.run_loops_parallel()\n
Agents Used: - KnowledgeGapAgent: Evaluates research completeness - ToolSelectorAgent: Selects tools for addressing gaps - ThinkingAgent: Generates observations - WriterAgent: Creates final report - JudgeHandler: Assesses evidence sufficiency
Features: - Tracks iterations, time, budget - Supports graph execution (use_graph=True) and agent chains (use_graph=False) - Iterates until research complete or constraints met
Pattern: Planner \u2192 Parallel iterative loops per section \u2192 Synthesizer
Agents Used: - PlannerAgent: Breaks query into report sections - IterativeResearchFlow: Per-section research (parallel) - LongWriterAgent or ProofreaderAgent: Final synthesis
Features: - Uses WorkflowManager for parallel execution - Budget tracking per section and globally - State synchronization across parallel loops - Supports graph execution and agent chains
Purpose: Graph-based execution using Pydantic AI agents as nodes
Features: - Uses Pydantic AI Graphs (when available) or agent chains (fallback) - Routes based on research mode (iterative/deep/auto) - Streams AgentEvent objects for UI
Node Types: - Agent Nodes: Execute Pydantic AI agents - State Nodes: Update or read workflow state - Decision Nodes: Make routing decisions - Parallel Nodes: Execute multiple nodes concurrently
Edge Types: - Sequential Edges: Always traversed - Conditional Edges: Traversed based on condition - Parallel Edges: Used for parallel execution branches
Purpose: Hierarchical orchestrator using middleware and sub-teams
Features: - Uses SubIterationMiddleware with ResearchTeam and LLMSubIterationJudge - Adapts Magentic ChatAgent to SubIterationTeam protocol - Event-driven via asyncio.Queue for coordination - Supports sub-iteration patterns for complex research tasks
Purpose: Local sentence-transformers for semantic search and deduplication
Features: - No API Key Required: Uses local sentence-transformers models - Async-Safe: All operations use run_in_executor() to avoid blocking - ChromaDB Storage: Vector storage for embeddings - Deduplication: 0.85 similarity threshold (85% similarity = duplicate)
Model: Configurable via settings.local_embedding_model (default: all-MiniLM-L6-v2)
from src.utils.config import settings\n\nif settings.modal_available:\n # Use Modal sandbox\n pass\n\nif settings.has_openai_key:\n # Use OpenAI embeddings for RAG\n pass\n
Features: - Handles preprint markers: [PREPRINT - Not peer-reviewed] - Builds URLs from DOI or PMID - Checks pubTypeList for preprint detection - Includes both preprints and peer-reviewed articles
DeepCritical uses Pydantic Settings for centralized configuration management. All settings are defined in the Settings class in src/utils/config.py and can be configured via environment variables or a .env file.
The configuration system provides:
Type Safety: Strongly-typed fields with Pydantic validation
Environment File Support: Automatically loads from .env file (if present)
Case-Insensitive: Environment variables are case-insensitive
Singleton Pattern: Global settings instance for easy access throughout the codebase
Validation: Automatic validation on load with helpful error messages
Set at least one LLM API key (OPENAI_API_KEY, ANTHROPIC_API_KEY, or HF_TOKEN)
Optionally configure other services as needed
The application will automatically load and validate your configuration
"},{"location":"configuration/#configuration-system-architecture","title":"Configuration System Architecture","text":""},{"location":"configuration/#settings-class","title":"Settings Class","text":"
The [Settings][settings-class] class extends BaseSettings from pydantic_settings and defines all application configuration:
from src.utils.config import settings\n\n# Check if API keys are available\nif settings.has_openai_key:\n # Use OpenAI\n pass\n\n# Access configuration values\nmax_iterations = settings.max_iterations\nweb_search_provider = settings.web_search_provider\n
DeepCritical supports multiple embedding providers for semantic search and RAG:
# Embedding Provider: \"openai\", \"local\", or \"huggingface\"\nEMBEDDING_PROVIDER=local\n\n# OpenAI Embedding Model (used by LlamaIndex RAG)\nOPENAI_EMBEDDING_MODEL=text-embedding-3-small\n\n# Local Embedding Model (sentence-transformers, used by EmbeddingService)\nLOCAL_EMBEDDING_MODEL=all-MiniLM-L6-v2\n\n# HuggingFace Embedding Model\nHUGGINGFACE_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2\n
The embedding provider configuration:
Note: OpenAI embeddings require OPENAI_API_KEY. The local provider (default) uses sentence-transformers and requires no API key.
DeepCritical supports multiple web search providers:
# Web Search Provider: \"serper\", \"searchxng\", \"brave\", \"tavily\", or \"duckduckgo\"\n# Default: \"duckduckgo\" (no API key required)\nWEB_SEARCH_PROVIDER=duckduckgo\n\n# Serper API Key (for Google search via Serper)\nSERPER_API_KEY=your_serper_api_key_here\n\n# SearchXNG Host URL (for self-hosted search)\nSEARCHXNG_HOST=http://localhost:8080\n\n# Brave Search API Key\nBRAVE_API_KEY=your_brave_api_key_here\n\n# Tavily API Key\nTAVILY_API_KEY=your_tavily_api_key_here\n
The web search provider configuration:
Note: DuckDuckGo is the default and requires no API key, making it ideal for development and testing.
Control agent behavior and research loop execution:
# Maximum iterations per research loop (1-50, default: 10)\nMAX_ITERATIONS=10\n\n# Search timeout in seconds\nSEARCH_TIMEOUT=30\n\n# Use graph-based execution for research flows\nUSE_GRAPH_EXECUTION=false\n
# Default token budget per research loop (1000-1000000, default: 100000)\nDEFAULT_TOKEN_LIMIT=100000\n\n# Default time limit per research loop in minutes (1-120, default: 10)\nDEFAULT_TIME_LIMIT_MINUTES=10\n\n# Default iterations limit per research loop (1-50, default: 10)\nDEFAULT_ITERATIONS_LIMIT=10\n
The budget configuration with validation:
"},{"location":"configuration/#rag-service-configuration","title":"RAG Service Configuration","text":"
Configure the Retrieval-Augmented Generation service:
# ChromaDB collection name for RAG\nRAG_COLLECTION_NAME=deepcritical_evidence\n\n# Number of top results to retrieve from RAG (1-50, default: 5)\nRAG_SIMILARITY_TOP_K=5\n\n# Automatically ingest evidence into RAG\nRAG_AUTO_INGEST=true\n
Configure the vector database for embeddings and RAG:
# ChromaDB storage path\nCHROMA_DB_PATH=./chroma_db\n\n# Whether to persist ChromaDB to disk\nCHROMA_DB_PERSIST=true\n\n# ChromaDB server host (for remote ChromaDB, optional)\nCHROMA_DB_HOST=localhost\n\n# ChromaDB server port (for remote ChromaDB, optional)\nCHROMA_DB_PORT=8000\n
from src.utils.config import settings\n\n# Check API key availability\nif settings.has_openai_key:\n # Use OpenAI\n pass\n\nif settings.has_anthropic_key:\n # Use Anthropic\n pass\n\nif settings.has_huggingface_key:\n # Use HuggingFace\n pass\n\nif settings.has_any_llm_key:\n # At least one LLM is available\n pass\n
from src.utils.config import settings\n\n# Check service availability\nif settings.modal_available:\n # Use Modal sandbox\n pass\n\nif settings.web_search_available:\n # Web search is configured\n pass\n
The orchestrator factory uses settings to determine mode:
"},{"location":"configuration/#environment-variables-reference","title":"Environment Variables Reference","text":""},{"location":"configuration/#required-at-least-one-llm","title":"Required (at least one LLM)","text":"
OPENAI_API_KEY - OpenAI API key (required for OpenAI provider)
ANTHROPIC_API_KEY - Anthropic API key (required for Anthropic provider)
HF_TOKEN or HUGGINGFACE_API_KEY - HuggingFace API token (optional, can work without for public models)
DeepCritical uses Pydantic Settings for centralized configuration management. All settings are defined in the Settings class in src/utils/config.py and can be configured via environment variables or a .env file.
The configuration system provides:
Type Safety: Strongly-typed fields with Pydantic validation
Environment File Support: Automatically loads from .env file (if present)
Case-Insensitive: Environment variables are case-insensitive
Singleton Pattern: Global settings instance for easy access throughout the codebase
Validation: Automatic validation on load with helpful error messages
Set at least one LLM API key (OPENAI_API_KEY, ANTHROPIC_API_KEY, or HF_TOKEN)
Optionally configure other services as needed
The application will automatically load and validate your configuration
"},{"location":"configuration/CONFIGURATION/#configuration-system-architecture","title":"Configuration System Architecture","text":""},{"location":"configuration/CONFIGURATION/#settings-class","title":"Settings Class","text":"
The Settings class extends BaseSettings from pydantic_settings and defines all application configuration:
from src.utils.config import settings\n\n# Check if API keys are available\nif settings.has_openai_key:\n # Use OpenAI\n pass\n\n# Access configuration values\nmax_iterations = settings.max_iterations\nweb_search_provider = settings.web_search_provider\n
DeepCritical supports multiple embedding providers for semantic search and RAG:
# Embedding Provider: \"openai\", \"local\", or \"huggingface\"\nEMBEDDING_PROVIDER=local\n\n# OpenAI Embedding Model (used by LlamaIndex RAG)\nOPENAI_EMBEDDING_MODEL=text-embedding-3-small\n\n# Local Embedding Model (sentence-transformers, used by EmbeddingService)\nLOCAL_EMBEDDING_MODEL=all-MiniLM-L6-v2\n\n# HuggingFace Embedding Model\nHUGGINGFACE_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2\n
The embedding provider configuration:
Note: OpenAI embeddings require OPENAI_API_KEY. The local provider (default) uses sentence-transformers and requires no API key.
DeepCritical supports multiple web search providers:
# Web Search Provider: \"serper\", \"searchxng\", \"brave\", \"tavily\", or \"duckduckgo\"\n# Default: \"duckduckgo\" (no API key required)\nWEB_SEARCH_PROVIDER=duckduckgo\n\n# Serper API Key (for Google search via Serper)\nSERPER_API_KEY=your_serper_api_key_here\n\n# SearchXNG Host URL (for self-hosted search)\nSEARCHXNG_HOST=http://localhost:8080\n\n# Brave Search API Key\nBRAVE_API_KEY=your_brave_api_key_here\n\n# Tavily API Key\nTAVILY_API_KEY=your_tavily_api_key_here\n
The web search provider configuration:
Note: DuckDuckGo is the default and requires no API key, making it ideal for development and testing.
Control agent behavior and research loop execution:
# Maximum iterations per research loop (1-50, default: 10)\nMAX_ITERATIONS=10\n\n# Search timeout in seconds\nSEARCH_TIMEOUT=30\n\n# Use graph-based execution for research flows\nUSE_GRAPH_EXECUTION=false\n
# Default token budget per research loop (1000-1000000, default: 100000)\nDEFAULT_TOKEN_LIMIT=100000\n\n# Default time limit per research loop in minutes (1-120, default: 10)\nDEFAULT_TIME_LIMIT_MINUTES=10\n\n# Default iterations limit per research loop (1-50, default: 10)\nDEFAULT_ITERATIONS_LIMIT=10\n
The budget configuration with validation:
"},{"location":"configuration/CONFIGURATION/#rag-service-configuration","title":"RAG Service Configuration","text":"
Configure the Retrieval-Augmented Generation service:
# ChromaDB collection name for RAG\nRAG_COLLECTION_NAME=deepcritical_evidence\n\n# Number of top results to retrieve from RAG (1-50, default: 5)\nRAG_SIMILARITY_TOP_K=5\n\n# Automatically ingest evidence into RAG\nRAG_AUTO_INGEST=true\n
Configure the vector database for embeddings and RAG:
# ChromaDB storage path\nCHROMA_DB_PATH=./chroma_db\n\n# Whether to persist ChromaDB to disk\nCHROMA_DB_PERSIST=true\n\n# ChromaDB server host (for remote ChromaDB, optional)\nCHROMA_DB_HOST=localhost\n\n# ChromaDB server port (for remote ChromaDB, optional)\nCHROMA_DB_PORT=8000\n
from src.utils.config import settings\n\n# Check API key availability\nif settings.has_openai_key:\n # Use OpenAI\n pass\n\nif settings.has_anthropic_key:\n # Use Anthropic\n pass\n\nif settings.has_huggingface_key:\n # Use HuggingFace\n pass\n\nif settings.has_any_llm_key:\n # At least one LLM is available\n pass\n
from src.utils.config import settings\n\n# Check service availability\nif settings.modal_available:\n # Use Modal sandbox\n pass\n\nif settings.web_search_available:\n # Web search is configured\n pass\n
The orchestrator factory uses settings to determine mode:
"},{"location":"configuration/CONFIGURATION/#environment-variables-reference","title":"Environment Variables Reference","text":""},{"location":"configuration/CONFIGURATION/#required-at-least-one-llm","title":"Required (at least one LLM)","text":"
OPENAI_API_KEY - OpenAI API key (required for OpenAI provider)
ANTHROPIC_API_KEY - Anthropic API key (required for Anthropic provider)
HF_TOKEN or HUGGINGFACE_API_KEY - HuggingFace API token (optional, can work without for public models)
make install # Install dependencies + pre-commit\nmake check # Lint + typecheck + test (MUST PASS)\nmake test # Run unit tests\nmake lint # Run ruff\nmake format # Format with ruff\nmake typecheck # Run mypy\nmake test-cov # Test with coverage\n
logger.info(\"Starting search\", query=query, tools=[t.name for t in tools])\nlogger.warning(\"Search tool failed\", tool=tool.name, error=str(result))\nlogger.error(\"Assessment failed\", error=str(e))\n
This page provides examples of using DeepCritical for various research tasks.
"},{"location":"getting-started/examples/#basic-research-query","title":"Basic Research Query","text":""},{"location":"getting-started/examples/#example-1-drug-information","title":"Example 1: Drug Information","text":"
Query:
What are the latest treatments for Alzheimer's disease?\n
What DeepCritical Does: 1. Searches PubMed for recent papers 2. Searches ClinicalTrials.gov for active trials 3. Evaluates evidence quality 4. Synthesizes findings into a comprehensive report
What clinical trials are investigating metformin for cancer prevention?\n
What DeepCritical Does: 1. Searches ClinicalTrials.gov for relevant trials 2. Searches PubMed for supporting literature 3. Provides trial details and status 4. Summarizes findings
"},{"location":"getting-started/examples/#advanced-research-queries","title":"Advanced Research Queries","text":""},{"location":"getting-started/examples/#example-3-comprehensive-review","title":"Example 3: Comprehensive Review","text":"
Query:
Review the evidence for using metformin as an anti-aging intervention, \nincluding clinical trials, mechanisms of action, and safety profile.\n
What DeepCritical Does: 1. Uses deep research mode (multi-section) 2. Searches multiple sources in parallel 3. Generates sections on: - Clinical trials - Mechanisms of action - Safety profile 4. Synthesizes comprehensive report
Analyze whether vitamin D supplementation reduces COVID-19 severity\n
"},{"location":"getting-started/examples/#code-examples","title":"Code Examples","text":""},{"location":"getting-started/examples/#python-api-usage","title":"Python API Usage","text":"
# Run research query\nquery = \"What are the latest treatments for Alzheimer's disease?\"\nasync for event in orchestrator.run(query):\n print(f\"Event: {event.type} - {event.data}\")\n
# Required: At least one LLM provider\nLLM_PROVIDER=openai # or \"anthropic\" or \"huggingface\"\nOPENAI_API_KEY=your_openai_api_key_here\n\n# Optional: Other services\nNCBI_API_KEY=your_ncbi_api_key_here # For higher PubMed rate limits\nMODAL_TOKEN_ID=your_modal_token_id\nMODAL_TOKEN_SECRET=your_modal_token_secret\n
See the Configuration Guide for all available options.
Import Errors: - Ensure you've installed all required dependencies - Check that Python 3.11+ is being used
API Key Errors: - Verify your .env file is in the project root - Check that API keys are correctly formatted - Ensure at least one LLM provider is configured
Module Not Found: - Run uv sync or pip install -e . again - Check that you're in the correct virtual environment
Port Already in Use: - Change the port in src/app.py or use environment variable - Kill the process using port 7860
DeepCritical exposes a Model Context Protocol (MCP) server, allowing you to use its search tools directly from Claude Desktop or other MCP clients.
"},{"location":"getting-started/mcp-integration/#what-is-mcp","title":"What is MCP?","text":"
The Model Context Protocol (MCP) is a standard for connecting AI assistants to external tools and data sources. DeepCritical implements an MCP server that exposes its search capabilities as MCP tools.
"},{"location":"getting-started/mcp-integration/#mcp-server-url","title":"MCP Server URL","text":"
In Claude Desktop, you should see DeepCritical tools available: - search_pubmed - search_clinical_trials - search_biorxiv - search_all - analyze_hypothesis
Server Not Found: - Ensure DeepCritical is running (uv run gradio run src/app.py) - Verify the URL in claude_desktop_config.json is correct - Check that port 7860 is not blocked by firewall
Tools Not Appearing: - Restart Claude Desktop after configuration changes - Check Claude Desktop logs for errors - Verify MCP server is accessible at the configured URL
"},{"location":"getting-started/quick-start/#start-the-application","title":"Start the Application","text":"
uv run gradio run src/app.py\n
Open your browser to http://localhost:7860.
"},{"location":"getting-started/quick-start/#first-research-query","title":"First Research Query","text":"
Enter a Research Question
Type your research question in the chat interface, for example: - \"What are the latest treatments for Alzheimer's disease?\" - \"Review the evidence for metformin in cancer prevention\" - \"What clinical trials are investigating COVID-19 vaccines?\"
Submit the Query
Click \"Submit\" or press Enter. The system will: - Generate observations about your query - Identify knowledge gaps - Search multiple sources (PubMed, ClinicalTrials.gov, Europe PMC) - Evaluate evidence quality - Synthesize findings into a report
Review Results
Watch the real-time progress in the chat interface: - Search operations and results - Evidence evaluation - Report generation - Final research report with citations
Click \"Sign in with HuggingFace\" at the top of the app
Authorize the application
Your HuggingFace API token will be automatically used
No need to manually enter API keys
"},{"location":"getting-started/quick-start/#manual-api-key","title":"Manual API Key","text":"
Open the Settings accordion
Enter your API key:
OpenAI API key
Anthropic API key
HuggingFace API key
Click \"Save Settings\"
Manual keys take priority over OAuth tokens
"},{"location":"getting-started/quick-start/#understanding-the-interface","title":"Understanding the Interface","text":""},{"location":"getting-started/quick-start/#chat-interface","title":"Chat Interface","text":"
Input: Enter your research questions here
Messages: View conversation history and research progress
Streaming: Real-time updates as research progresses
DeepCritical is a deep research agent system that uses iterative search-and-judge loops to comprehensively answer research questions. The system supports multiple orchestration patterns, graph-based execution, parallel research workflows, and long-running task management with real-time streaming.
HuggingFace OAuth Login: - Click the \"Sign in with HuggingFace\" button at the top of the app - Your HuggingFace API token will be automatically used for AI inference - No need to manually enter API keys when logged in
Manual API Key (BYOK): - Provide your own API key in the Settings accordion - Supports HuggingFace, OpenAI, or Anthropic API keys - Manual keys take priority over OAuth tokens
"},{"location":"overview/quick-start/#2-start-a-research-query","title":"2. Start a Research Query","text":"
Enter your research question in the chat interface
"}]}
\ No newline at end of file
+{"config":{"lang":["en"],"separator":"[\\s\\-,:!=\\[\\]()\"`/]+|\\.(?!\\d)|&[lg]t;|&","pipeline":["stopWordFilter"],"fields":{"title":{"boost":1000.0},"text":{"boost":1.0},"tags":{"boost":1000000.0}}},"docs":[{"location":"","title":"The DETERMINATOR","text":"
Generalist Deep Research Agent - Stops at Nothing Until Finding Precise Answers
The DETERMINATOR is a powerful generalist deep research agent system that uses iterative search-and-judge loops to comprehensively investigate any research question. It stops at nothing until finding precise answers, only stopping at configured limits (budget, time, iterations).
Key Features: - Generalist: Handles queries from any domain (medical, technical, business, scientific, etc.) - Automatic Source Selection: Automatically determines if medical knowledge sources (PubMed, ClinicalTrials.gov) are needed - Multi-Source Search: Web search, PubMed, ClinicalTrials.gov, Europe PMC, RAG - Iterative Refinement: Continues searching and refining until precise answers are found - Evidence Synthesis: Comprehensive reports with proper citations
Important: The DETERMINATOR is a research tool that synthesizes evidence. It cannot provide medical advice or answer medical questions directly.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"},{"location":"MKDOCS_IMPROVEMENTS_ASSESSMENT/","title":"MkDocs & Material UI Improvement Assessment","text":""},{"location":"MKDOCS_IMPROVEMENTS_ASSESSMENT/#current-configuration-analysis","title":"Current Configuration Analysis","text":"
Your current mkdocs.yml already includes many excellent features: - \u2705 Material theme with light/dark mode toggle - \u2705 Navigation tabs, sections, expand, and top navigation - \u2705 Search with suggestions and highlighting - \u2705 Code annotation and copy buttons - \u2705 Mermaid diagram support - \u2705 Code include plugin - \u2705 Minification for performance - \u2705 Comprehensive markdown extensions
"},{"location":"MKDOCS_IMPROVEMENTS_ASSESSMENT/#recommended-improvements","title":"Recommended Improvements","text":""},{"location":"MKDOCS_IMPROVEMENTS_ASSESSMENT/#1-versioning--multi-version-documentation--high-priority","title":"1. Versioning & Multi-Version Documentation \u2b50 High Priority","text":"
If you plan to maintain multiple versions or branches:
Benefits: Shows when pages were last updated, helps users understand document freshness.
"},{"location":"MKDOCS_IMPROVEMENTS_ASSESSMENT/#2-git-integration--revision-information--high-priority","title":"2. Git Integration & Revision Information \u2b50 High Priority","text":"
Benefits: Users see when content was last updated, builds trust in documentation freshness.
"},{"location":"MKDOCS_IMPROVEMENTS_ASSESSMENT/#3-enhanced-navigation-features--high-priority","title":"3. Enhanced Navigation Features \u2b50 High Priority","text":"
Benefits: Better UX, easier navigation, professional feel.
"},{"location":"MKDOCS_IMPROVEMENTS_ASSESSMENT/#4-content-tabs-for-code-examples--high-priority","title":"4. Content Tabs for Code Examples \u2b50 High Priority","text":"
Perfect for showing multiple code examples (Python, TypeScript, etc.):
!!! danger \"Important\"\n This is a critical warning.\n
Benefits: Better visual hierarchy for warnings, tips, and important information.
"},{"location":"MKDOCS_IMPROVEMENTS_ASSESSMENT/#6-math-formula-support--medium-priority-if-needed","title":"6. Math Formula Support \u2b50 Medium Priority (if needed)","text":"
If your documentation includes mathematical formulas:
"},{"location":"MKDOCS_IMPROVEMENTS_ASSESSMENT/#11-better-table-of-contents--medium-priority","title":"11. Better Table of Contents \u2b50 Medium Priority","text":"
Enhance TOC with more options:
markdown_extensions:\n - toc:\n permalink: true\n permalink_title: \"Anchor link to this section\"\n baselevel: 1\n toc_depth: 3\n slugify: !!python/object/apply:pymdownx.slugs.slugify\n kwds:\n case: lower\n
Benefits: Better navigation within long pages, SEO-friendly anchor links.
"},{"location":"MKDOCS_IMPROVEMENTS_ASSESSMENT/#12-image-optimization--medium-priority","title":"12. Image Optimization \u2b50 Medium Priority","text":"
"},{"location":"MKDOCS_IMPROVEMENTS_ASSESSMENT/#15-better-search-configuration--medium-priority","title":"15. Better Search Configuration \u2b50 Medium Priority","text":"
Enhance search capabilities:
plugins:\n - search:\n lang:\n - en\n separator: '[\\s\\-,:!=\\[\\]()\"`/]+|\\.(?!\\d)|&[lg]t;|&'\n prebuild_index: true # For faster search\n indexing: full # Full-text indexing\n
Benefits: Faster, more accurate search results.
"},{"location":"MKDOCS_IMPROVEMENTS_ASSESSMENT/#16-api-documentation-enhancements--high-priority-for-your-api-docs","title":"16. API Documentation Enhancements \u2b50 High Priority (for your API docs)","text":"
Since you have extensive API documentation, consider:
Benefits: Better content organization, related content discovery.
"},{"location":"MKDOCS_IMPROVEMENTS_ASSESSMENT/#19-better-mobile-experience--high-priority","title":"19. Better Mobile Experience \u2b50 High Priority","text":"
The DeepCritical team met online in the Alzheimer's Critical Literature Review Group in the Hugging Science initiative. We're building the agent framework we want to use for AI-assisted research to turn the vast amounts of clinical data into cures.
Evaluates research completeness and identifies outstanding knowledge gaps.
Parameters: - query: Research query string - background_context: Background context for the query (default: \"\") - conversation_history: History of actions, findings, and thoughts as string (default: \"\") - iteration: Current iteration number (default: 0) - time_elapsed_minutes: Elapsed time in minutes (default: 0.0) - max_time_minutes: Maximum time limit in minutes (default: 10)
Returns: KnowledgeGapOutput with: - research_complete: Boolean indicating if research is complete - outstanding_gaps: List of remaining knowledge gaps
Parameters: - gap: The knowledge gap to address - query: Research query string - background_context: Optional background context (default: \"\") - conversation_history: History of actions, findings, and thoughts as string (default: \"\")
Returns: AgentSelectionPlan with list of AgentTask objects.
Generates a markdown report from research findings.
Parameters: - query: Research query string - findings: Research findings to include in report - output_length: Optional description of desired output length (default: \"\") - output_instructions: Optional additional instructions for report generation (default: \"\")
Parameters: - original_query: The original research query - report_draft: Current report draft as string (all sections written so far) - next_section_title: Title of the section to write - next_section_draft: Draft content for the next section
Returns: LongWriterOutput with formatted section and references.
Parameters: - query: Research query string - background_context: Optional background context (default: \"\") - conversation_history: History of actions, findings, and thoughts as string (default: \"\") - iteration: Current iteration number (default: 1)
Returns: ParsedQuery with: - original_query: Original query string - improved_query: Refined query string - research_mode: \"iterative\" or \"deep\" - key_entities: List of key entities - research_questions: List of research questions
Fields: - gap: The knowledge gap being addressed (optional) - agent: Name of agent to use - query: The specific query for the agent - entity_website: The website of the entity being researched, if known (optional)
Fields: - original_query: Original query string - improved_query: Refined query string - research_mode: Research mode (\"iterative\" or \"deep\") - key_entities: List of key entities - research_questions: List of research questions
Fields: - gap: The gap addressed in the iteration - tool_calls: The tool calls made - findings: The findings collected from tool calls - thought: The thinking done to reflect on the success of the iteration and next steps
Fields: - tokens_used: Total tokens used - tokens_limit: Token budget limit - time_elapsed_seconds: Time elapsed in seconds - time_limit_seconds: Time budget limit (default: 600.0 seconds / 10 minutes) - iterations: Number of iterations completed - iterations_limit: Maximum iterations (default: 10) - iteration_tokens: Tokens used per iteration (iteration number -> token count)
Parameters: - search_handler: Search handler protocol implementation (optional, required for simple mode) - judge_handler: Judge handler protocol implementation (optional, required for simple mode) - config: Configuration object (optional) - mode: Orchestrator mode (\"simple\", \"advanced\", \"magentic\", \"iterative\", \"deep\", \"auto\", or None for auto-detect) - oauth_token: Optional OAuth token from HuggingFace login (takes priority over env vars)
Returns: Orchestrator instance.
Raises: - ValueError: If requirements not met
Modes: - \"simple\": Legacy orchestrator - \"advanced\" or \"magentic\": Magentic orchestrator (requires OpenAI API key) - None: Auto-detect based on API key availability
Parameters: - new_evidence: List of evidence items to deduplicate - threshold: Similarity threshold (default: 0.9, where 0.9 = 90% similar is duplicate)
Returns: List of unique evidence items (not already in vector store).
Analyzes a research question using statistical methods.
Parameters: - query: The research question - evidence: List of Evidence objects to analyze - hypothesis: Optional hypothesis dict with drug, target, pathway, effect, confidence keys
Returns: AnalysisResult with: - verdict: SUPPORTED, REFUTED, or INCONCLUSIVE - confidence: Confidence in verdict (0.0-1.0) - statistical_evidence: Summary of statistical findings - code_generated: Python code that was executed - execution_output: Output from code execution - key_takeaways: Key takeaways from analysis - limitations: List of limitations
Note: Requires Modal credentials for sandbox execution.
Parameters: - query: Search query string - max_results: Maximum number of results to return (default: 10)
Returns: List of Evidence objects with articles/preprints.
Note: Includes both preprints (marked with [PREPRINT - Not peer-reviewed]) and peer-reviewed articles. Handles preprint markers. Builds URLs from DOI or PMID.
Raises: - SearchError: If search fails (HTTP error, connection error)
Parameters: - rag_service: Optional RAG service instance. If None, will be lazy-initialized. - oauth_token: Optional OAuth token from HuggingFace login (for RAG LLM)
Parameters: - tools: List of search tools to use - timeout: Timeout for each search in seconds (default: 30.0) - include_rag: Whether to include RAG tool in searches (default: False) - auto_ingest_to_rag: Whether to automatically ingest results into RAG (default: True) - oauth_token: Optional OAuth token from HuggingFace login (for RAG LLM)
Parameters: - query: Search query string - max_results_per_tool: Maximum results per tool (default: 10)
Returns: SearchResult with: - query: The search query - evidence: Aggregated list of evidence - sources_searched: List of source names searched - total_found: Total number of results - errors: List of error messages from failed tools
Raises: - SearchError: If search times out
Note: Uses asyncio.gather() for parallel execution. Handles tool failures gracefully (returns errors in SearchResult.errors). Automatically ingests evidence into RAG if enabled.
DeepCritical uses Pydantic AI agents for all AI-powered operations. All agents follow a consistent pattern and use structured output types.
"},{"location":"architecture/agents/#agent-pattern","title":"Agent Pattern","text":""},{"location":"architecture/agents/#pydantic-ai-agents","title":"Pydantic AI Agents","text":"
Pydantic AI agents use the Agent class with the following structure:
System Prompt: Module-level constant with date injection
Agents use structured output types from src/utils/models.py:
KnowledgeGapOutput: Research completeness evaluation
AgentSelectionPlan: Tool selection plan
ReportDraft: Long-form report structure
ParsedQuery: Query parsing and mode detection
For text output (writer agents), agents return str directly.
"},{"location":"architecture/agents/#agent-types","title":"Agent Types","text":""},{"location":"architecture/agents/#knowledge-gap-agent","title":"Knowledge Gap Agent","text":"
File: src/agents/knowledge_gap.py
Purpose: Evaluates research state and identifies knowledge gaps.
Output: KnowledgeGapOutput with: - research_complete: Boolean indicating if research is complete - outstanding_gaps: List of remaining knowledge gaps
Purpose: Selects appropriate tools for addressing knowledge gaps.
Output: AgentSelectionPlan with list of AgentTask objects.
Available Agents: - WebSearchAgent: General web search for fresh information - SiteCrawlerAgent: Research specific entities/companies - RAGAgent: Semantic search within collected evidence
Features: - Removes duplicate content across sections - Adds executive summary if multiple sections - Preserves all references and citations - Improves flow and readability
Purpose: Parses and improves user queries, detects research mode.
Output: ParsedQuery with: - original_query: Original query string - improved_query: Refined query string - research_mode: \"iterative\" or \"deep\" - key_entities: List of key entities - research_questions: List of research questions
Features: - Uses internal Pydantic AI Agent with HypothesisAssessment output type - Accesses shared evidence_store for evidence - Uses embedding service for diverse evidence selection (MMR algorithm) - Stores hypotheses in shared context
Features: - Executes searches via SearchHandlerProtocol - Deduplicates evidence using embedding service - Searches for semantically related evidence - Updates shared evidence store
Features: - Uses internal Pydantic AI Agent with ResearchReport output type - Accesses shared evidence store and hypotheses - Validates citations before returning - Formats report as markdown
All agents have factory functions in src/agent_factory/agents.py:
Factory functions: - Use get_model() if no model provided - Accept oauth_token parameter for HuggingFace authentication - Raise ConfigurationError if creation fails - Log agent creation
DeepCritical implements a graph-based orchestration system for research workflows using Pydantic AI agents as nodes. This enables better parallel execution, conditional routing, and state management compared to simple agent chains.
"},{"location":"architecture/graph_orchestration/#graph-patterns","title":"Graph Patterns","text":""},{"location":"architecture/graph_orchestration/#iterative-research-graph","title":"Iterative Research Graph","text":"
The iterative research graph follows this pattern:
Node IDs: thinking \u2192 knowledge_gap \u2192 continue_decision \u2192 tool_selector/writer \u2192 execute_tools \u2192 (loop back to thinking)
Special Node Handling: - execute_tools: State node that uses search_handler to execute searches and add evidence to workflow state - continue_decision: Decision node that routes based on research_complete flag from KnowledgeGapOutput
"},{"location":"architecture/graph_orchestration/#deep-research-graph","title":"Deep Research Graph","text":"
Special Node Handling: - planner: Agent node that creates ReportPlan with report outline - store_plan: State node that stores ReportPlan in context for parallel loops - parallel_loops: Parallel node that executes IterativeResearchFlow instances for each section - collect_drafts: State node that collects section drafts from parallel loops - synthesizer: Agent node that calls LongWriterAgent.write_report() directly with ReportDraft
The GraphExecutionContext class manages execution state during graph traversal:
State: Current WorkflowState instance
Budget Tracker: BudgetTracker instance for budget enforcement
Node Results: Dictionary storing results from each node execution
Visited Nodes: Set of node IDs that have been executed
Current Node: ID of the node currently being executed
Methods: - set_node_result(node_id, result): Store result from node execution - get_node_result(node_id): Retrieve stored result - has_visited(node_id): Check if node was visited - mark_visited(node_id): Mark node as visited - update_state(updater, data): Update workflow state
Purpose: Thread-safe state management for research workflows
Implementation: Uses ContextVar for thread-safe isolation
State Components: - evidence: list[Evidence]: Collected evidence from searches - conversation: Conversation: Iteration history (gaps, tool calls, findings, thoughts) - embedding_service: Any: Embedding service for semantic search
Methods: - add_evidence(new_evidence: list[Evidence]) -> int: Adds evidence with URL-based deduplication. Returns the number of new items added (excluding duplicates). - async search_related(query: str, n_results: int = 5) -> list[Evidence]: Semantic search for related evidence using embedding service
Methods: - async add_loop(loop_id: str, query: str) -> ResearchLoop: Add a new research loop to manage - async run_loops_parallel(loop_configs: list[dict], loop_func: Callable, judge_handler: Any | None = None, budget_tracker: Any | None = None) -> list[Any]: Run multiple research loops in parallel. Takes configuration dicts and a loop function. - async update_loop_status(loop_id: str, status: LoopStatus, error: str | None = None): Update loop status - async sync_loop_evidence_to_state(loop_id: str): Synchronize evidence from a specific loop to global state
Features: - Uses asyncio.gather() for parallel execution - Handles errors per loop (doesn't fail all if one fails) - Tracks loop status: pending, running, completed, failed, cancelled - Evidence deduplication across parallel loops
Budget Components: - Tokens: LLM token usage - Time: Elapsed time in seconds - Iterations: Number of iterations
Methods: - create_budget(loop_id: str, tokens_limit: int = 100000, time_limit_seconds: float = 600.0, iterations_limit: int = 10) -> BudgetStatus: Create a budget for a specific loop - add_tokens(loop_id: str, tokens: int): Add token usage to a loop's budget - start_timer(loop_id: str): Start time tracking for a loop - update_timer(loop_id: str): Update elapsed time for a loop - increment_iteration(loop_id: str): Increment iteration count for a loop - check_budget(loop_id: str) -> tuple[bool, str]: Check if a loop's budget has been exceeded. Returns (exceeded: bool, reason: str) - can_continue(loop_id: str) -> bool: Check if a loop can continue based on budget
Agents Used: - KnowledgeGapAgent: Evaluates research completeness - ToolSelectorAgent: Selects tools for addressing gaps - ThinkingAgent: Generates observations - WriterAgent: Creates final report - JudgeHandler: Assesses evidence sufficiency
Features: - Tracks iterations, time, budget - Supports graph execution (use_graph=True) and agent chains (use_graph=False) - Iterates until research complete or constraints met
Pattern: Planner \u2192 Parallel iterative loops per section \u2192 Synthesizer
Agents Used: - PlannerAgent: Breaks query into report sections - IterativeResearchFlow: Per-section research (parallel) - LongWriterAgent or ProofreaderAgent: Final synthesis
Features: - Uses WorkflowManager for parallel execution - Budget tracking per section and globally - State synchronization across parallel loops - Supports graph execution and agent chains
Purpose: Graph-based execution using Pydantic AI agents as nodes
Features: - Uses graph execution (use_graph=True) or agent chains (use_graph=False) as fallback - Routes based on research mode (iterative/deep/auto) - Streams AgentEvent objects for UI - Uses GraphExecutionContext to manage execution state
Node Types: - Agent Nodes: Execute Pydantic AI agents - State Nodes: Update or read workflow state - Decision Nodes: Make routing decisions - Parallel Nodes: Execute multiple nodes concurrently
Edge Types: - Sequential Edges: Always traversed - Conditional Edges: Traversed based on condition - Parallel Edges: Used for parallel execution branches
Special Node Handling:
The GraphOrchestrator has special handling for certain nodes:
execute_tools node: State node that uses search_handler to execute searches and add evidence to workflow state
parallel_loops node: Parallel node that executes IterativeResearchFlow instances for each section in deep research mode
synthesizer node: Agent node that calls LongWriterAgent.write_report() directly with ReportDraft instead of using agent.run()
writer node: Agent node that calls WriterAgent.write_report() directly with findings instead of using agent.run()
GraphExecutionContext:
The orchestrator uses GraphExecutionContext to manage execution state: - Tracks current node, visited nodes, and node results - Manages workflow state and budget tracker - Provides methods to store and retrieve node execution results
Purpose: Multi-agent coordination using Microsoft Agent Framework
Features: - Uses agent-framework-core - ChatAgent pattern with internal LLMs per agent - MagenticBuilder with participants: - searcher: SearchAgent (wraps SearchHandler) - hypothesizer: HypothesisAgent (generates hypotheses) - judge: JudgeAgent (evaluates evidence) - reporter: ReportAgent (generates final report) - Manager orchestrates agents via chat client (OpenAI or HuggingFace) - Event-driven: converts Magentic events to AgentEvent for UI streaming via _process_event() method - Supports max rounds, stall detection, and reset handling
Event Processing:
The orchestrator processes Magentic events and converts them to AgentEvent: - MagenticOrchestratorMessageEvent \u2192 AgentEvent with type based on message content - MagenticAgentMessageEvent \u2192 AgentEvent with type based on agent name - MagenticAgentDeltaEvent \u2192 AgentEvent for streaming updates - MagenticFinalResultEvent \u2192 AgentEvent with type \"complete\"
Requirements: - agent-framework-core package - OpenAI API key or HuggingFace authentication
Purpose: Hierarchical orchestrator using middleware and sub-teams
Features: - Uses SubIterationMiddleware with ResearchTeam and LLMSubIterationJudge - Adapts Magentic ChatAgent to SubIterationTeam protocol - Event-driven via asyncio.Queue for coordination - Supports sub-iteration patterns for complex research tasks
Purpose: Local sentence-transformers for semantic search and deduplication
Features: - No API Key Required: Uses local sentence-transformers models - Async-Safe: All operations use run_in_executor() to avoid blocking the event loop - ChromaDB Storage: In-memory vector storage for embeddings - Deduplication: 0.9 similarity threshold by default (90% similarity = duplicate, configurable)
Model: Configurable via settings.local_embedding_model (default: all-MiniLM-L6-v2)
from src.utils.config import settings\n\nif settings.modal_available:\n # Use Modal sandbox\n pass\n\nif settings.has_openai_key:\n # Use OpenAI embeddings for RAG\n pass\n
Features: - Handles preprint markers: [PREPRINT - Not peer-reviewed] - Builds URLs from DOI or PMID - Checks pubTypeList for preprint detection - Includes both preprints and peer-reviewed articles
Purpose: Orchestrates parallel searches across multiple tools
Initialization Parameters: - tools: list[SearchTool]: List of search tools to use - timeout: float = 30.0: Timeout for each search in seconds - include_rag: bool = False: Whether to include RAG tool in searches - auto_ingest_to_rag: bool = True: Whether to automatically ingest results into RAG - oauth_token: str | None = None: Optional OAuth token from HuggingFace login (for RAG LLM)
Methods: - async def execute(query: str, max_results_per_tool: int = 10) -> SearchResult: Execute search across all tools in parallel
Features: - Uses asyncio.gather() with return_exceptions=True for parallel execution - Aggregates results into SearchResult with evidence and metadata - Handles tool failures gracefully (continues with other tools) - Deduplicates results by URL - Automatically ingests results into RAG if auto_ingest_to_rag=True - Can add RAG tool dynamically via add_rag_tool() method
DeepCritical uses Pydantic Settings for centralized configuration management. All settings are defined in the Settings class in src/utils/config.py and can be configured via environment variables or a .env file.
The configuration system provides:
Type Safety: Strongly-typed fields with Pydantic validation
Environment File Support: Automatically loads from .env file (if present)
Case-Insensitive: Environment variables are case-insensitive
Singleton Pattern: Global settings instance for easy access throughout the codebase
Validation: Automatic validation on load with helpful error messages
Set at least one LLM API key (OPENAI_API_KEY, ANTHROPIC_API_KEY, or HF_TOKEN)
Optionally configure other services as needed
The application will automatically load and validate your configuration
"},{"location":"configuration/#configuration-system-architecture","title":"Configuration System Architecture","text":""},{"location":"configuration/#settings-class","title":"Settings Class","text":"
The [Settings][settings-class] class extends BaseSettings from pydantic_settings and defines all application configuration:
from src.utils.config import settings\n\n# Check if API keys are available\nif settings.has_openai_key:\n # Use OpenAI\n pass\n\n# Access configuration values\nmax_iterations = settings.max_iterations\nweb_search_provider = settings.web_search_provider\n
DeepCritical supports multiple embedding providers for semantic search and RAG:
# Embedding Provider: \"openai\", \"local\", or \"huggingface\"\nEMBEDDING_PROVIDER=local\n\n# OpenAI Embedding Model (used by LlamaIndex RAG)\nOPENAI_EMBEDDING_MODEL=text-embedding-3-small\n\n# Local Embedding Model (sentence-transformers, used by EmbeddingService)\nLOCAL_EMBEDDING_MODEL=all-MiniLM-L6-v2\n\n# HuggingFace Embedding Model\nHUGGINGFACE_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2\n
The embedding provider configuration:
Note: OpenAI embeddings require OPENAI_API_KEY. The local provider (default) uses sentence-transformers and requires no API key.
DeepCritical supports multiple web search providers:
# Web Search Provider: \"serper\", \"searchxng\", \"brave\", \"tavily\", or \"duckduckgo\"\n# Default: \"duckduckgo\" (no API key required)\nWEB_SEARCH_PROVIDER=duckduckgo\n\n# Serper API Key (for Google search via Serper)\nSERPER_API_KEY=your_serper_api_key_here\n\n# SearchXNG Host URL (for self-hosted search)\nSEARCHXNG_HOST=http://localhost:8080\n\n# Brave Search API Key\nBRAVE_API_KEY=your_brave_api_key_here\n\n# Tavily API Key\nTAVILY_API_KEY=your_tavily_api_key_here\n
The web search provider configuration:
Note: DuckDuckGo is the default and requires no API key, making it ideal for development and testing.
Control agent behavior and research loop execution:
# Maximum iterations per research loop (1-50, default: 10)\nMAX_ITERATIONS=10\n\n# Search timeout in seconds\nSEARCH_TIMEOUT=30\n\n# Use graph-based execution for research flows\nUSE_GRAPH_EXECUTION=false\n
# Default token budget per research loop (1000-1000000, default: 100000)\nDEFAULT_TOKEN_LIMIT=100000\n\n# Default time limit per research loop in minutes (1-120, default: 10)\nDEFAULT_TIME_LIMIT_MINUTES=10\n\n# Default iterations limit per research loop (1-50, default: 10)\nDEFAULT_ITERATIONS_LIMIT=10\n
The budget configuration with validation:
"},{"location":"configuration/#rag-service-configuration","title":"RAG Service Configuration","text":"
Configure the Retrieval-Augmented Generation service:
# ChromaDB collection name for RAG\nRAG_COLLECTION_NAME=deepcritical_evidence\n\n# Number of top results to retrieve from RAG (1-50, default: 5)\nRAG_SIMILARITY_TOP_K=5\n\n# Automatically ingest evidence into RAG\nRAG_AUTO_INGEST=true\n
Configure the vector database for embeddings and RAG:
# ChromaDB storage path\nCHROMA_DB_PATH=./chroma_db\n\n# Whether to persist ChromaDB to disk\nCHROMA_DB_PERSIST=true\n\n# ChromaDB server host (for remote ChromaDB, optional)\nCHROMA_DB_HOST=localhost\n\n# ChromaDB server port (for remote ChromaDB, optional)\nCHROMA_DB_PORT=8000\n
from src.utils.config import settings\n\n# Check API key availability\nif settings.has_openai_key:\n # Use OpenAI\n pass\n\nif settings.has_anthropic_key:\n # Use Anthropic\n pass\n\nif settings.has_huggingface_key:\n # Use HuggingFace\n pass\n\nif settings.has_any_llm_key:\n # At least one LLM is available\n pass\n
from src.utils.config import settings\n\n# Check service availability\nif settings.modal_available:\n # Use Modal sandbox\n pass\n\nif settings.web_search_available:\n # Web search is configured\n pass\n
The orchestrator factory uses settings to determine mode:
"},{"location":"configuration/#environment-variables-reference","title":"Environment Variables Reference","text":""},{"location":"configuration/#required-at-least-one-llm","title":"Required (at least one LLM)","text":"
OPENAI_API_KEY - OpenAI API key (required for OpenAI provider)
ANTHROPIC_API_KEY - Anthropic API key (required for Anthropic provider)
HF_TOKEN or HUGGINGFACE_API_KEY - HuggingFace API token (optional, can work without for public models)
Model Selection: Reasoning/main/fast model configuration
Service Integration: Additional service integrations and configurations
"},{"location":"contributing/","title":"Contributing to The DETERMINATOR","text":"
Thank you for your interest in contributing to The DETERMINATOR! This guide will help you get started.
Note on Project Names: \"The DETERMINATOR\" is the product name, \"DeepCritical\" is the organization/project name, and \"determinator\" is the Python package name.
# Clone from GitHub\ngit clone https://github.com/DeepCritical/GradioDemo.git\ncd GradioDemo\n\n# Add HuggingFace remote (optional, for deployment)\ngit remote add huggingface-upstream https://huggingface.co/spaces/DataQuests/DeepCritical\n
Important: Never push directly to main or dev on HuggingFace. Always work through GitHub PRs. GitHub is the source of truth; HuggingFace is for deployment/demo only.
logger.info(\"Starting search\", query=query, tools=[t.name for t in tools])\nlogger.warning(\"Search tool failed\", tool=tool.name, error=str(result))\nlogger.error(\"Assessment failed\", error=str(e))\n
The project uses pytest markers to categorize tests. These markers are defined in pyproject.toml:
@pytest.mark.unit: Unit tests (mocked, fast) - Run with -m \"unit\"
@pytest.mark.integration: Integration tests (real APIs) - Run with -m \"integration\"
@pytest.mark.slow: Slow tests - Run with -m \"slow\"
@pytest.mark.openai: Tests requiring OpenAI API key - Run with -m \"openai\" or exclude with -m \"not openai\"
@pytest.mark.huggingface: Tests requiring HuggingFace API key or using HuggingFace models - Run with -m \"huggingface\"
@pytest.mark.embedding_provider: Tests requiring API-based embedding providers (OpenAI, etc.) - Run with -m \"embedding_provider\"
@pytest.mark.local_embeddings: Tests using local embeddings (sentence-transformers, ChromaDB) - Run with -m \"local_embeddings\"
"},{"location":"contributing/testing/#running-tests-by-marker","title":"Running Tests by Marker","text":"
# Run only unit tests (excludes OpenAI tests by default)\nuv run pytest tests/unit/ -v -m \"not openai\" -p no:logfire\n\n# Run HuggingFace tests\nuv run pytest tests/ -v -m \"huggingface\" -p no:logfire\n\n# Run all tests\nuv run pytest tests/ -v -p no:logfire\n\n# Run only local embedding tests\nuv run pytest tests/ -v -m \"local_embeddings\" -p no:logfire\n\n# Exclude slow tests\nuv run pytest tests/ -v -m \"not slow\" -p no:logfire\n
Note: The -p no:logfire flag disables the logfire plugin to avoid conflicts during testing.
# Run unit tests (default, excludes OpenAI tests)\nuv run pytest tests/unit/ -v -m \"not openai\" -p no:logfire\n\n# Run HuggingFace tests\nuv run pytest tests/ -v -m \"huggingface\" -p no:logfire\n\n# Run all tests\nuv run pytest tests/ -v -p no:logfire\n
This page provides examples of using The DETERMINATOR for various research tasks.
"},{"location":"getting-started/examples/#basic-research-query","title":"Basic Research Query","text":""},{"location":"getting-started/examples/#example-1-drug-information","title":"Example 1: Drug Information","text":"
Query:
What are the latest treatments for Alzheimer's disease?\n
What The DETERMINATOR Does: 1. Searches PubMed for recent papers 2. Searches ClinicalTrials.gov for active trials 3. Evaluates evidence quality 4. Synthesizes findings into a comprehensive report
What clinical trials are investigating metformin for cancer prevention?\n
What The DETERMINATOR Does:
Searches ClinicalTrials.gov for relevant trials
Searches PubMed for supporting literature
Provides trial details and status
Summarizes findings
"},{"location":"getting-started/examples/#advanced-research-queries","title":"Advanced Research Queries","text":""},{"location":"getting-started/examples/#example-3-comprehensive-review","title":"Example 3: Comprehensive Review","text":"
Query:
Review the evidence for using metformin as an anti-aging intervention, \nincluding clinical trials, mechanisms of action, and safety profile.\n
What The DETERMINATOR Does: 1. Uses deep research mode (multi-section) 2. Searches multiple sources in parallel 3. Generates sections on: - Clinical trials - Mechanisms of action - Safety profile 4. Synthesizes comprehensive report
Analyze whether vitamin D supplementation reduces COVID-19 severity\n
"},{"location":"getting-started/examples/#code-examples","title":"Code Examples","text":""},{"location":"getting-started/examples/#python-api-usage","title":"Python API Usage","text":"
# Run research query\nquery = \"What are the latest treatments for Alzheimer's disease?\"\nasync for event in orchestrator.run(query):\n print(f\"Event: {event.type} - {event.data}\")\n
# Required: At least one LLM provider\nLLM_PROVIDER=openai # or \"anthropic\" or \"huggingface\"\nOPENAI_API_KEY=your_openai_api_key_here\n\n# Optional: Other services\nNCBI_API_KEY=your_ncbi_api_key_here # For higher PubMed rate limits\nMODAL_TOKEN_ID=your_modal_token_id\nMODAL_TOKEN_SECRET=your_modal_token_secret\n
See the Configuration Guide for all available options.
Import Errors: - Ensure you've installed all required dependencies - Check that Python 3.11+ is being used
API Key Errors: - Verify your .env file is in the project root - Check that API keys are correctly formatted - Ensure at least one LLM provider is configured
Module Not Found: - Run uv sync or pip install -e . again - Check that you're in the correct virtual environment
Port Already in Use: - Change the port in src/app.py or use environment variable - Kill the process using port 7860
The DETERMINATOR exposes a Model Context Protocol (MCP) server, allowing you to use its search tools directly from Claude Desktop or other MCP clients.
"},{"location":"getting-started/mcp-integration/#what-is-mcp","title":"What is MCP?","text":"
The Model Context Protocol (MCP) is a standard for connecting AI assistants to external tools and data sources. The DETERMINATOR implements an MCP server that exposes its search capabilities as MCP tools.
"},{"location":"getting-started/mcp-integration/#mcp-server-url","title":"MCP Server URL","text":"
In Claude Desktop, you should see The DETERMINATOR tools available: - search_pubmed - search_clinical_trials - search_biorxiv - search_all - analyze_hypothesis
Server Not Found: - Ensure DeepCritical is running (uv run gradio run src/app.py) - Verify the URL in claude_desktop_config.json is correct - Check that port 7860 is not blocked by firewall
Tools Not Appearing: - Restart Claude Desktop after configuration changes - Check Claude Desktop logs for errors - Verify MCP server is accessible at the configured URL
"},{"location":"getting-started/quick-start/#first-research-query","title":"First Research Query","text":"
Enter a Research Question
Type your research question in the chat interface, for example: - \"What are the latest treatments for Alzheimer's disease?\" - \"Review the evidence for metformin in cancer prevention\" - \"What clinical trials are investigating COVID-19 vaccines?\"
Submit the Query
Click \"Submit\" or press Enter. The system will: - Generate observations about your query - Identify knowledge gaps - Search multiple sources (PubMed, ClinicalTrials.gov, Europe PMC) - Evaluate evidence quality - Synthesize findings into a report
Review Results
Watch the real-time progress in the chat interface: - Search operations and results - Evidence evaluation - Report generation - Final research report with citations
Click \"Sign in with HuggingFace\" at the top of the app
Authorize the application
Your HuggingFace API token will be automatically used
No need to manually enter API keys
"},{"location":"getting-started/quick-start/#manual-api-key","title":"Manual API Key","text":"
Open the Settings accordion
Enter your API key:
OpenAI API key
Anthropic API key
HuggingFace API key
Click \"Save Settings\"
Manual keys take priority over OAuth tokens
"},{"location":"getting-started/quick-start/#understanding-the-interface","title":"Understanding the Interface","text":""},{"location":"getting-started/quick-start/#chat-interface","title":"Chat Interface","text":"
Input: Enter your research questions here
Messages: View conversation history and research progress
Streaming: Real-time updates as research progresses
The DETERMINATOR is a powerful generalist deep research agent system that uses iterative search-and-judge loops to comprehensively investigate any research question. It stops at nothing until finding precise answers, only stopping at configured limits (budget, time, iterations). The system automatically determines if medical knowledge sources are needed and adapts its search strategy accordingly. It supports multiple orchestration patterns, graph-based execution, parallel research workflows, and long-running task management with real-time streaming.
Note: The UI provides separate controls for orchestrator mode and graph research mode. When using graph-based orchestrators (iterative/deep/auto), the graph research mode determines the specific pattern used within the graph execution.
Graph-Based Execution: Flexible graph orchestration with conditional routing
Parallel Research Loops: Run multiple research tasks concurrently
Iterative Research: Single-loop research with search-judge-synthesize cycles that continues until precise answers are found
Deep Research: Multi-section parallel research with planning and synthesis
Magentic Orchestration: Multi-agent coordination using Microsoft Agent Framework (alias: \"advanced\" mode)
Stops at Nothing: Only stops at configured limits (budget, time, iterations), otherwise continues until finding precise answers
Orchestrator Modes: - simple: Legacy linear search-judge loop - advanced (or magentic): Multi-agent coordination (requires OpenAI API key) - iterative: Knowledge-gap-driven research with single loop - deep: Parallel section-based research with planning - auto: Intelligent mode detection based on query complexity
Graph Research Modes (used within graph orchestrator): - iterative: Single research loop pattern - deep: Multi-section parallel research pattern - auto: Auto-detect pattern based on query complexity
Execution Modes: - use_graph=True: Graph-based execution with parallel and conditional routing - use_graph=False: Agent chains with sequential execution (backward compatible)
Authentication is mandatory - you must authenticate before using the application. The app will display an error message if you try to use it without authentication.
HuggingFace OAuth Login (Recommended): - Click the \"Sign in with HuggingFace\" button at the top of the app - Your HuggingFace API token will be automatically used for AI inference - No need to manually enter API keys when logged in
Manual API Key (Alternative): - Set environment variable HF_TOKEN or HUGGINGFACE_API_KEY before starting the app - The app will automatically use these tokens if OAuth login is not available - Supports HuggingFace API keys only (OpenAI/Anthropic keys are not used in the current implementation)
"},{"location":"overview/quick-start/#2-start-a-research-query","title":"2. Start a Research Query","text":"
Enter your research question in the chat interface
Text Input: Type your question directly
Image Input: Click the \ud83d\udcf7 icon to upload images (OCR will extract text)
Audio Input: Click the \ud83c\udfa4 icon to record or upload audio (STT will transcribe to text)
Click \"Submit\" or press Enter
Watch the real-time progress as the system:
Generates observations
Identifies knowledge gaps
Searches multiple sources
Evaluates evidence
Synthesizes findings
Review the final research report
Audio Output: If enabled, the final response will include audio synthesis (TTS)
Multimodal Features: - Configure image/audio input and output in the sidebar settings - Image OCR and audio STT/TTS can be enabled/disabled independently - TTS voice and speed can be customized in the Audio Output settings
search_pubmed: Search peer-reviewed biomedical literature
search_clinical_trials: Search ClinicalTrials.gov
search_biorxiv: Search bioRxiv/medRxiv preprints
search_neo4j: Search Neo4j knowledge graph for papers and disease relationships
search_all: Search all sources simultaneously
analyze_hypothesis: Secure statistical analysis using Modal sandboxes
Note: The application automatically uses all available search tools (Neo4j, PubMed, ClinicalTrials.gov, Europe PMC, Web search, RAG) based on query analysis. Neo4j knowledge graph search is included by default for biomedical queries.
The DeepCritical team met online in the Alzheimer's Critical Literature Review Group in the Hugging Science initiative. We're building the agent framework we want to use for AI-assisted research to turn the vast amounts of clinical data into cures.
The DeepCritical team met online in the Alzheimer's Critical Literature Review Group in the Hugging Science initiative. We're building the agent framework we want to use for AI-assisted research to turn the vast amounts of clinical data into cures.