planningmcp is a modular Python library for goal decomposition, dependency resolution, and step-by-step execution. Estimate costs, manage budgets, and learn from past plans.
from planningmcp import PlanningFactory
pipeline = PlanningFactory.default()
plan = await pipeline.create_plan(
"Deploy the new API to production",
namespace="my_agent",
)
estimate = await pipeline.estimate_cost(plan.id)
print(f"Estimated: {estimate.estimated_tokens} tokens")
result = await pipeline.execute_plan(plan.id)
from planningmcp.mcp_server import PlanningMCPServer
PlanningMCPServer(pipeline).run()
Break complex goals into executable steps. LLM-powered or pattern-based decomposition with automatic dependency detection.
Topological sort. Automatic parallel execution groups. Cycle detection and validation.
Step-by-step execution in dependency order with automatic retries. Real-time progress tracking.
When a step fails, automatically generate alternatives. Three strategies: retry, skip, or LLM replan.
Estimate token usage and monetary cost per step before execution. Know the cost before committing.
Lean Task Protocol — compile goals into deterministic execution plans. Supports @PARALLEL, ON_FAIL, FOREACH, RE-PLAN.
Every plan execution is recorded. Track success rates, costs, and outcomes over time.
17 MCP tools: create_plan, execute_plan, estimate_cost, compile_ltp, run_ltp, validate_plan, optimize_plan, and more.
Decompose a natural language goal into a structured plan with steps and dependencies.
Get a token and cost breakdown before executing. Check against budget limits.
Run steps in dependency order with automatic retries. Parallel execution where possible.
Every execution is recorded. Track success rates, costs, and outcomes. Improve future plans.
| Component | Default | Alternatives | Purpose |
|---|---|---|---|
| Decomposer | TemplateGoalDecomposer | PatternGoalDecomposer, LLMGoalDecomposer, HybridGoalDecomposer | Break goals into steps |
| Store | SQLitePlanStore | InMemoryPlanStore, RedisPlanStore | Persist plans |
| Executor | DefaultStepExecutor | Custom with tool registry | Execute individual steps |
| Replan | RetryStrategy | SkipStrategy, LLMReplanStrategy | Handle step failures |
| Cost | DefaultCostEstimator | Custom | Estimate tokens and cost |
| History | PlanHistory | Custom | Record outcomes |