Spaces:
Running
Running
File size: 5,658 Bytes
026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d45d242 026ee5d d9162ac 026ee5d d45d242 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 208 209 210 211 212 |
# Agents API Reference
This page documents the API for DeepCritical agents.
## KnowledgeGapAgent
**Module**: `src.agents.knowledge_gap`
**Purpose**: Evaluates research state and identifies knowledge gaps.
### Methods
#### `evaluate`
<!--codeinclude-->
[KnowledgeGapAgent.evaluate](../src/agents/knowledge_gap.py) start_line:66 end_line:74
<!--/codeinclude-->
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
## ToolSelectorAgent
**Module**: `src.agents.tool_selector`
**Purpose**: Selects appropriate tools for addressing knowledge gaps.
### Methods
#### `select_tools`
<!--codeinclude-->
[ToolSelectorAgent.select_tools](../src/agents/tool_selector.py) start_line:78 end_line:84
<!--/codeinclude-->
Selects tools for addressing a knowledge gap.
**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.
## WriterAgent
**Module**: `src.agents.writer`
**Purpose**: Generates final reports from research findings.
### Methods
#### `write_report`
<!--codeinclude-->
[WriterAgent.write_report](../src/agents/writer.py) start_line:67 end_line:73
<!--/codeinclude-->
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: "")
**Returns**: Markdown string with numbered citations.
## LongWriterAgent
**Module**: `src.agents.long_writer`
**Purpose**: Long-form report generation with section-by-section writing.
### Methods
#### `write_next_section`
<!--codeinclude-->
[LongWriterAgent.write_next_section](../src/agents/long_writer.py) start_line:94 end_line:100
<!--/codeinclude-->
Writes the next section of a long-form report.
**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.
#### `write_report`
<!--codeinclude-->
[LongWriterAgent.write_report](../src/agents/long_writer.py) start_line:263 end_line:268
<!--/codeinclude-->
Generates final report from draft.
**Parameters**:
- `query`: Research query string
- `report_title`: Title of the report
- `report_draft`: Complete report draft
**Returns**: Final markdown report string.
## ProofreaderAgent
**Module**: `src.agents.proofreader`
**Purpose**: Proofreads and polishes report drafts.
### Methods
#### `proofread`
<!--codeinclude-->
[ProofreaderAgent.proofread](../src/agents/proofreader.py) start_line:72 end_line:76
<!--/codeinclude-->
Proofreads and polishes a report draft.
**Parameters**:
- `query`: Research query string
- `report_title`: Title of the report
- `report_draft`: Report draft to proofread
**Returns**: Polished markdown string.
## ThinkingAgent
**Module**: `src.agents.thinking`
**Purpose**: Generates observations from conversation history.
### Methods
#### `generate_observations`
<!--codeinclude-->
[ThinkingAgent.generate_observations](../src/agents/thinking.py) start_line:70 end_line:76
<!--/codeinclude-->
Generates observations from conversation history.
**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**: Observation string.
## InputParserAgent
**Module**: `src.agents.input_parser`
**Purpose**: Parses and improves user queries, detects research mode.
### Methods
#### `parse`
<!--codeinclude-->
[InputParserAgent.parse](../src/agents/input_parser.py) start_line:82 end_line:82
<!--/codeinclude-->
Parses and improves a user query.
**Parameters**:
- `query`: Original query string
**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
## Factory Functions
All agents have factory functions in `src.agent_factory.agents`:
<!--codeinclude-->
[Factory Functions](../src/agent_factory/agents.py) start_line:30 end_line:50
<!--/codeinclude-->
**Parameters**:
- `model`: Optional Pydantic AI model. If None, uses `get_model()` from settings.
- `oauth_token`: Optional OAuth token from HuggingFace login (takes priority over env vars)
**Returns**: Agent instance.
## See Also
- [Architecture - Agents](../architecture/agents.md) - Architecture overview
- [Models API](models.md) - Data models used by agents
|