Python planning library · MCP-native · AGPL-3.0

Your agent's planner.
Decompose. Execute.
MCP-native.

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.

agent_planner.py
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()
Goal decompositionCost estimation
MCP stdio / SSE
Goal decomposition
Dependency resolution
Step execution
Cost estimation
MCP-native

Everything your agent needs
to plan and execute

Goal Decomposition

Break complex goals into executable steps. LLM-powered or pattern-based decomposition with automatic dependency detection.

LLMPatternCustom

Dependency Resolution

Topological sort. Automatic parallel execution groups. Cycle detection and validation.

Topological sortParallel groups

Plan Execution

Step-by-step execution in dependency order with automatic retries. Real-time progress tracking.

RetriesProgressTool registry

Dynamic Re-planning

When a step fails, automatically generate alternatives. Three strategies: retry, skip, or LLM replan.

RetrySkipLLM replan

Cost Estimation

Estimate token usage and monetary cost per step before execution. Know the cost before committing.

TokensUSDPer-step

LTP Engine

Lean Task Protocol — compile goals into deterministic execution plans. Supports @PARALLEL, ON_FAIL, FOREACH, RE-PLAN.

Compile onceDeterministic

Plan History

Every plan execution is recorded. Track success rates, costs, and outcomes over time.

Success rateCost tracking

MCP-Native

17 MCP tools: create_plan, execute_plan, estimate_cost, compile_ltp, run_ltp, validate_plan, optimize_plan, and more.

stdioSSE

Define the goal.
planningmcp handles the rest.

1

Create

Decompose a natural language goal into a structured plan with steps and dependencies.

plan = await pipeline.create_plan( "Deploy API to production" )
2

Estimate

Get a token and cost breakdown before executing. Check against budget limits.

est = await pipeline.estimate_cost(plan.id)
3

Execute

Run steps in dependency order with automatic retries. Parallel execution where possible.

result = await pipeline.execute_plan(plan.id)
4

Learn

Every execution is recorded. Track success rates, costs, and outcomes. Improve future plans.

history = await pipeline.get_history("my_agent")

A modular pipeline,
swappable at each stage

ComponentDefaultAlternativesPurpose
DecomposerTemplateGoalDecomposerPatternGoalDecomposer, LLMGoalDecomposer, HybridGoalDecomposerBreak goals into steps
StoreSQLitePlanStoreInMemoryPlanStore, RedisPlanStorePersist plans
ExecutorDefaultStepExecutorCustom with tool registryExecute individual steps
ReplanRetryStrategySkipStrategy, LLMReplanStrategyHandle step failures
CostDefaultCostEstimatorCustomEstimate tokens and cost
HistoryPlanHistoryCustomRecord outcomes

Ready to give your agent
structured planning?

Read the docs Star on GitHub