ComposioHQ / composio

Composio equips agents with well-crafted tools empowering them to tackle complex tasks
https://docs.composio.dev
Other
3.83k stars 1.02k forks source link

Make swe simple to edit #198

Closed kaavee315 closed 1 month ago

kaavee315 commented 1 month ago

PR Type

Enhancement, Documentation


Description


Changes walkthrough ๐Ÿ“

Relevant files
Enhancement
submit_patch.py
Fix typo and update docstring in submit_patch.py                 

python/composio/local_tools/local_workspace/submit_patch/actions/submit_patch.py
  • Corrected a typo in the SubmitPatchRequest class.
  • Updated the docstring in the SubmitPatch class.
  • +2/-2     
    prompts.py
    Add agent backstory and issue description templates           

    python/composio_swe/composio_swe/agent/prompts.py - Added new templates for agent backstory and issue description.
    +46/-0   
    swe.py
    Refactor to import templates and remove main block in swe.py

    python/composio_swe/composio_swe/agent/swe.py
  • Removed inline definitions of AGENT_BACKSTORY_TMPL and
    ISSUE_DESC_TMPL.
  • Imported templates from prompts.py.
  • Removed main execution block.
  • +1/-67   
    swe_run.py
    Add script to run CoderAgent with issue configuration       

    python/composio_swe/composio_swe/agent/swe_run.py
  • Added a new script to run the CoderAgent with a predefined issue
    configuration.
  • +20/-0   
    Documentation
    README.md
    Add README for swe.py with usage instructions                       

    python/composio_swe/composio_swe/agent/README.md
  • Added a README file for swe.py with an overview, dependencies, and
    usage instructions.
  • +19/-0   

    ๐Ÿ’ก PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    codiumai-pr-agent-pro[bot] commented 1 month ago

    PR Reviewer Guide ๐Ÿ”

    โฑ๏ธ Estimated effort to review [1-5] 3
    ๐Ÿงช Relevant tests No
    ๐Ÿ”’ Security concerns No
    โšก Key issues to review Refactoring:
    The refactoring in swe.py to import templates from prompts.py is a good practice for code modularity. However, ensure that the removal of the main execution block and its transfer to swe_run.py does not affect the existing functionality. It's crucial to verify that all dependencies and context setups are correctly handled in the new script.
    Documentation:
    The addition of a README for swe.py is beneficial for new developers or maintainers. Ensure that the documentation accurately reflects the current state and usage of the script.
    codiumai-pr-agent-pro[bot] commented 1 month ago

    PR Code Suggestions โœจ

    CategorySuggestion                                                                                                                                    Score
    Best practice
    Validate the issue_config dictionary using the IssueConfig model before assignment ___ **The issue_config dictionary should be validated using the IssueConfig model to ensure that
    it conforms to the expected schema before being assigned to ctx.issue_config.** [python/composio_swe/composio_swe/agent/swe_run.py [5-12]](https://github.com/ComposioHQ/composio/pull/198/files#diff-784e85fde02b297e5d9c252831add5cfe880f537076facd0cd3f90ac62121e86R5-R12) ```diff issue_config = { "repo_name": "ComposioHQ/composio", "issue_id": "123", "base_commit_id": "abc", "issue_desc": "Fix all the mypy issues in the codebase.", } ctx = Context() -ctx.issue_config = issue_config +ctx.issue_config = IssueConfig.model_validate(issue_config) ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 10 Why: This is a crucial suggestion for ensuring data integrity and preventing runtime errors due to incorrect configurations. It directly addresses a change made in the PR where `issue_config` is used.
    10
    Possible issue
    Add error handling to the run method to manage potential exceptions during execution ___ **The run method should include error handling to manage potential exceptions that might
    occur during the execution of crew.kickoff() and self.save_history(), ensuring the program
    can handle failures gracefully.** [python/composio_swe/composio_swe/agent/swe.py [226-227]](https://github.com/ComposioHQ/composio/pull/198/files#diff-bbb8fcd0bfdb219cf4e20ffd41e3695abb277d9a5efc2c5a315e478976655540R226-R227) ```diff -crew.kickoff() -self.save_history(self.issue_config.issue_id) +try: + crew.kickoff() + self.save_history(self.issue_config.issue_id) +except Exception as e: + logger.error(f"An error occurred: {e}") + raise ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 8 Why: Adding error handling is crucial for robustness and stability of the application, especially in production environments. This suggestion directly improves the new code added in the PR, enhancing its reliability.
    8
    Enhancement
    Add instructions for installing Docker and obtaining a GitHub Access Token in the README ___ **The README should include a section on how to install the required dependencies, such as
    Docker and obtaining a GitHub Access Token, to help users set up their environment
    correctly.** [python/composio_swe/composio_swe/agent/README.md [7-9]](https://github.com/ComposioHQ/composio/pull/198/files#diff-3ee62cdba3c5db57de103a824f94d873c44d8a03368853305b126b5d5e665ec0R7-R9) ```diff ## Dependencies -1. Docker should be installed -2. Get the Github Access Token. +1. Docker should be installed. You can download it from [Docker's official site](https://www.docker.com/get-started). +2. Get the Github Access Token. Follow the instructions on [GitHub's documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) to create a personal access token. ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 7 Why: This suggestion enhances the documentation by providing detailed steps for setting up required dependencies, which is beneficial for users setting up their environment. It directly relates to the new content added in the README file.
    7