Simplify planning stage by executing tasks directly. Make research notes available to more agents/tools.
This commit is contained in:
parent
f2ce6a7ab0
commit
10b58bb2db
|
|
@ -404,6 +404,7 @@ def run_task_implementation_agent(
|
|||
related_files=related_files,
|
||||
key_facts=get_memory_value('key_facts'),
|
||||
key_snippets=get_memory_value('key_snippets'),
|
||||
research_notes=get_memory_value('research_notes'),
|
||||
work_log=get_memory_value('work_log'),
|
||||
expert_section=EXPERT_PROMPT_SECTION_IMPLEMENTATION if expert_enabled else "",
|
||||
human_section=HUMAN_PROMPT_SECTION_IMPLEMENTATION if _global_memory.get('config', {}).get('hil', False) else "",
|
||||
|
|
|
|||
|
|
@ -470,9 +470,6 @@ Guidelines:
|
|||
|
||||
After finalizing the overall approach:
|
||||
Use emit_plan to store the high-level implementation plan.
|
||||
For each sub-task, use emit_task to store a step-by-step description.
|
||||
The description should be only as detailed as warranted by the complexity of the request.
|
||||
You may use delete_tasks or swap_task_order to adjust the task list/order as you plan.
|
||||
|
||||
Once you are absolutely sure you are completed planning, you may begin to call request_task_implementation one-by-one for each task to implement the plan.
|
||||
If you have any doubt about the correctness or thoroughness of the plan, consult the expert (if expert is available) for verification.
|
||||
|
|
@ -506,6 +503,9 @@ Key Snippets:
|
|||
Relevant Files:
|
||||
{related_files}
|
||||
|
||||
Research Notes:
|
||||
{research_notes}
|
||||
|
||||
Work done so far:
|
||||
<work log>
|
||||
{work_log}
|
||||
|
|
|
|||
|
|
@ -96,10 +96,7 @@ def get_planning_tools(expert_enabled: bool = True, web_research_enabled: bool =
|
|||
|
||||
# Add planning-specific tools
|
||||
planning_tools = [
|
||||
delete_tasks,
|
||||
emit_plan,
|
||||
emit_task,
|
||||
swap_task_order,
|
||||
request_task_implementation,
|
||||
plan_implementation_completed
|
||||
]
|
||||
|
|
@ -144,7 +141,8 @@ def get_web_research_tools(expert_enabled: bool = True) -> list:
|
|||
"""
|
||||
tools = [
|
||||
web_search_tavily,
|
||||
emit_research_notes
|
||||
emit_research_notes,
|
||||
task_completed
|
||||
]
|
||||
|
||||
if expert_enabled:
|
||||
|
|
|
|||
|
|
@ -111,12 +111,10 @@ def request_web_research(query: str) -> ResearchResult:
|
|||
|
||||
success = True
|
||||
reason = None
|
||||
web_research_notes = []
|
||||
|
||||
try:
|
||||
# Run web research agent
|
||||
from ..agent_utils import run_web_research_agent
|
||||
original_research_notes = _global_memory.get('research_notes', [])
|
||||
result = run_web_research_agent(
|
||||
query,
|
||||
model,
|
||||
|
|
@ -125,7 +123,6 @@ def request_web_research(query: str) -> ResearchResult:
|
|||
console_message=query,
|
||||
config=config
|
||||
)
|
||||
web_research_notes = _global_memory.get('research_notes', [])
|
||||
except AgentInterrupt:
|
||||
print()
|
||||
response = ask_human.invoke({"question": "Why did you interrupt me?"})
|
||||
|
|
@ -138,7 +135,6 @@ def request_web_research(query: str) -> ResearchResult:
|
|||
success = False
|
||||
reason = f"error: {str(e)}"
|
||||
finally:
|
||||
_global_memory['research_notes'] = original_research_notes
|
||||
# Get completion message if available
|
||||
completion_message = _global_memory.get('completion_message', 'Task was completed successfully.' if success else None)
|
||||
|
||||
|
|
@ -155,8 +151,8 @@ def request_web_research(query: str) -> ResearchResult:
|
|||
return {
|
||||
"work_log": work_log,
|
||||
"completion_message": completion_message,
|
||||
"web_research_notes": web_research_notes,
|
||||
"key_snippets": get_memory_value("key_snippets"),
|
||||
"research_notes": get_memory_value("research_notes"),
|
||||
"success": success,
|
||||
"reason": reason
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ def ask_expert(question: str) -> str:
|
|||
related_contents = read_related_files(file_paths)
|
||||
key_snippets = get_memory_value('key_snippets')
|
||||
key_facts = get_memory_value('key_facts')
|
||||
research_notes = get_memory_value('research_notes')
|
||||
|
||||
# Build display query (just question)
|
||||
display_query = "# Question\n" + question
|
||||
|
|
@ -153,6 +154,9 @@ def ask_expert(question: str) -> str:
|
|||
if related_contents:
|
||||
query_parts.extend(['# Related Files', related_contents])
|
||||
|
||||
if related_contents:
|
||||
query_parts.extend(['# Research Notes', research_notes])
|
||||
|
||||
if key_snippets and len(key_snippets) > 0:
|
||||
query_parts.extend(['# Key Snippets', key_snippets])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue