File size: 4,160 Bytes
026ee5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# Examples

This page provides examples of using DeepCritical for various research tasks.

## Basic Research Query

### Example 1: Drug Information

**Query**:
```
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

### Example 2: Clinical Trial Search

**Query**:
```
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

## Advanced Research Queries

### Example 3: Comprehensive Review

**Query**:
```
Review the evidence for using metformin as an anti-aging intervention, 
including clinical trials, mechanisms of action, and safety profile.
```

**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

### Example 4: Hypothesis Testing

**Query**:
```
Test the hypothesis that regular exercise reduces Alzheimer's disease risk.
```

**What DeepCritical Does**:
1. Generates testable hypotheses
2. Searches for supporting/contradicting evidence
3. Performs statistical analysis (if Modal configured)
4. Provides verdict: SUPPORTED, REFUTED, or INCONCLUSIVE

## MCP Tool Examples

### Using search_pubmed

```
Search PubMed for "CRISPR gene editing cancer therapy"
```

### Using search_clinical_trials

```
Find active clinical trials for "diabetes type 2 treatment"
```

### Using search_all

```
Search all sources for "COVID-19 vaccine side effects"
```

### Using analyze_hypothesis

```
Analyze whether vitamin D supplementation reduces COVID-19 severity
```

## Code Examples

### Python API Usage

```python
from src.orchestrator_factory import create_orchestrator
from src.tools.search_handler import SearchHandler
from src.agent_factory.judges import create_judge_handler

# Create orchestrator
search_handler = SearchHandler()
judge_handler = create_judge_handler()
orchestrator = create_orchestrator(
    search_handler=search_handler,
    judge_handler=judge_handler,
    config={},
    mode="advanced"
)

# Run research query
query = "What are the latest treatments for Alzheimer's disease?"
async for event in orchestrator.run(query):
    print(f"Event: {event.type} - {event.data}")
```

### Gradio UI Integration

```python
import gradio as gr
from src.app import create_research_interface

# Create interface
interface = create_research_interface()

# Launch
interface.launch(server_name="0.0.0.0", server_port=7860)
```

## Research Patterns

### Iterative Research

Single-loop research with search-judge-synthesize cycles:

```python
from src.orchestrator.research_flow import IterativeResearchFlow

flow = IterativeResearchFlow(
    search_handler=search_handler,
    judge_handler=judge_handler,
    use_graph=False
)

async for event in flow.run(query):
    # Handle events
    pass
```

### Deep Research

Multi-section parallel research:

```python
from src.orchestrator.research_flow import DeepResearchFlow

flow = DeepResearchFlow(
    search_handler=search_handler,
    judge_handler=judge_handler,
    use_graph=True
)

async for event in flow.run(query):
    # Handle events
    pass
```

## Configuration Examples

### Basic Configuration

```bash
# .env file
LLM_PROVIDER=openai
OPENAI_API_KEY=your_key_here
MAX_ITERATIONS=10
```

### Advanced Configuration

```bash
# .env file
LLM_PROVIDER=anthropic
ANTHROPIC_API_KEY=your_key_here
EMBEDDING_PROVIDER=local
WEB_SEARCH_PROVIDER=duckduckgo
MAX_ITERATIONS=20
DEFAULT_TOKEN_LIMIT=200000
USE_GRAPH_EXECUTION=true
```

## Next Steps

- Read the [Configuration Guide](../configuration/index.md) for all options
- Explore the [Architecture Documentation](../architecture/graph-orchestration.md)
- Check out the [API Reference](../api/agents.md) for programmatic usage