ComposioHQ / composio

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

Refactor SWE Agent code #219

Closed kaavee315 closed 1 week ago

kaavee315 commented 1 week ago

PR Type

enhancement, other


Description


Changes walkthrough 📝

Relevant files
Enhancement
run_evaluation.py
Replace CoderAgent with CrewaiAgent in run_evaluation       

python/composio_swe/benchmark/run_evaluation.py
  • Replaced CoderAgent and CoderAgentArgs with CrewaiAgent and SWEArgs.
  • Updated method calls to use setup_and_solve instead of run.
  • +6/-4     
    base_swe_agent.py
    Implement BaseSWEAgent with SWEArgs and core methods         

    python/composio_swe/composio_swe/agent/base_swe_agent.py
  • Added SWEArgs class for agent arguments.
  • Implemented BaseSWEAgent with methods for workspace setup, issue
    solving, and logging.
  • +90/-3   
    crewai.py
    Introduce CrewaiAgent with issue solving capabilities       

    python/composio_swe/composio_swe/agent/crewai.py
  • Introduced CrewaiAgent class inheriting from BaseSWEAgent.
  • Implemented solve_issue method using Crewai tools and agents.
  • +92/-0   
    llama.py
    Add LlamaIndexAgent for issue solving                                       

    python/composio_swe/composio_swe/agent/llama.py
  • Added LlamaIndexAgent class inheriting from BaseSWEAgent.
  • Implemented solve_issue method using LlamaIndex tools and agents.
  • +77/-0   
    swe_run.py
    Replace CoderAgent with CrewaiAgent in swe_run                     

    python/composio_swe/composio_swe/agent/swe_run.py
  • Replaced CoderAgent and CoderAgentArgs with CrewaiAgent and SWEArgs.
  • Updated method calls to use setup_and_solve instead of run.
  • +7/-5     
    utils.py
    Update utility functions for LLM retrieval                             

    python/composio_swe/composio_swe/agent/utils.py
  • Renamed get_llm to get_langchain_llm.
  • Added get_llama_llm function for LlamaIndex models.
  • +34/-3   
    cli.py
    Replace CoderAgent with CrewaiAgent in CLI                             

    python/composio_swe/composio_swe/cli/cli.py
  • Replaced CoderAgent and CoderAgentArgs with CrewaiAgent and SWEArgs.
  • Updated method calls to use setup_and_solve instead of run.
  • +4/-4     
    Other
    swe.py
    Remove CoderAgent and related classes                                       

    python/composio_swe/composio_swe/agent/swe.py - Removed `CoderAgent` and `CoderAgentArgs` classes.
    +0/-227 

    💡 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 week ago

    PR Reviewer Guide 🔍

    (Review updated until commit https://github.com/ComposioHQ/composio/commit/b046975170c58fa6aea63a7e7dfd08fbf8024857)

    ⏱️ Estimated effort to review [1-5] 4
    🧪 Relevant tests No
    🔒 Security concerns No
    ⚡ Key issues to review Possible Bug:
    The BaseSWEAgent class and its subclasses (CrewaiAgent, LlamaIndexAgent) have methods that could potentially raise exceptions (e.g., ValueError if certain conditions are not met). It's important to ensure that these exceptions are handled appropriately where these methods are called to avoid runtime errors.
    Code Duplication:
    There is noticeable duplication in logging and error handling logic across different agent classes. Consider refactoring these into shared methods within the BaseSWEAgent class to improve maintainability.
    Dependency Management:
    The PR introduces new dependencies (e.g., pydantic, composio, llama_index). Ensure that these are properly added to the project's dependency management files (like requirements.txt or Pipfile).
    codiumai-pr-agent-pro[bot] commented 1 week ago

    Failed to generate code suggestions for PR

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

    Persistent review updated to latest commit https://github.com/ComposioHQ/composio/commit/b046975170c58fa6aea63a7e7dfd08fbf8024857

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

    Failed to generate code suggestions for PR