ai newsMi., 21. Okt.
EilmeldungExclusive: ServiceNow and Nvidia launch Arc, a new AI agent for enterprise

How to Automate Product Management for AI Agents: A User Story & PRD Engine with MCP in Python

How to Automate Product Management for AI Agents: A User Story & PRD Engine with MCP in Python In 2026, autonomous software development agents (Claude Desktop, Cursor, Devin, Roo-Code) have become integral members of modern engineering teams. Developers routinely task agents with writing full micro

dev.toMittwoch 12:40 路 21.10.6 Min. Lesezeit
Bild: dev.to

In 2026, autonomous software development agents (Claude Desktop, Cursor, Devin, Roo-Code) have become integral members of modern engineering teams. Developers routinely task agents with writing full microservices, refactoring legacy codebases, and implementing distributed algorithms.

However, giving high-level prompts directly to autonomous coding agents quickly triggers three fundamental product engineering failure modes:

To solve this, we engineered PMFlow: an open Model Context Protocol (MCP) server in Python that equips AI agents with the discipline of a Principal Technical Product Manager. It generates structured PRDs, decomposes epics into testable BDD User Stories, executes topological DAG scheduling with Kahn's algorithm, calculates the mathematical Critical Path (CPM), and exports synchronized payloads directly to GitHub Issues, Linear, and Jira.

PMFlow operates as a deterministic Product Management sidecar communicating over stdio via JSON-RPC 2.0:

