🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
feature: 主流程支持配置agentops
voidking8f7453352a2d
diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yamlindex dc5ae605b..f51d80a14 100644--- a/.github/workflows/unittest.yaml+++ b/.github/workflows/unittest.yaml@@ -39,7 +39,7 @@ jobs:- name: Show failed tests and overall summaryrun: |grep -E "FAILED tests|ERROR tests|[0-9]+ passed," unittest.txt- failed_count=$(grep -E "FAILED|ERROR" unittest.txt | wc -l)+ failed_count=$(grep -E "FAILED tests|ERROR tests|[0-9]+ passed," unittest.txt | wc -l)if [[ "$failed_count" -gt 0 ]]; thenecho "$failed_count failed lines found! Task failed."exit 1diff --git a/config/config2.example.yaml b/config/config2.example.yamlindex 64cce630f..c474ac8ba 100644--- a/config/config2.example.yaml+++ b/config/config2.example.yaml@@ -59,3 +59,5 @@ iflytek_api_key: "YOUR_API_KEY"iflytek_api_secret: "YOUR_API_SECRET"metagpt_tti_url: "YOUR_MODEL_URL"++agentops_api_key: "YOUR_AGENTOPS_API_KEY" # get key from https://app.agentops.ai/settings/projects\ No newline at end of filediff --git a/metagpt/config2.py b/metagpt/config2.pyindex 58a99c920..fff1799a7 100644--- a/metagpt/config2.py+++ b/metagpt/config2.py@@ -69,6 +69,7 @@ class Config(CLIParams, YamlModel):workspace: WorkspaceConfig = WorkspaceConfig()enable_longterm_memory: bool = Falsecode_review_k_times: int = 2+ agentops_api_key: str = ""# Will be removed in the futuremetagpt_tti_url: str = ""diff --git a/metagpt/roles/architect.py b/metagpt/roles/architect.pyindex 166f8cfd0..8c9d9835b 100644--- a/metagpt/roles/architect.py+++ b/metagpt/roles/architect.py@@ -6,11 +6,14 @@@File : architect.py"""+import agentops+from metagpt.actions import WritePRDfrom metagpt.actions.design_api import WriteDesignfrom metagpt.roles.role import Role[email protected]_agent(name="Architect")class Architect(Role):"""Represents an Architect role in a software development process.diff --git a/metagpt/roles/engineer.py b/metagpt/roles/engineer.pyindex 5055037f5..b032446c6 100644--- a/metagpt/roles/engineer.py+++ b/metagpt/roles/engineer.py@@ -24,6 +24,8 @@ from collections import defaultdictfrom pathlib import Pathfrom typing import Optional, Set+import agentops+from metagpt.actions import Action, WriteCode, WriteCodeReview, WriteTasksfrom metagpt.actions.fix_bug import FixBugfrom metagpt.actions.project_management_an import REFINED_TASK_LIST, TASK_LIST@@ -58,6 +60,7 @@ otherwise, answer 'YES' in JSON format."""[email protected]_agent(name="Engineer")class Engineer(Role):"""Represents an Engineer role responsible for writing and possibly reviewing code.diff --git a/metagpt/roles/product_manager.py b/metagpt/roles/product_manager.pyindex 9db9f7d9e..a21ebf35b 100644--- a/metagpt/roles/product_manager.py+++ b/metagpt/roles/product_manager.py@@ -7,12 +7,15 @@@Modified By: mashenquan, 2023/11/27. Add `PrepareDocuments` action according to Section 2.2.3.5.1 of RFC 135."""+import agentops+from metagpt.actions import UserRequirement, WritePRDfrom metagpt.actions.prepare_documents import PrepareDocumentsfrom metagpt.roles.role import Role, RoleReactModefrom metagpt.utils.common import any_to_name[email protected]_agent(name="ProductManager")class ProductManager(Role):"""Represents a Product Manager role responsible for product development and management.diff --git a/metagpt/roles/project_manager.py b/metagpt/roles/project_manager.pyindex 422d2889b..7fba8b28a 100644--- a/metagpt/roles/project_manager.py+++ b/metagpt/roles/project_manager.py@@ -6,11 +6,14 @@@File : project_manager.py"""+import agentops+from metagpt.actions import WriteTasksfrom metagpt.actions.design_api import WriteDesignfrom metagpt.roles.role import Role[email protected]_agent(name="ProjectManager")class ProjectManager(Role):"""Represents a Project Manager role responsible for overseeing project execution and team efficiency.diff --git a/metagpt/roles/qa_engineer.py b/metagpt/roles/qa_engineer.pyindex c73c10ef3..91122877d 100644--- a/metagpt/roles/qa_engineer.py+++ b/metagpt/roles/qa_engineer.py@@ -15,6 +15,8 @@of SummarizeCode."""+import agentops+from metagpt.actions import DebugError, RunCode, WriteTestfrom metagpt.actions.summarize_code import SummarizeCodefrom metagpt.const import MESSAGE_ROUTE_TO_NONE@@ -24,6 +26,7 @@ from metagpt.schema import Document, Message, RunCodeContext, TestingContextfrom metagpt.utils.common import any_to_str_set, parse_recipient[email protected]_agent(name="QaEngineer")class QaEngineer(Role):name: str = "Edward"profile: str = "QaEngineer"diff --git a/metagpt/software_company.py b/metagpt/software_company.pyindex 103ac0551..bb35aa016 100644--- a/metagpt/software_company.py+++ b/metagpt/software_company.py@@ -4,6 +4,7 @@import asynciofrom pathlib import Path+import agentopsimport typerfrom metagpt.const import CONFIG_ROOT@@ -38,6 +39,9 @@ def generate_repo()from metagpt.team import Team+ if config.agentops_api_key != "":+ agentops.init(config.agentops_api_key, tags=["software_company"])+config.update_via_cli(project_path, project_name, inc, reqa_file, max_auto_summarize_code)ctx = Context(config=config)@@ -68,6 +72,9 @@ def generate_repo(company.run_project(idea)asyncio.run(company.run(n_round=n_round))+ if config.agentops_api_key != "":+ agentops.end_session("Success")+return ctx.repodiff --git a/requirements.txt b/requirements.txtindex dc8a86ae2..b7a13583c 100644--- a/requirements.txt+++ b/requirements.txt@@ -72,3 +72,4 @@ rank-bm25==0.2.2 # for tool recommendationgymnasium==0.29.1boto3~=1.34.69spark_ai_python~=0.3.30+agentops