Standard operating procedures have been adopted across various domains as they play a critical role in supporting task decomposition and effective coordination.6 In software development, SOPs promote collaboration among teams by deconstructing project tasks into smaller, actional procedures that are then assigned to specific, specialized roles. MetaGPT encodes SOPs into prompt sequences to organize and promote multiagent workflows. SOP workflows introduce structure and opportunities for refinement.
For example, the project manager agent is prompted to create a product requirement document (PRD). The product manager agent is prompted once and then asked to refine certain elements of the PRD due to the incremental development of the project. For example, the agent is instructed to create a section within the PRD for “product goals.” It is then prompted again to refine those goals by updating the original product goals to ensure that they align with the current project direction.7 This refinement method is employed to ensure that the global task is recognized and cohesive across all agents.
In the example below, the product manager agent is prompted to generate a requirement analysis. After this initial prompt, the agent is prompted to generate a refined analysis that takes any new features and enhancements from ongoing collaboration into consideration.
Requirement analysis prompt instruction: “Provide a detailed analysis of the requirements.”8
Refined analysis prompt instruction: “Review and refine the existing requirement analysis into a string list to align with the evolving needs of the project due to incremental development. Ensure that the analysis comprehensively covers the new features and enhancements required for the refined project scope.”9
This example demonstrates a PRD generated as standardized output that is passed from the product manager agent to the architect agent. The SOP-based prompt for each generated output is listed beside them. Notice that the prompt is similarly based on the SOP workflow, including requirement definitions, methods for task completion and the order to complete them:
User prompt: “Build me a React based app-based web application for wealth managers to use to review their clients’ portfolios and make recommendations of appropriate funds for them to use. This application needs to work in America, the United Kingdom and Spain.”
Original requirements
Prompt instruction: “Place the original user’s requirements here.”10
“Build me a React based app-based web application for wealth managers to use to review their clients’ portfolios and make recommendations of appropriate funds for them to use. This application needs to work in America, the United Kingdom and Spain.”
Product goals
Prompt instruction: “Provide up to three clear, orthogonal product goals.”11
- Develop a secure and reliable web application for wealth managers.
- Ensure multilanguage support for English, Spanish and regional variations.
- Create an intuitive and user-friendly interface for portfolio management and recommendation.
User stories
Prompt instruction: “Provide up to 3 to 5 scenario-based user stories.”12
- As a wealth manager, I want to review my clients’ portfolios and provide personalized advice.
- As a wealth manager, I want to recommend funds to my clients based on their investment goals and risk tolerance.
- As a wealth manager, I want to access the application in English or Spanish depending on my location.
Competitive analysis
Prompt instruction: “Provide 5 to 7 competitive products.”13
- “Wealthfront: Automated investment service with a clean interface, but lacks personalized fund recommendations."
- “Personal Capital: Offers comprehensive wealth management tools, but can be overwhelming for new users."
- “Betterment: Focuses on automated investing with limited customization for wealth managers."
Requirement analysis
Prompt instruction: “Provide a detailed analysis of the requirements.”14
The application must be built using React, ensuring it is scalable and maintainable. It should have a multilanguage interface to cater to users in America, the United Kingdom and Spain. The application must be secure to protect sensitive financial data and comply with regional regulations. It should also integrate with various financial data sources to provide real-time portfolio analysis and fund recommendations.
Requirement pool
Prompt instruction: “List down the top 5 to 7 requirements with their priority (P0, P1, P2).”, “Cover both legacy content and incremental content. Retain content unrelated to incremental development.”15
- (“Secure user authentication and data encryption to protect client information.”, “P0”),
- (“Multilanguage support for English and Spanish, with regional variations.”, “P0”),
- (“Real-time integration with financial data sources for portfolio management.”, “P0”),
- (“User-friendly dashboard for reviewing and managing client portfolios.”, “P1”),
- (“Recommendation engine to suggest appropriate funds based on client profiles.”, “P2”)
UI design draft
Prompt instruction: “Provide a simple description of the UI elements, functions, style and layout.”16
The UI will feature a clean and modern design with a dashboard that provides an overview of the client portfolios. It will include interactive charts for portfolio analysis, a recommendation section for fund selection, and easy toggling between English and Spanish languages.
Anything UNCLEAR
Prompt instruction: “Mention and aspects of the project that are unclear and try to clarify them.”17
There are no unclear points.
The preceding example is a handover to the architect agent for design, here is the SOP-based prompt given along with the PRD:
"Here is the product requirement document (PRD): based on this PRD review whether this API design meets the requirements of the PRD, and whether it complies with good design practices.”18
The architect follows its own SOP workflow to design the system for the application.
An SOP outlines the responsibilities of each agents’ role and establishes standards for intermediate outputs. These SOPs are then encoded to influence the agent’s behavior. This practice allows agents to generate structured outputs, such as high-quality requirements documents, design artifacts, flowcharts and interface specifications. All handovers between agents must comply with certain established standards that reduce the risk of hallucination caused by idle chatter between LLMs. The use of structured outputs greatly enhances the success rate of target code generation.19