diff --git a/core/agents/code_monkey.py b/core/agents/code_monkey.py index 72eac0d33..0b62d3d23 100644 --- a/core/agents/code_monkey.py +++ b/core/agents/code_monkey.py @@ -57,10 +57,12 @@ async def implement_changes(self) -> AgentResponse: user_feedback = None user_feedback_qa = None llm = self.get_llm() + if iterations: - instructions = iterations[-1]["description"] - user_feedback = iterations[-1]["user_feedback"] - user_feedback_qa = iterations[-1]["user_feedback_qa"] + last_iteration = iterations[-1] + instructions = last_iteration.get("description") + user_feedback = last_iteration.get("user_feedback") + user_feedback_qa = last_iteration.get("user_feedback_qa") else: instructions = self.current_state.current_task["instructions"] diff --git a/core/agents/developer.py b/core/agents/developer.py index 25b9670b9..a3505529b 100644 --- a/core/agents/developer.py +++ b/core/agents/developer.py @@ -181,12 +181,11 @@ async def breakdown_current_task(self) -> AgentResponse: ) response: str = await llm(convo) - # FIXME: check if this is correct, as sqlalchemy can't figure out modifications - # to attributes; however, self.next is not saved yet so maybe this is fine self.next_state.tasks[current_task_index] = { **task, "instructions": response, } + self.next_state.flag_tasks_as_modified() await self.send_message("Breaking down the task into steps ...") convo.assistant(response).template("parse_task").require_schema(TaskSteps) diff --git a/core/agents/tech_lead.py b/core/agents/tech_lead.py index e4bf4f16d..30f78ea9c 100644 --- a/core/agents/tech_lead.py +++ b/core/agents/tech_lead.py @@ -18,19 +18,19 @@ log = get_logger(__name__) -class Task(BaseModel): - description: str = Field(description=("Very detailed description of a development task.")) +class Epic(BaseModel): + description: str = Field(description=("Description of an epic.")) class DevelopmentPlan(BaseModel): - plan: list[Task] = Field(description="List of development tasks that need to be done to implement the entire plan.") + plan: list[Epic] = Field(description="List of epics that need to be done to implement the entire plan.") class UpdatedDevelopmentPlan(BaseModel): - updated_current_epic: Task = Field( - description="Updated detailed description of what was implemented while working on the current development task." + updated_current_epic: Epic = Field( + description="Updated description of what was implemented while working on the current epic." ) - plan: list[Task] = Field(description="List of unfinished development tasks.") + plan: list[Epic] = Field(description="List of unfinished epics.") class TechLead(BaseAgent): diff --git a/core/agents/troubleshooter.py b/core/agents/troubleshooter.py index 271f343bf..4f097ed03 100644 --- a/core/agents/troubleshooter.py +++ b/core/agents/troubleshooter.py @@ -159,11 +159,7 @@ async def _get_route_files(self) -> list[File]: """Returns the list of file paths that have routes defined in them.""" llm = self.get_llm(ROUTE_FILES_AGENT_NAME) - convo = ( - self._get_task_convo() - .template("get_route_files", task=self.current_state.current_task) - .require_schema(RouteFilePaths) - ) + convo = AgentConvo(self).template("get_route_files").require_schema(RouteFilePaths) file_list = await llm(convo, parser=JSONParser(RouteFilePaths)) route_files: set[str] = set(file_list.files) diff --git a/core/prompts/architect/technologies.prompt b/core/prompts/architect/technologies.prompt index 6b9479ca5..254f3cf03 100644 --- a/core/prompts/architect/technologies.prompt +++ b/core/prompts/architect/technologies.prompt @@ -1,6 +1,6 @@ You're designing the architecture and technical specifications for a new project. -If the project requirements call out for specific technology, use that. Otherwise, if working on a web app, prefer Node.js for the backend (with Express if a web server is needed, and MongoDB if a database is needed), and Bootstrap for the front-end. You MUST NOT use Docker, Kubernetes, microservices and single-page app frameworks like React, Next.js, Angular, Vue or Svelte unless the project details explicitly require it. +If the project requirements call out for specific technology, use that. Otherwise, if working on a web app, prefer Node.js for the backend (with Express if a web server is needed, and MongoDB if a database is needed), and Bootstrap for the front-end. You MUST NOT use Docker, Kubernetes, microservices and single-page app frameworks like Next.js, Angular, Vue or Svelte unless the project details explicitly require it. Here are the details for the new project: ----------------------------- diff --git a/core/prompts/tech-lead/system.prompt b/core/prompts/tech-lead/system.prompt index 8a43e0315..8cdc46e9f 100644 --- a/core/prompts/tech-lead/system.prompt +++ b/core/prompts/tech-lead/system.prompt @@ -1,4 +1,3 @@ You are an experienced tech lead in a software development agency. -Your main task is to break down the project into smaller tasks that developers will do. -You must specify each task as clear as possible. -Each task must have a description of what needs to be implemented. +Your main job is to break down the project into epics that developers will do. +You must specify each epic as clear as possible. diff --git a/core/prompts/troubleshooter/get_route_files.prompt b/core/prompts/troubleshooter/get_route_files.prompt index 9edb6d1ce..45715d8fe 100644 --- a/core/prompts/troubleshooter/get_route_files.prompt +++ b/core/prompts/troubleshooter/get_route_files.prompt @@ -7,4 +7,7 @@ The solution was to add the entire content of all the files that have routes def them, and this prompt selects those files. #} +{% include "partials/project_details.prompt" %} +{% include "partials/files_list.prompt" %} + Your task is to identify all the files, from the above list, that have routes defined in them. Return just the file paths as a JSON list named "files", DO NOT return anything else. If there are no files with routes, return an empty list. diff --git a/tests/agents/test_tech_lead.py b/tests/agents/test_tech_lead.py index 30a3cc1a3..eed00df11 100644 --- a/tests/agents/test_tech_lead.py +++ b/tests/agents/test_tech_lead.py @@ -1,7 +1,7 @@ import pytest from core.agents.response import ResponseType -from core.agents.tech_lead import DevelopmentPlan, Task, TechLead, UpdatedDevelopmentPlan +from core.agents.tech_lead import DevelopmentPlan, Epic, TechLead, UpdatedDevelopmentPlan from core.db.models import Complexity from core.db.models.project_state import TaskStatus from core.ui.base import UserInput @@ -87,8 +87,8 @@ async def test_plan_epic(agentcontext): tl.get_llm = mock_get_llm( return_value=DevelopmentPlan( plan=[ - Task(description="Task 1"), - Task(description="Task 2"), + Epic(description="Task 1"), + Epic(description="Task 2"), ] ) ) @@ -122,8 +122,8 @@ async def test_update_epic(agentcontext): tl = TechLead(sm, ui) tl.get_llm = mock_get_llm( return_value=UpdatedDevelopmentPlan( - updated_current_epic=Task(description="Updated Just Finished"), - plan=[Task(description="Alternative Future Task")], + updated_current_epic=Epic(description="Updated Just Finished"), + plan=[Epic(description="Alternative Future Task")], ) )