File size: 4,571 Bytes
026ee5d
 
 
 
 
 
 
 
 
 
 
 
 
 
d45d242
 
 
026ee5d
 
 
 
 
 
d45d242
 
f173aad
d45d242
 
 
f173aad
 
d45d242
026ee5d
 
 
 
 
 
 
 
 
 
 
d45d242
 
 
026ee5d
 
 
 
 
f173aad
d45d242
 
 
f173aad
 
d45d242
026ee5d
 
 
 
 
 
 
 
 
 
 
d45d242
 
 
026ee5d
 
 
 
 
f173aad
026ee5d
 
 
f173aad
 
 
d45d242
026ee5d
 
 
 
 
 
 
 
 
 
d45d242
 
 
026ee5d
 
 
 
d45d242
 
 
 
 
026ee5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d45d242
 
 
026ee5d
 
 
 
 
 
 
 
d45d242
 
026ee5d
 
 
 
 
 
 
7a4d2bd
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
# Orchestrators API Reference

This page documents the API for DeepCritical orchestrators.

## IterativeResearchFlow

**Module**: `src.orchestrator.research_flow`

**Purpose**: Single-loop research with search-judge-synthesize cycles.

### Methods

#### `run`

<!--codeinclude-->
[IterativeResearchFlow.run](../src/orchestrator/research_flow.py) start_line:134 end_line:140
<!--/codeinclude-->

Runs iterative research flow.

**Parameters**:
- `query`: Research query string
- `background_context`: Background context (default: "")
- `output_length`: Optional description of desired output length (default: "")
- `output_instructions`: Optional additional instructions for report generation (default: "")
- `message_history`: Optional user conversation history in Pydantic AI `ModelMessage` format (default: None)

**Returns**: Final report string.

**Note**: The `message_history` parameter enables multi-turn conversations by providing context from previous interactions.

**Note**: `max_iterations`, `max_time_minutes`, and `token_budget` are constructor parameters, not `run()` parameters.

## DeepResearchFlow

**Module**: `src.orchestrator.research_flow`

**Purpose**: Multi-section parallel research with planning and synthesis.

### Methods

#### `run`

<!--codeinclude-->
[DeepResearchFlow.run](../src/orchestrator/research_flow.py) start_line:778 end_line:778
<!--/codeinclude-->

Runs deep research flow.

**Parameters**:
- `query`: Research query string
- `message_history`: Optional user conversation history in Pydantic AI `ModelMessage` format (default: None)

**Returns**: Final report string.

**Note**: The `message_history` parameter enables multi-turn conversations by providing context from previous interactions.

**Note**: `max_iterations_per_section`, `max_time_minutes`, and `token_budget` are constructor parameters, not `run()` parameters.

## GraphOrchestrator

**Module**: `src.orchestrator.graph_orchestrator`

**Purpose**: Graph-based execution using Pydantic AI agents as nodes.

### Methods

#### `run`

<!--codeinclude-->
[GraphOrchestrator.run](../src/orchestrator/graph_orchestrator.py) start_line:177 end_line:177
<!--/codeinclude-->

Runs graph-based research orchestration.

**Parameters**:
- `query`: Research query string
- `message_history`: Optional user conversation history in Pydantic AI `ModelMessage` format (default: None)

**Yields**: `AgentEvent` objects during graph execution.

**Note**: 
- `research_mode` and `use_graph` are constructor parameters, not `run()` parameters.
- The `message_history` parameter enables multi-turn conversations by providing context from previous interactions. Message history is stored in `GraphExecutionContext` and passed to agents during execution.

## Orchestrator Factory

**Module**: `src.orchestrator_factory`

**Purpose**: Factory for creating orchestrators.

### Functions

#### `create_orchestrator`

<!--codeinclude-->
[create_orchestrator](../src/orchestrator_factory.py) start_line:44 end_line:50
<!--/codeinclude-->

Creates an orchestrator instance.

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

## MagenticOrchestrator

**Module**: `src.orchestrator_magentic`

**Purpose**: Multi-agent coordination using Microsoft Agent Framework.

### Methods

#### `run`

<!--codeinclude-->
[MagenticOrchestrator.run](../src/orchestrator_magentic.py) start_line:101 end_line:101
<!--/codeinclude-->

Runs Magentic orchestration.

**Parameters**:
- `query`: Research query string

**Yields**: `AgentEvent` objects converted from Magentic events.

**Note**: `max_rounds` and `max_stalls` are constructor parameters, not `run()` parameters.

**Requirements**:
- `agent-framework-core` package
- OpenAI API key

## See Also

- [Architecture - Orchestrators](../architecture/orchestrators.md) - Architecture overview
- [Graph Orchestration](../architecture/graph_orchestration.md) - Graph execution details