Handbook
Execution engine
forge_lcdl.execution.ExecutionEngine orchestrates:
- Load contract —
load_contract_spec,validate_contract_inputon caller payload. - Plan —
ModelRouter.choose+ExecutionPolicy(RAG mode, prompt cache hints from contract). - Optional RAG —
InferencePlanner→ retrieve chunks →build_evidence_pack→ optionalrag_enough_context_gate→ mergeevidenceinto input → re-validate input. - Run task —
TaskRunner.run(same runners asrun_task). - Verify —
verify_task_result(..., context={"evidence": ..., "rag_mode": ..., "retriever": ...})unlessverification="off". - Repair loop — if
repair="safe_retry"and verification fails, retry up tomax_attempts(no unbounded loops).
LcdlClient holds a default ExecutionPolicy and constructs one engine per client.
Model override
The engine applies routing with dataclasses.replace(profile, model=decision.primary_model) so run_task does not need a new parameter.
Traces
ExecutionResult.trace_summary is a JSON-serializable dict (task id, version, rag_mode, retrieved_chunks, evidence_pack_hash, attempts, verification payloads when failed). It avoids logging full prompts or secrets by default.
Low-level stability
run_task and TaskRunner remain the supported low-level API; the engine is additive.