feat(prompts): implement Phase 4 - Execution Engine (FR-4, FR-5)
Some checks failed
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled
Test Suite / code-quality (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Some checks failed
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled
Test Suite / code-quality (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Implement three-stage execution lifecycle with idempotent runs and complete provenance tracking via RunManifest. Core Features: - PromptRun model with execution lifecycle stages: 1. Analysis: Template analysis and macro extraction 2. Compilation: Macro resolution and context compilation 3. Processing: LLM execution and output generation - InputBundleHash for deterministic idempotency (FR-4.3) - RunManifest for complete execution provenance (FR-5) - LLMAdapter interface for pluggable model providers - MockLLMAdapter for testing without API calls - PromptExecutionEngine orchestrating full lifecycle Idempotent Execution (FR-4.4): - Calculate SHA-256 hash of complete input context - Skip execution if identical hash exists - Cache successful runs by hash - Support force re-execution via config flag RunManifest Tracking (FR-5.2): - Template metadata (id, name, digest) - Resolved input artifacts and digests - Compiled prompt digest - Model configuration - Output artifacts - Dependency edges for graph construction - Timing metadata for performance analysis Tests (27 passing): - 17 execution model tests (config, bundle, runs, stages) - 10 engine tests (execution, idempotency, errors, caching) Implements: - FR-4.1: Three-stage execution lifecycle - FR-4.2: CompiledPrompt during compilation - FR-4.3: InputBundleHash calculation - FR-4.4: Skip execution for identical hashes - FR-5.1: RunManifest persistence - FR-5.2: Complete manifest contents - FR-5.3: Nested run linking (foundation) Files Created: - markitect/prompts/execution/models.py - markitect/prompts/execution/manifest.py - markitect/prompts/execution/llm_adapter.py - markitect/prompts/execution/engine.py - migrations/prompts/003_create_runs_and_manifests.sql - tests/unit/prompts/test_execution_models.py - tests/unit/prompts/test_execution_engine.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
29
markitect/prompts/execution/__init__.py
Normal file
29
markitect/prompts/execution/__init__.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""
|
||||
Execution engine for Prompt Dependency Resolution.
|
||||
|
||||
This package provides the core execution infrastructure for running
|
||||
PromptTemplates with idempotent execution and complete provenance tracking.
|
||||
"""
|
||||
|
||||
from markitect.prompts.execution.models import (
|
||||
PromptRun,
|
||||
ExecutionStage,
|
||||
RunConfig,
|
||||
InputBundle,
|
||||
LLMResponse,
|
||||
)
|
||||
from markitect.prompts.execution.manifest import RunManifest
|
||||
from markitect.prompts.execution.engine import PromptExecutionEngine
|
||||
from markitect.prompts.execution.llm_adapter import LLMAdapter, MockLLMAdapter
|
||||
|
||||
__all__ = [
|
||||
"PromptRun",
|
||||
"ExecutionStage",
|
||||
"RunConfig",
|
||||
"InputBundle",
|
||||
"LLMResponse",
|
||||
"RunManifest",
|
||||
"PromptExecutionEngine",
|
||||
"LLMAdapter",
|
||||
"MockLLMAdapter",
|
||||
]
|
||||
Reference in New Issue
Block a user