### Set Up Development Environment with uv Source: https://github.com/langtalks/swe-agent/blob/main/CONTRIBUTING.md Steps to install project dependencies using `uv sync --dev`, copy the example environment file, and activate the Python virtual environment for development. ```bash # Install dependencies uv sync --dev # Set up environment variables cp .env.example .env # Add your API keys to .env # Activate the virtual environment source .venv/bin/activate ``` -------------------------------- ### Setting Up SWE-Agent Development Environment Source: https://github.com/langtalks/swe-agent/blob/main/README.md Details the steps required to set up a local development environment for the SWE-Agent project. This includes cloning the repository, synchronizing dependencies with 'uv sync', installing pre-commit hooks, and verifying the setup by running tests. ```bash # Clone your fork git clone https://github.com/langtalks/swe-agent-langgraph.git cd swe-agent-langgraph # Set up development environment uv sync --dev # Install pre-commit hooks (optional but recommended) pre-commit install # Run tests to ensure everything works uv run pytest ``` -------------------------------- ### Bash: Set up SWE-Agent Environment Source: https://github.com/langtalks/swe-agent/blob/main/README.md Commands to install project dependencies using `uv sync` and configure the environment by copying the example `.env` file and adding the Anthropic API key. This prepares the project for execution. ```Bash uv sync cp .env.example .env # Add your Anthropic API key to .env ``` -------------------------------- ### Example Python Unit Test for State Initialization Source: https://github.com/langtalks/swe-agent/blob/main/CONTRIBUTING.md A Python example demonstrating how to write a unit test using `pytest` to verify the initialization of a `SoftwareArchitectState` object and its attributes. ```python import pytest from agent.architect.state import SoftwareArchitectState def test_architect_state_initialization(): state = SoftwareArchitectState() assert state.research_next_step is None assert state.implementation_plan is None ``` -------------------------------- ### Verify Development Setup Source: https://github.com/langtalks/swe-agent/blob/main/CONTRIBUTING.md Commands to verify the development environment by running project tests with `uv run pytest` and checking code formatting with `black` and `isort`. ```bash # Run tests to ensure everything works uv run pytest # Check code formatting uv run black --check . uv run isort --check-only . ``` -------------------------------- ### Core Prompt for AI Developer Assistant Source: https://github.com/langtalks/swe-agent/blob/main/agent/developer/prompts/get_clear_implementation_plan.md This prompt guides an AI developer assistant to analyze a given development task, review file content, determine research needs, and formulate a clear implementation plan. It emphasizes focusing on a single target file and using provided context from various placeholders. ```Prompt Template # System\n You are a skilled developer assistant focused on analyzing and planning code implementations.\n\n# Human\n\n Your primary responsibilities are:\n\n 1. Analyze the given development task for the specific target file\n 2. Determine if you have all necessary information to implement the task by:\n - Reviewing the current file content\n - Checking if codebase research is needed to understand dependencies or related components\n 3. If research is needed, identify specific areas that require investigation\n 4. Confirm whether you have sufficient context to proceed with implementation\n\n You should explore the codebase using your tool till you have a clear implementation plan for the task.\n\nAt the point in time that you have all the information that is required to implement the task, you should output a clear implementation plan for the task.\n\n## Codebase structure\n{codebase_structure}\n\n## Current file content (if not a new file)\n{file_content}\n\n## Target file path\n{target_file}\n\n## Additional context for the task\n{additional_context}\n\n## Development task\n{development_task}\n\n## Important\nyou have to edit only {target_file} and your diff must touch only this file and no other!!!\n\n# Placeholder\n{atomic_implementation_research} ``` -------------------------------- ### Example `code_change_request` Output Format Source: https://github.com/langtalks/swe-agent/blob/main/agent/developer/prompts/create_diff_prompt.md Illustrates the required XML-like format for the `code_change_request` blocks that the AI must generate. It demonstrates how original code snippets should include line numbers, while the corresponding edited code snippets should be clean and without line numbers, facilitating automated patching. ```XML-like original_code_snippet: 127| For more examples see the [examples](examples) folder or join the [Discord](https://link.browser-use.com/discord) and show off your project. 128| 129| Vision edit_code_snippet: For more examples see the [examples](examples) folder or join the [Discord](https://link.browser-use.com/discord) and show off your project. Project Structure - Main Folder Files The main directory contains several important files that configure and document the browser-use project: ``` -------------------------------- ### Bash: Run SWE-Agent LangGraph Server Source: https://github.com/langtalks/swe-agent/blob/main/README.md Commands to activate the Python virtual environment and start the LangGraph server for the SWE-Agent. This initiates the agent's operational mode. ```Bash source .venv/bin/activate langgraph dev ``` -------------------------------- ### APIDOC: Software Agent State Flow Example Source: https://github.com/langtalks/swe-agent/blob/main/README.md Illustrates the conceptual flow of state transitions between the User Request, SoftwareArchitectState, and SoftwareDeveloperState, showing how an initial request evolves into a detailed implementation plan and ultimately a modified codebase. It highlights key state attributes at different stages. ```APIDOC User Request ↓ AgentState {research_scratchpad: [HumanMessage("Add auth")]} ↓ SoftwareArchitectState { research_next_step: "Find existing auth patterns", implementation_research_scratchpad: [research_messages...] } ↓ (after research) SoftwareArchitectState { implementation_plan: ImplementationPlan([ ImplementationTask( file_path: "auth.py", atomic_tasks: [AtomicTask("Add User model")] ) ]) } ↓ SoftwareDeveloperState { implementation_plan: , current_task_idx: 0, current_atomic_task_idx: 0, current_file_content: "# auth.py content" } ↓ (after implementation) Final Result: Modified codebase ``` -------------------------------- ### SWE-Agent Prompt Template Structure Definition Source: https://github.com/langtalks/swe-agent/blob/main/agent/developer/prompts/create_diff_prompt.md Defines the complete structure of the prompt provided to the SWE-Agent developer assistant. It includes input variables, system and human instructions, rules for code analysis, and placeholders for dynamic content like file paths, content, and research, guiding the AI's workflow. ```Prompt Template _type: "chat" - input_variables: - task - research - additional_context - file_content - file_path # System You are a senior skilled developer assistant implement a code change according to concrete task Your job is # Human ## Rules 1. Analyze the file content and identify the sections that need to be modified based on the task 2. take into account the research that you already did inorder to implement the task 3. take into account the additional context if exists 4. extract list of diff where each task has a original_code_snippet and edit_code_snippet ## File Path {file_path} ## File content {file_content} ## Additional Context {additional_context} ## Task {task} # Human First conduct the research # Placeholder {research} # Human Your job now is to copy snippets of codes that are involved in the implementation plan and put it in the original_code_snippet and understand how to edit it based on the research and then output the edited code in the edit_code_snippet you need to extract code_change_request block for each change you think to do in the code. In the original code snippet you must also output the line number as it is in lines you copy from the file content. However in the edited code you can drop the line numbers as it is not needed. you should output block per each code change output only the needed blocks of code_change_request without further explanation. Important when copy the original code you must output the line number as it is in the original file original_code_snippet: put here the original code snippet, The exact code snippet that is being replaced copy to here only the code snippet that going to be change from the file content. MUST include the original line numbers as they are in the file content. edit_code_snippet: put here the edited **original_code_snippet**, This should include ONLY the edited code snippet without line numbers and without any additional explanation. IMPORTANT this include the edited code snippet which then will be used to replace the original code snippet. for example: original_code_snippet: 127| For more examples see the [examples](examples) folder or join the [Discord](https://link.browser-use.com/discord) and show off your project. 128| 129| Vision edit_code_snippet: For more examples see the [examples](examples) folder or join the [Discord](https://link.browser-use.com/discord) and show off your project. Project Structure - Main Folder Files The main directory contains several important files that configure and document the browser-use project: ``` -------------------------------- ### Conventional Commit Examples Source: https://github.com/langtalks/swe-agent/blob/main/CONTRIBUTING.md Examples of conventional commit messages for different types of changes: features, bug fixes, documentation updates, and test additions. ```bash # Feature git commit -m "feat: add multi-step research loop to architect agent" ``` ```bash # Bug fix git commit -m "fix: resolve state persistence issue in developer agent" ``` ```bash # Documentation git commit -m "docs: update API documentation for new tools" ``` ```bash # Tests git commit -m "test: add integration tests for GitHub MCP" ``` -------------------------------- ### AI Agent Code Editing Prompt Template Definition Source: https://github.com/langtalks/swe-agent/blob/main/agent/developer/prompts/implement_diff.md This entry describes the structure and behavior of the chat prompt template used to guide an AI agent in performing code edits. It outlines the system's role, the required input variables from the human, and the expected output format for the edited code. ```APIDOC PromptTemplate: type: "chat" input_variables: - name: "file_content" type: "string" description: "The full content of the file where the snippet resides." - name: "snippet" type: "string" description: "The specific code snippet that needs to be edited." - name: "task" type: "string" description: "The specific task or instruction for editing the code snippet." system_message: "You are a senior skilled i will give you context of file a snippet of code that need to be edit and a task to do the edit." human_message_template: "## File content\n{file_content}\n\n## Code snippet to edit\n{snippet}\n\n## Task\n{task}" output_instructions: "Your job is to edit the snippet of code based on the task provided. output only the new code take into account the original code usage of spaces and indentation and stay consistent with that. put the new code in the code block like the following example:\n```python \nput the new code here\n```" expected_output_format: "A Python code block containing only the new, edited code, preserving original indentation and spacing." ``` -------------------------------- ### SWE-Agent AI Software Architecture Assistant System Prompt Source: https://github.com/langtalks/swe-agent/blob/main/agent/prompts/think_step_prompt.md This prompt template instructs an AI assistant on its role as a software architecture advisor. It defines input variables like 'tool_descriptions' and 'scratchpad', specifies that the AI should advise rather than directly invoke tools, and mandates a structured output format including reasoning and instructions for the engineer. ```YAML _type: "chat" - input_variables: - tool_descriptions - scratchpad # System You are an **AI Software Architecture** assisting a **Human Software Engineer**. You have a set of tools at your disposal but **cannot invoke them directly**, instead, you **advise** the engineer on what steps to take and why. you need to reason about the next task you need to perform and then output your guidance to the engineer. you output should be in the following structure: ## Your reasoning put here you reasoning about the next task you need to perform focus on next atomic step one a time ## Instructions to the engineer Tool to use: What tool the engineer need to use What is the full path ( from the root folder) to the file he need to work on **Available tools:** {tool_descriptions} If you think the task is done at this point you should say it explicitly without suggesting a tool. # Placeholder {scratchpad} ``` -------------------------------- ### AI Developer Agent Input Prompt Specification Source: https://github.com/langtalks/swe-agent/blob/main/agent/developer/prompts/implement_new_file.md This specification details the complete prompt structure used to interact with an AI developer assistant. It defines the input variables, system instructions, human rules for task execution, and the sequence of interactions, including placeholders for dynamic content like the task, research, and additional context. This serves as the 'API' for providing instructions to the AI. ```APIDOC _type: "chat"\n- input_variables:\n - task\n - research\n - additional_context\n - file_path\n\n# System\nYou are a senior skilled developer assistant implement a code change according to concrete task.\n\n# Human\n\n## Rules\n1. take into account the research that you already did inorder to implement the task\n2. take into account the additional context if exists\n\n## Additional Context\n{additional_context}\n\n## Task\n{task}\n\n# Human\nFirst conduct the research\n\n# Placeholder\n{research}\n\n# Human\nYour job is to create a new file {file_path} to implement the task {task} based on the research you conducted.\nWrite the code now\n ``` -------------------------------- ### Bash: Clone SWE-Agent Repository Source: https://github.com/langtalks/swe-agent/blob/main/README.md Instructions to clone the `swe-agent-langgraph` repository from GitHub and navigate into its directory. This is the first step to set up the project locally. ```Bash git clone https://github.com/langtalks/swe-agent-langgraph.git cd swe-agent-langgraph ``` -------------------------------- ### Rules for Breaking Down Research Findings into Atomic Steps Source: https://github.com/langtalks/swe-agent/blob/main/agent/architect/prompts/extract_implementation_plan.md Outlines the specific rules for the AI to follow when breaking down research findings into tasks, atomic steps, and providing verbose guidance to the engineer, including file path formatting and constraints. ```Prompt Engineering # Human Your job now is to break the research finding to atomic step following this rules: ## Rules: 1. You need to break the finding to tasks. 2. Each logical task will guide the engineer what we want to achieve by editing the file 3. Each logical task then will be split to atomic task which will be a concrete task of editing or creating the file in file_path 4. You must add any additional information from the research that can help the developer complete the task. 5. Assume that after you hand to the developer the plan he cannot communicate back to you so be verbose as you can 6. Try to minimize the number of file changes and the complexity of the changes but make sure you have a plan that finishes the task for any file path you MUST output the full path starting from the root of the project for example if the file path is `src/main.py` you should output `./workspace_repo/src/main.py` don't add to the implementation anything related to update readme follow the rules in the rules section to create the plan now. ``` -------------------------------- ### SWE Agent Workflow Overview Source: https://github.com/langtalks/swe-agent/blob/main/README.md High-level overview of the SWE Agent's operational flow, illustrating the progression from user request through the Architect and Developer agents to the final results. ```text User Request → Architect (Research & Plan) → Developer (Implement) → Results ``` -------------------------------- ### Expected JSON Output Format for Implementation Plan Source: https://github.com/langtalks/swe-agent/blob/main/agent/architect/prompts/extract_implementation_plan.md Specifies that the output of the system must be valid JSON conforming to a predefined `{output_format}` schema, acting as an API contract for the generated implementation plan. ```APIDOC You must output valid json with the following format: {output_format} ``` -------------------------------- ### Clone SWE Agent LangGraph Repository Source: https://github.com/langtalks/swe-agent/blob/main/CONTRIBUTING.md Instructions to fork the repository on GitHub and then clone it locally using Git, followed by navigating into the project directory. ```bash # Fork the repository on GitHub first, then: git clone https://github.com/langtalks/swe-agent-langgraph.git cd swe-agent-langgraph ``` -------------------------------- ### Running Pytest Tests for SWE-Agent Source: https://github.com/langtalks/swe-agent/blob/main/README.md Provides commands to execute tests for the SWE-Agent project. It covers running all tests, running with code coverage, and executing specific test modules. These commands utilize the 'uv run pytest' utility for test execution. ```bash # Run all tests uv run pytest # Run with coverage uv run pytest --cov=agent # Run specific test modules uv run pytest tests/test_architect.py ``` -------------------------------- ### AI Software Architecture Consultant System Prompt Definition Source: https://github.com/langtalks/swe-agent/blob/main/agent/architect/prompts/plan_next_step_prompt.md This snippet outlines the detailed system prompt for the AI agent, defining its role as a Senior AI Software Architecture Consultant, its strategic thinking process (analyze, strategize, decide), and the required output format for its responses, including sections for analysis, reasoning, and verdict. ```Markdown You are a Senior AI Software Architecture Consultant responsible for analyzing and planning software implementation. Your role is to think strategically about the next steps needed in the project. Your process follows these key steps: 1. **Analyze the Current State**: - Review the historical actions to understand what has been done - Assess the current state of the project - Identify any patterns or potential issues 2. **Strategic Thinking**: - Consider the broader project goals - Evaluate different possible next steps - Think about dependencies and potential impacts 3. **Decision Making**: - Determine the most logical next step - Explain your reasoning clearly - Present your conclusion in the format below Your output should follow this structure: ## Analysis [Provide your thought process about the current state and what needs to be done next] ## Reasoning [Explain why this is the best next step, considering alternatives you've considered] ## Verdict Hypothesis: [Specific research/investigation needed for the next step] Remember: - Maintain focus on the immediate task while considering its place in the broader project - Consider the historical context provided to avoid repeating completed work - All file paths in your reasoning should start with: ./workspace_repo/ ``` -------------------------------- ### SWE-Agent System Prompt Input Variables Source: https://github.com/langtalks/swe-agent/blob/main/agent/developer/prompts/developing_prompt.md This snippet defines the type of interaction ('chat') and the input variables required for the Senior Software Developer agent's system prompt. These variables, 'scratchpad' and 'codebase_structure', are used to provide contextual information to the agent during its operation. ```YAML _type: "chat" - input_variables: - scratchpad - codebase_structure ``` -------------------------------- ### Human Input Template for AI Software Architecture Consultant Source: https://github.com/langtalks/swe-agent/blob/main/agent/architect/prompts/plan_next_step_prompt.md This snippet defines the structure for human input provided to the AI agent, including placeholders for the codebase structure and previously conducted implementation research, facilitating context-rich interactions. ```Markdown ## Codebase structure: {codebase_structure} # Human here is the research you did so far: # Placeholder {implementation_research_scratchpad} ``` -------------------------------- ### Software Engineering Agent System Prompt Configuration Source: https://github.com/langtalks/swe-agent/blob/main/agent/prompts/act_step_prompt.md This configuration snippet defines the type of the chat agent, its expected input variables (messages), and the comprehensive system prompt. The system prompt instructs the agent to operate under the guidance of a Senior AI Software Architecture Consultant, strictly follow their thought process, use available tools, and avoid introducing its own reasoning, focusing solely on the last thought and tool execution. ```Prompt Template _type: "chat" - input_variables: - messages # System You are a Software Engineering Agent, operating under the guidance of a Senior AI Software Architecture Consultant. Your role is to strictly follow his thought process and analysis, using available tools to execute tasks accordingly. Do not introduce your own reasoning—adhere entirely to the consultant's approach and reasoning. YOU MUST focus on the last and if there is need of a executing a tool you must adhere do it. # Placeholder {messages} ``` -------------------------------- ### AI Developer Assistant Input Variables Schema Source: https://github.com/langtalks/swe-agent/blob/main/agent/developer/prompts/get_clear_implementation_plan.md Defines the structure and types of input variables expected by the AI developer assistant. These variables provide context such as the development task, target file, file content, codebase structure, and additional context for the AI to process. ```APIDOC _type: "chat"\n- input_variables:\n - development_task\n - target_file\n - file_content\n - codebase_structure\n - additional_context\n - atomic_implementation_research ``` -------------------------------- ### AI Chat Model Configuration for Implementation Plan Generation Source: https://github.com/langtalks/swe-agent/blob/main/agent/architect/prompts/extract_implementation_plan.md Defines the chat model type and its input variables (research_findings, codebase_structure, output_format) used for generating implementation plans. ```YAML _type: "chat" - input_variables: - research_findings - codebase_structure - output_format ``` -------------------------------- ### AI Software Architecture Consultant Agent Configuration Source: https://github.com/langtalks/swe-agent/blob/main/agent/architect/prompts/plan_next_step_prompt.md This snippet defines the core configuration for the AI agent, including its type and the input variables it expects for processing, such as research scratchpad and codebase structure. ```YAML _type: "chat" - input_variables: - implementation_research_scratchpad - codebase_structure ``` -------------------------------- ### Run Project Tests Source: https://github.com/langtalks/swe-agent/blob/main/CONTRIBUTING.md Commands to execute various tests: all tests, specific test files, tests with coverage reports, and integration tests only. ```bash # All tests uv run pytest ``` ```bash # Specific test file uv run pytest tests/test_architect.py ``` ```bash # With coverage uv run pytest --cov=agent --cov-report=html ``` ```bash # Integration tests only uv run pytest tests/integration/ ``` -------------------------------- ### Python: ImplementationPlan Pydantic Model Source: https://github.com/langtalks/swe-agent/blob/main/README.md Defines the top-level plan for software implementation, containing a list of file-level implementation tasks. This model acts as a data contract for the architect's output to the developer. ```Python class ImplementationPlan(BaseModel): tasks: List[ImplementationTask] ``` -------------------------------- ### APIDOC: SWE-Agent Project Structure Source: https://github.com/langtalks/swe-agent/blob/main/README.md Outlines the directory structure of the SWE-Agent project, detailing the organization of agent components (architect, developer), shared entities, tools, and supporting files. This provides an overview of the codebase layout. ```APIDOC agent/ ├── architect/ # Planning and research agent │ ├── graph.py # Main architect workflow │ ├── state.py # State definitions │ └── prompts/ # Prompt templates ├── developer/ # Implementation agent │ ├── graph.py # Main developer workflow │ ├── state.py # State definitions │ └── prompts/ # Prompt templates ├── common/ # Shared entities and state │ └── entities.py # Pydantic models └── tools/ # File operations and search tools ├── search.py # Code search tools ├── codemap.py # Code analysis tools └── write.py # File operations workspace_repo/ # Target codebase for modifications scripts/ # Utility scripts helpers/ # Prompt templates and utilities static/ # Documentation images ``` -------------------------------- ### Senior Architect Role System Prompt Source: https://github.com/langtalks/swe-agent/blob/main/agent/architect/prompts/extract_implementation_plan.md Details the responsibilities of the AI acting as a Senior software architect, focusing on converting research findings into actionable implementation steps and creating structured plans. ```Prompt Engineering # System You are a Senior software architect the mentor and guide a software engineer how to implement code changes your are responsible for converting research findings into actionable implementation steps. Your role is to create a clear, structured implementation plan that outlines the necessary code changes and additions. ``` -------------------------------- ### Python: ImplementationTask Pydantic Model Source: https://github.com/langtalks/swe-agent/blob/main/README.md Represents a single file-level task within an implementation plan, specifying the target file path, a high-level description of changes, and a list of granular atomic tasks. It structures changes needed for a specific file. ```Python class ImplementationTask(BaseModel): file_path: str # Target file for modifications logical_task: str # High-level description of changes atomic_tasks: List[AtomicTask] # Granular modification steps ``` -------------------------------- ### Integration Test: Architect to Developer Workflow Source: https://github.com/langtalks/swe-agent/blob/main/CONTRIBUTING.md This asynchronous Python function tests the complete workflow from an architect's initial state to a developer's implementation, verifying that an implementation plan is generated. It simulates an initial state with a human message and asserts the presence of a result. ```python async def test_architect_to_developer_workflow(): # Test complete workflow from architect to developer initial_state = {"implementation_research_scratchpad": [HumanMessage("Add feature")]} result = await swe_agent.ainvoke(initial_state) assert result["implementation_plan"] is not None ``` -------------------------------- ### Python: AtomicTask Pydantic Model Source: https://github.com/langtalks/swe-agent/blob/main/README.md Defines the smallest unit of implementation, representing a single, specific code modification instruction along with any additional research context. These tasks are granular steps within an ImplementationTask. ```Python class AtomicTask(BaseModel): atomic_task: str # Specific code modification instruction additional_context: str # Research context for this change ``` -------------------------------- ### Python: SoftwareDeveloperState Pydantic Model Source: https://github.com/langtalks/swe-agent/blob/main/README.md Defines the state structure for the Software Developer Agent, including its current implementation plan, task indices, generated diffs, research, and codebase context. This model ensures type safety and traceability for the developer's ongoing work. ```Python class SoftwareDeveloperState(BaseModel): implementation_plan: Optional[ImplementationPlan] = None current_task_idx: Optional[int] = 0 current_atomic_task_idx: Optional[int] = 0 diffs: Optional[Diffs] = None atomic_implementation_research: Annotated[list[AnyMessage], add_messages_with_clear] codebase_structure: Optional[str] = None current_file_content: Optional[str] = None ``` -------------------------------- ### Senior AI Research Engineer System Prompt Template Source: https://github.com/langtalks/swe-agent/blob/main/agent/architect/prompts/conduct_research_plan_prompt.md Detailed system prompt for an AI agent, outlining its role as a Senior AI Research Engineer and defining a structured research process. It covers hypothesis analysis, investigation execution, and synthesis of conclusions, along with guidelines for documentation and focus. ```Prompt Template # System You are a Senior AI Research Engineer responsible for conducting thorough technical investigations and validating implementation approaches. Your role is to systematically research and validate the proposed hypothesis. Your research process follows these key steps: 1. **Hypothesis Analysis**: - Break down the research hypothesis into clear investigation points - Identify key technical aspects that need validation - Define specific questions that need to be answered 2. **Investigation Execution**: - Examine relevant parts of the codebase - Research technical feasibility and best practices - Validate assumptions and dependencies - Document findings and observations 3. **Synthesis & Conclusions**: - Synthesize findings into actionable insights - Identify potential implementation challenges - Provide clear recommendations - Document any remaining uncertainties Remember: - Be thorough in your investigation but stay focused on the hypothesis - Document both successful and unsuccessful validation attempts - Consider implementation implications and potential challenges - All file paths in your findings should start with: ./workspace_repo/ # Human ## Codebase structure: {codebase_structure} # Placeholder {implementation_research_scratchpad} ``` -------------------------------- ### AI Critic Research Evaluator System Prompt Source: https://github.com/langtalks/swe-agent/blob/main/agent/architect/prompts/check_research_already_explored.md Defines the role and evaluation process for an AI agent designed to critically assess proposed research steps. It specifies the agent's responsibilities, analysis procedure, and how it utilizes historical research and new proposals, along with a placeholder for dynamic input. ```Prompt _type: "chat" - input_variables: - implementation_research_scratchpad # System You are a critic research evaluator responsible for analyzing proposed research step and determining if the next step is a good direction. Your evaluation process follows these key steps: 1. **Analysis Procedure**: - Carefully analyze the historical research - Analyze the last ai message that proposed the next research step - Understand if next research step hasn't been explored already - Understand if the next research step is connected to the goal completing the task the human gave at the begining of the interaction # Placeholder {implementation_research_scratchpad} ``` -------------------------------- ### Run Code Quality Checks Source: https://github.com/langtalks/swe-agent/blob/main/CONTRIBUTING.md Commands to ensure code quality by formatting with `black` and `isort`, performing type checking with `mypy`, linting with `flake8`, and running tests with `pytest`. ```bash # Format code uv run black . uv run isort . # Type checking uv run mypy agent/ # Linting uv run flake8 agent/ # Run tests uv run pytest --cov=agent ``` -------------------------------- ### Python: Main Agent State (AgentState) Definition Source: https://github.com/langtalks/swe-agent/blob/main/README.md Pydantic model defining the top-level state for the SWE Agent's overall workflow. It orchestrates the process by managing the implementation research scratchpad and the structured implementation plan. ```python class AgentState(BaseModel): implementation_research_scratchpad: Annotated[list[AnyMessage], add_messages] implementation_plan: Optional[ImplementationPlan] = None ``` -------------------------------- ### Push Git Branch to Origin Source: https://github.com/langtalks/swe-agent/blob/main/CONTRIBUTING.md Command to push the local feature branch to the remote origin repository, making it available for creating a pull request. ```bash git push origin feature/your-feature-name ``` -------------------------------- ### Python: Architect Agent State (SoftwareArchitectState) Definition Source: https://github.com/langtalks/swe-agent/blob/main/README.md Pydantic model for the Architect Agent's state, specifically designed for the research and planning phase. It manages the current research hypothesis, the generated implementation plan, research conversation history, and a validation flag for research quality. ```python class SoftwareArchitectState(BaseModel): research_next_step: Optional[str] = None implementation_plan: Optional[ImplementationPlan] = None implementation_research_scratchpad: Annotated[list[AnyMessage], add_messages] = [] is_valid_research_step: Optional[bool] = None ``` -------------------------------- ### Python: DiffTask Pydantic Model Source: https://github.com/langtalks/swe-agent/blob/main/README.md Specifies precise instructions for code modifications, including the exact original code snippet to be replaced and a detailed description of the change. This model is specific to the Developer Agent's diff generation. ```Python class DiffTask(BaseModel): original_code_snippet: str # Exact code being replaced task_description: str # Detailed change instructions ``` -------------------------------- ### Create a Git Feature or Fix Branch Source: https://github.com/langtalks/swe-agent/blob/main/CONTRIBUTING.md Commands to create a new Git branch for developing a new feature or fixing an issue, following a `feature/` or `fix/` naming convention. ```bash git checkout -b feature/your-feature-name # OR git checkout -b fix/issue-description ``` -------------------------------- ### Agent Prompt Configuration Definition Source: https://github.com/langtalks/swe-agent/blob/main/agent/architect/prompts/conduct_research_plan_prompt.md Defines the type and input variables for an AI agent's chat prompt, specifying the data required for its operation, typically used in agent framework configurations. ```YAML _type: "chat" - input_variables: - implementation_research_scratchpad - codebase_structure ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.