+-------------------------------------------------------------------------+ | AI Agent / LLM (Claude, Cursor, Devin) | +-------------------------------------------------------------------------+ | (MCP JSON-RPC Tools) v +-------------------------------------------------------------------------+ | PMFlow MCP Server | +-------------------------------------------------------------------------+ | | | v v v +-----------------+ +-----------------+ +-----------------+ | PRD & Story | | Story DAG & | | Capacity & PERT | | Decomposer | | Critical Path | | Forecaster | | (BDD/Gherkin) | | (Kahn / CPM) | | (Monte Carlo) | +-----------------+ +-----------------+ +-----------------+ | | | +-----------------------+-----------------------+ | v +-----------------------+ | SQLite WAL Datastore | | (Zero-loss persistence| +-----------------------+ | v +------------------------------------------------+ | Issue Tracker Exporters (GitHub, Linear, Jira) | +------------------------------------------------+ Enter fullscreen mode Exit fullscreen mode 1. Automated PRD Generation & BDD Acceptance Validation When an AI agent is tasked with building a feature, the first step is converting the user's intent into a structured Product Requirements Document (PRD) with MoSCoW prioritization, architectural constraints, and measurable success metrics.

Furthermore, human-written requirements frequently contain ambiguous words ("fast", "seamless", "easy", "robust") that cause AI agents to deviate. PMFlow's BDD Acceptance Validator scores criteria on a 0-100 testability scale and requires concrete quantitative boundaries:

import re VAGUE_TERMS = { " fast ": " Specify response time in milliseconds (e.g., ' < 200ms ' ). ", " easy ": " Specify concrete steps or usability metric (e.g., ' < 3 clicks ' ). ", " intuitive ": " Define accessibility guidelines or UX checklist.

", " robust ": " Specify failure recovery, retry policy, or SLA uptime percentage. " } def validate_scenario ( criteria: list [ str ]) -> dict: has_given = any ( re. match ( r " ^given\b ", line. lower ()) for line in criteria ) has_when = any ( re. match ( r " ^when\b ", line. lower ()) for line in criteria ) has_then = any ( re. match ( r " ^then\b ", line. lower ()) for line in criteria ) score = 100 if not ( has_given and has_when and has_then ): score -= 50 vague_findings = [] for line in criteria: for term, tip in VAGUE_TERMS. items (): if re. search ( r " \b " + re. escape ( term ) + r " \b ", line. lower ()): vague_findings. append ({ " term ": term, " recommendation ": tip }) score -= 10 return { " is_valid ": has_given and has_when and has_then and score >= 60, " testability_score ": max ( 0, score ), " vague_findings ": vague_findings } Enter fullscreen mode Exit fullscreen mode Now, when an agent decomposes a feature, each story must meet strict Given/When/Then standards:

Given a user with an active session token When user issues a POST to /api/v1/checkout with valid cart items Then server responds with HTTP 201 within 250ms and decrements inventory Enter fullscreen mode Exit fullscreen mode 2. Dependency DAG & Critical Path Engine (CPM) In multi-agent environments, tasks cannot execute arbitrarily. PMFlow models the backlog as a Directed Acyclic Graph (DAG) persisted in SQLite WAL.

Before scheduling work, PMFlow verifies that no cyclic dependencies exist:

def topological_sort ( stories, adjacency, predecessors ): in_degree = { sid: len ( predecessors [ sid ]) for sid in stories } queue = [ sid for sid, deg in in_degree. items () if deg == 0 ] sorted_order = [] while queue: node = queue. pop ( 0 ) sorted_order. append ( node ) for succ in adjacency [ node ]: in_degree [ succ ] -= 1 if in_degree [ succ ] == 0: queue. append ( succ ) if len ( sorted_order )!= len ( stories ): cycle_nodes = [ sid for sid, deg in in_degree. items () if deg > 0 ] raise ValueError ( f " Cyclic dependency detected: { cycle_nodes } " ) return sorted_order Enter fullscreen mode Exit fullscreen mode Critical Path & Float Calculation Using forward and backward passes, PMFlow calculates:

+---------------------+ | US-001: Schema | (4.0h, Critical) +---------------------+ | v +---------------------+ | US-002: Tokenizer | (8.0h, Critical) +---------------------+ / \ v v +---------------+ +-------------------+ | US-003: UI | | US-004: RateLimit | (6.0h, Critical) | (2.0h, Slack) | +-------------------+ +---------------+ | \ / v v +------------------------+ | US-005: Deploy Swarm | (2.0h, Critical) +------------------------+ Enter fullscreen mode Exit fullscreen mode Total Project Duration: 20.0 hours. Any delay in US-001, US-002, US-004, or US-005 directly delays the release date, whereas US-003 has float slack and can run in the background.

Will the current backlog fit into the sprint?

Instead of relying on single-point estimates, PMFlow uses triangular PERT estimation (Optimistic, Most Likely, Pessimistic) and executes a 1,000-trial Monte Carlo simulation:

import random def simulate_sprint ( stories, num_agents = 2, hours_per_agent = 40.0, trials = 1000 ): available_capacity = num_agents * hours_per_agent # e.g., 80 hours simulated_totals = [] for _ in range ( trials ): total = 0.0 for s in stories: base = s [ " estimated_hours " ] # Triangular distribution: [0.7*base, base, 1.6*base] total += random. triangular ( 0.7 * base, 1.6 * base, base ) simulated_totals. append ( total ) simulated_totals. sort () p50 = simulated_totals [ int ( 0.50 * trials )] p80 = simulated_totals [ int ( 0.80 * trials )] p95 = simulated_totals [ int ( 0.95 * trials )] return { " p50_hours ": p50, " p80_hours ": p80, " p95_hours ": p95, " is_within_capacity ": p80 <= available_capacity } Enter fullscreen mode Exit fullscreen mode If the P80 confidence forecast exceeds available capacity, PMFlow flags bottleneck tasks and advises the agent swarm on scope pruning before code is written.

Once the PRD and User Stories are validated, PMFlow exports verified payloads directly to the engineering team's tracker of choice:

Connect PMFlow to your local agent configuration:

{ "mcpServers": { "pmflow": { "command": "python3", "args": [ "-m", "pmflow.server" ] } } } Enter fullscreen mode Exit fullscreen mode Now, simply prompt your agent:

"Generate a PRD for an idempotent payment webhook listener, break it down into testable BDD stories, calculate the critical path, and export the issues to GitHub."

Your agent acts with complete product rigor, eliminating hallucinations and delivering code in optimal topological order.

The open-source PMFlow Lite is available immediately on GitHub under the MIT license:

馃憠 GitHub Repository: https://github.com/johannschiffer/pmflow-mcp

For enterprise engineering teams and agent swarms requiring the persistent SQLite WAL DAG engine, Critical Path calculation (CPM), parallel multi-agent wave scheduling, Monte Carlo capacity forecasting, and Jira/Linear exporters:

馃憠 Explore PMFlow Pro on Gumroad ($14.99 USD)

How do you structure requirements and task dependencies when working with autonomous AI agents? Let's discuss in the comments below!

Quelle: dev.to (dev.to). Original 枚ffnen