forge-lcdl

Execution engine

forge_lcdl.execution.ExecutionEngine orchestrates:

  1. Load contractload_contract_spec, validate_contract_input on caller payload.
  2. PlanModelRouter.choose + ExecutionPolicy (RAG mode, prompt cache hints from contract).
  3. Optional RAGInferencePlanner → retrieve chunks → build_evidence_pack → optional rag_enough_context_gate → merge evidence into input → re-validate input.
  4. Run taskTaskRunner.run (same runners as run_task).
  5. Verifyverify_task_result(..., context={"evidence": ..., "rag_mode": ..., "retriever": ...}) unless verification="off".
  6. Repair loop — if repair="safe_retry" and verification fails, retry up to max_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.

See also