Skip to content

Commit a6836c4

Browse files
Update deep research to run faster with fewer results
1 parent dfd188e commit a6836c4

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

langchain/deep-research/src/agent/configuration.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Configuration(BaseModel):
4444
metadata={
4545
"x_oap_ui_config": {
4646
"type": "number",
47-
"default": 3,
47+
"default": 2,
4848
"min": 1,
4949
"max": 10,
5050
"description": "Maximum number of retries for structured output calls from models"
@@ -96,7 +96,7 @@ class Configuration(BaseModel):
9696
metadata={
9797
"x_oap_ui_config": {
9898
"type": "slider",
99-
"default": 6,
99+
"default": 4,
100100
"min": 1,
101101
"max": 10,
102102
"step": 1,
@@ -119,11 +119,11 @@ class Configuration(BaseModel):
119119
)
120120
# Model Configuration
121121
summarization_model: str = Field(
122-
default="openai:gpt-4.1-mini",
122+
default="openai:gpt-4.1-nano",
123123
metadata={
124124
"x_oap_ui_config": {
125125
"type": "text",
126-
"default": "openai:gpt-4.1-mini",
126+
"default": "openai:gpt-4.1-nano",
127127
"description": "Model for summarizing research results from Tavily search results"
128128
}
129129
}
@@ -151,11 +151,11 @@ class Configuration(BaseModel):
151151
}
152152
)
153153
research_model: str = Field(
154-
default="openai:gpt-4.1",
154+
default="openai:gpt-4.1-nano",
155155
metadata={
156156
"x_oap_ui_config": {
157157
"type": "text",
158-
"default": "openai:gpt-4.1",
158+
"default": "openai:gpt-4.1-nano",
159159
"description": "Model for conducting research. NOTE: Make sure your Researcher Model supports the selected search API."
160160
}
161161
}
@@ -171,11 +171,11 @@ class Configuration(BaseModel):
171171
}
172172
)
173173
compression_model: str = Field(
174-
default="openai:gpt-4.1",
174+
default="openai:gpt-4.1-nano",
175175
metadata={
176176
"x_oap_ui_config": {
177177
"type": "text",
178-
"default": "openai:gpt-4.1",
178+
"default": "openai:gpt-4.1-nano",
179179
"description": "Model for compressing research findings from sub-agents. NOTE: Make sure your Compression Model supports the selected search API."
180180
}
181181
}
@@ -191,11 +191,11 @@ class Configuration(BaseModel):
191191
}
192192
)
193193
final_report_model: str = Field(
194-
default="openai:gpt-4.1",
194+
default="openai:gpt-4.1-nano",
195195
metadata={
196196
"x_oap_ui_config": {
197197
"type": "text",
198-
"default": "openai:gpt-4.1",
198+
"default": "openai:gpt-4.1-nano",
199199
"description": "Model for writing the final report from all research findings"
200200
}
201201
}

langchain/deep-research/src/agent/prompts.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@
5252
You will return a single research question that will be used to guide the research.
5353
5454
Guidelines:
55-
1. Maximize Specificity and Detail
55+
1. Maximize Specificity but ENSURE CONCISENESS
5656
- Include all known user preferences and explicitly list key attributes or dimensions to consider.
5757
- It is important that all details from the user are included in the instructions.
58+
- Critically, avoid repeating any information and prioritize conciseness in your generation.
5859
5960
2. Fill in Unstated But Necessary Dimensions as Open-Ended
6061
- If certain attributes are essential for a meaningful output but the user has not provided them, explicitly state that they are open-ended or default to no specific constraint.
@@ -142,7 +143,7 @@
142143
143144
<Available Tools>
144145
You have access to two main tools:
145-
1. **tavily_search**: For conducting web searches to gather information
146+
1. **tavily_search**: For conducting web searches to gather information. Supply max 3 queries to this tool.
146147
2. **think_tool**: For reflection and strategic planning during research
147148
{mcp_prompt}
148149
@@ -245,10 +246,11 @@
245246
246247
Please create a detailed answer to the overall research brief that:
247248
1. Is well-organized with proper headings (# for title, ## for sections, ### for subsections)
248-
2. Includes specific facts and insights from the research
249-
3. References relevant sources using [Title](URL) format
250-
4. Provides a balanced, thorough analysis. Be as comprehensive as possible, and include all information that is relevant to the overall research question. People are using you for deep research and will expect detailed, comprehensive answers.
251-
5. Includes a "Sources" section at the end with all referenced links
249+
2. Is concise and to the point. Avoid repeating information.
250+
3. Includes specific facts and insights from the research
251+
4. References relevant sources using [Title](URL) format
252+
5. Provides a balanced, thorough analysis. Be as comprehensive as possible, and include all information that is relevant to the overall research question. People are using you for deep research and will expect detailed, comprehensive answers.
253+
6. Includes a "Sources" section at the end with all referenced links
252254
253255
You can structure your report in a number of different ways. Here are some examples:
254256

langchain/deep-research/src/agent/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
@tool(description=TAVILY_SEARCH_DESCRIPTION)
4444
async def tavily_search(
4545
queries: List[str],
46-
max_results: Annotated[int, InjectedToolArg] = 5,
46+
max_results: Annotated[int, InjectedToolArg] = 2,
4747
topic: Annotated[Literal["general", "news", "finance"], InjectedToolArg] = "general",
4848
config: RunnableConfig = None
4949
) -> str:
@@ -137,7 +137,7 @@ async def noop():
137137

138138
async def tavily_search_async(
139139
search_queries,
140-
max_results: int = 5,
140+
max_results: int = 2,
141141
topic: Literal["general", "news", "finance"] = "general",
142142
include_raw_content: bool = True,
143143
config: RunnableConfig = None

0 commit comments

Comments
 (0)