Agent SOPs
repository·main·Indexed 22 days ago
https://github.com/strands-agents/agent-sopA standardized, markdown-based framework for defining complex, multi-step workflows for AI agents. It provides built-in SOPs for codebase analysis, prompt-driven development (PDD), and TDD-based coding. The library includes a Model Context Protocol (MCP) server, a Python SDK for integration with Strands Agents, and tools to convert SOPs into Cursor Commands and Agent Skills for Claude.
What's inside strands-agents-sops
- EvalKit is a conversational evaluation framework designed for AI agents. It uses the Strands Evals SDK to guide users through a structured lifecycle of creating robust evaluations. The framework allows you to plan evaluations, generate test data, execute evaluations, and analyze results through natural language conversation.
What is an Agent SOP?
mainAn Agent SOP (Standard Operating Procedure) is a standardized markdown file with the
.sop.mdextension. It is designed to guide AI agents through complex, multi-step workflows using natural language, parameterized inputs, and RFC 2119 constraints.Key components include:
- Clear objectives: Detailed overviews of the workflow.
- Parameterized inputs: Flexible inputs for customization.
- Step-by-step instructions: Sequential tasks using RFC 2119 keywords (MUST, SHOULD, MAY) for precise control.
- Resumability: Documentation of progress to allow agents to resume interrupted tasks.
- Multi-modal distribution: Can be used via MCP tools, Agent Skills, or Python modules.
What are Agent SOPs?
mainAgent SOPs are standardized markdown workflows designed for AI agents. They feature:
- Structured steps with RFC 2119 constraints: Uses keywords like
MUST,SHOULD, andMAYfor precise behavior control. - Parameterized inputs: Uses parameters instead of hardcoded values to allow flexible application across different projects.
- AI-assisted authoring: Designed to be easily read and generated by coding agents.
- Progress tracking: Includes instructions for agents to document progress, enabling resumability and debugging.
- Structured steps with RFC 2119 constraints: Uses keywords like
Use the Code Assist SOP for TDD-based implementation
mainThe Code Assist SOP is a workflow designed for implementing code tasks using Test-Driven Development (TDD) principles. It follows a structured four-phase lifecycle: Explore, Plan, Code, and Commit.
In this workflow, the agent acts as a 'Technical Implementation Partner' and 'TDD Coach', providing guidance, generating test cases, and producing idiomatic code that adheres to existing repository patterns.
Workflow Phases
- Explore Phase: Understanding requirements and context.
- Plan Phase: Creating documentation and architectural decisions.
- Code Phase: Writing tests and implementation code.
- Commit Phase: Finalizing the task.
Understand the .agents directory structure
mainThe Prompt-Driven Development (PDD) family of SOPs (
codebase-summary,pdd,code-task-generator,code-assist) organizes artifacts in a.agents/directory. This structure helps distinguish between permanent documentation and transient working files..agents/summary/: Output fromcodebase-summary. Always commit..agents/planning/: Design docs frompdd. Often worth committing..agents/tasks/: Task breakdowns fromcode-task-generator. Optionally commit..agents/scratchpad/: Working files fromcode-assist. Add to.gitignore.
Generate tasks in PDD mode
mainWhen processing a PDD plan, the generator follows a specific organizational pattern:
- Folder Structure: It creates a folder named
step{NN}whereNNis zero-padded (e.g.,step01,step02). - File Naming: Inside the step folder, it creates sequential files named
task-01-{title}.code-task.md,task-02-{title}.code-task.md, etc. - Content Logic:
- It breaks steps into functional implementation phases (not separate testing tasks).
- It includes a
Reference Documentationsection pointing todesign/detailed-design.md. - It includes unit test requirements directly within the
Acceptance Criteriaof the implementation tasks rather than creating separate test tasks.
- Workflow: After generation, the user is advised to run
code-assiston each generated task in the specified sequence.
- Folder Structure: It creates a folder named
Understand the EvalKit workflow and phases
mainEvalKit follows a structured, four-phase lifecycle to evaluate an agent. Each phase depends on the successful completion of the previous one. The workflow is designed to keep evaluation artifacts separate from your agent's core code by placing them in an
eval/directory sibling to your agent folder.Phase Dependencies:
- Planning Phase: Defines metrics and scenarios. No prerequisites.
- Data Generation Phase: Creates test cases. Requires an evaluation plan (
eval/eval-plan.md). - Evaluation Execution Phase: Runs the actual tests. Requires test cases (
eval/test-cases.jsonl). - Reporting Phase: Analyzes results. Requires evaluation outputs (
eval/results/).
Phase 1: Planning (eval-plan.md) Phase 2: Data Generation (test-cases.jsonl) Phase 3: Evaluation Execution (run_evaluation.py) Phase 4: Analysis (eval-report.md)Understand the Codebase Summary Output Structure
mainWhen running the Codebase Summary SOP, the output is organized into a root consolidated file and a detailed directory of documentation artifacts.
Consolidated File:
AGENTS.md(or the file specified inconsolidate_targets) located in the root directory.
Artifact Directory (
.agents/summary/):index.md: Knowledge base index.codebase_info.md: High-level codebase information.architecture.md: Architectural overview (often includes Mermaid diagrams).components.md: Component details.interfaces.md: Key interfaces.data_models.md: Data structures and models.workflows.md: System workflows.dependencies.md: Project dependencies.review_notes.md: Notes on consistency and completeness checks.
AGENTS.md (consolidated file in root directory) .agents/summary/ ├── index.md (knowledge base index) ├── codebase_info.md ├── architecture.md ├── components.md ├── interfaces.md ├── data_models.md ├── workflows.md ├── dependencies.md └── review_notes.mdUnderstand the Codebase Summary workflow
mainThe Codebase Summary SOP follows a structured multi-step process to transform raw code into a documentation ecosystem:
- Setup: Validates the
codebase_pathand initializes theoutput_dirwith necessary subdirectories. - Analyze: Identifies packages, modules, architectural patterns, technology stacks, and dependencies. It creates a hierarchical map using Mermaid diagrams and documents basic info in
{output_dir}/codebase_info.md. - Generate: Creates a detailed knowledge base in the
output_dir, including:index.md: The primary entry point for AI assistants, containing instructions, metadata, and a table of contents.architecture.md: System design and patterns.components.md: Major components and responsibilities.interfaces.md: APIs and integration points.data_models.md: Data structures.workflows.md: Key processes.dependencies.md: External dependencies.
- Review: Checks for inconsistencies and completeness, documenting gaps in
{output_dir}/review_notes.md. - Consolidate: If enabled, merges documentation into root-level files like
AGENTS.md,README.md, orCONTRIBUTING.md. - Summary: Provides a report of accomplishments and instructions for using the documentation with AI assistants.
- Setup: Validates the
Configure and load external SOPs
mainYou can extend the library with your own Standard Operating Procedures.
Requirements
- File Extension: Files must have the
.sop.mdpostfix to be recognized. - Format: Standard Markdown structure (e.g., using
# Overviewand## Stepsheaders).
Path Configuration
When using
--sop-pathsin MCP or Skills commands, you can provide multiple paths using colon-separated values. The system supports~for home directory expansion and relative paths.Precedence
External SOPs follow a first-wins rule: if an external SOP has the same name as a built-in SOP, the external one is used.
# Example: Creating a custom SOP file mkdir ~/my-sops cat > ~/my-sops/custom-workflow.sop.md << 'EOF' # Custom Workflow ## Overview My custom workflow for specific tasks. ## Steps ### 1. Custom Step Do something custom. EOF- File Extension: Files must have the
Choose between Interactive and Auto modes
mainThe
modeparameter determines how the agent interacts with you during the implementation process.Interactive Mode (
mode: "interactive")Best for collaborative tasks where you want control over the implementation details. The agent will:
- Present proposed actions and ask for confirmation.
- Explain pros/cons when multiple approaches exist.
- Review artifacts and solicit feedback before moving forward.
- Pause at key decision points to explain reasoning.
- Provide educational context for new patterns.
Auto Mode (
mode: "auto")Best for autonomous execution of well-defined tasks. The agent will:
- Execute all actions without user confirmation.
- Document all decisions, assumptions, and reasoning in
progress.md. - Select the most appropriate approach when multiple exist and document the rationale.
- Provide a comprehensive summary upon completion.
Warning: If you select
automode, the agent will warn you that no further interaction will be required after the initial setup.Refine requirements using the Idea Honing process
mainThe Requirements Clarification phase uses an interactive process to build a specification in
{project_dir}/idea-honing.md.How it works:
- The agent asks exactly one question at a time.
- It waits for your response before proceeding.
- It records both the question and your final answer in
idea-honing.md. - It may suggest possible answers or options if you are unsure.
- The process continues until you explicitly confirm that the requirements are complete.
Tip: You can request to pause requirements clarification to conduct research if a question arises that requires more technical information.