Make answered question handling the responsibility of the search agent
This commit is contained in:
parent
ccaae7cca1
commit
9c128c1d36
2 changed files with 4 additions and 20 deletions
|
|
@ -165,7 +165,7 @@ class ResearchOrchestrator(BaseResearchAgent[ResearchPlan]):
|
||||||
break
|
break
|
||||||
|
|
||||||
# Use current sub-questions for this iteration
|
# Use current sub-questions for this iteration
|
||||||
questions_to_search = context.sub_questions
|
questions_to_search = context.sub_questions[:]
|
||||||
|
|
||||||
# Search phase - answer all questions in this iteration
|
# Search phase - answer all questions in this iteration
|
||||||
self._log(
|
self._log(
|
||||||
|
|
@ -175,17 +175,8 @@ class ResearchOrchestrator(BaseResearchAgent[ResearchPlan]):
|
||||||
self._log(f" {i}. {q}")
|
self._log(f" {i}. {q}")
|
||||||
|
|
||||||
# Run searches for all questions and remove answered ones
|
# Run searches for all questions and remove answered ones
|
||||||
answered_questions = []
|
|
||||||
for search_question in questions_to_search:
|
for search_question in questions_to_search:
|
||||||
try:
|
await self.search_agent.run(search_question, deps=deps)
|
||||||
await self.search_agent.run(search_question, deps=deps)
|
|
||||||
except Exception as e: # pragma: no cover - defensive
|
|
||||||
self._log(
|
|
||||||
f"\n [red]×[/red] Omitting failed question: {search_question} ({e})"
|
|
||||||
)
|
|
||||||
finally:
|
|
||||||
answered_questions.append(search_question)
|
|
||||||
|
|
||||||
if self._console and context.qa_responses:
|
if self._console and context.qa_responses:
|
||||||
# Show the last QA response (which should be for this question)
|
# Show the last QA response (which should be for this question)
|
||||||
latest_qa = context.qa_responses[-1]
|
latest_qa = context.qa_responses[-1]
|
||||||
|
|
@ -197,11 +188,6 @@ class ResearchOrchestrator(BaseResearchAgent[ResearchPlan]):
|
||||||
self._log(f"\n [green]✓[/green] {search_question}")
|
self._log(f"\n [green]✓[/green] {search_question}")
|
||||||
self._log(f" {answer_preview}")
|
self._log(f" {answer_preview}")
|
||||||
|
|
||||||
# Remove answered questions from the list
|
|
||||||
for question in answered_questions:
|
|
||||||
if question in context.sub_questions:
|
|
||||||
context.sub_questions.remove(question)
|
|
||||||
|
|
||||||
# Analysis and Evaluation phase
|
# Analysis and Evaluation phase
|
||||||
self._log(
|
self._log(
|
||||||
"\n[bold cyan]📊 Analyzing and evaluating research progress...[/bold cyan]"
|
"\n[bold cyan]📊 Analyzing and evaluating research progress...[/bold cyan]"
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,8 @@ class SearchSpecialistAgent(BaseResearchAgent[SearchAnswer]):
|
||||||
the QA response with the last search results as sources.
|
the QA response with the last search results as sources.
|
||||||
"""
|
"""
|
||||||
result = await super().run(prompt, deps, **kwargs)
|
result = await super().run(prompt, deps, **kwargs)
|
||||||
|
deps.context.add_qa_response(result.output)
|
||||||
if result.output:
|
deps.context.sub_questions.remove(prompt)
|
||||||
deps.context.add_qa_response(result.output)
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_system_prompt(self) -> str:
|
def get_system_prompt(self) -> str:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue