Skip to content

Implement Plan-and-Execute execution loop (DESIGN_SPEC §6.5 Loop 2) #134

@Aureliolo

Description

@Aureliolo

Context

The ExecutionLoop protocol (defined in M3, #124) enables pluggable loop architectures. The MVP ships with ReAct (Loop 1). This issue implements the second loop: Plan-and-Execute — a two-phase approach where the agent first creates a full plan, then executes each step sequentially.

Acceptance Criteria

Plan-and-Execute Loop Implementation

  • Implements the ExecutionLoop protocol
  • Phase 1 (Plan): agent creates a structured plan with numbered steps
  • Phase 2 (Execute): agent executes each step sequentially, checking results against expectations
  • Re-planning: if a step fails or produces unexpected results, agent can revise remaining steps
  • max_replans configurable (default: 3) to prevent infinite revision loops
  • Plan visible in agent output for observability

Auto-Selection by Complexity (Future)

  • Complexity scoring function (input length, tool count, estimated turns)
  • Automatic loop selection: simple tasks → ReAct, complex tasks → Plan-and-Execute
  • Override via agent config or per-task setting

Testing

  • Unit tests with scripted FakeProvider (deterministic plan + execution)
  • Integration test: complex multi-step task completed via plan-and-execute
  • Comparison test: same task via ReAct vs Plan-and-Execute (verify both complete)

Dependencies

Design Spec Reference

  • §6.5 — Agent Execution Loop (Loop 2: Plan-and-Execute)

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:mediumShould do, but not blockingscope:medium1-3 days of workspec:agent-systemDESIGN_SPEC Section 3 - Agent Systemspec:task-workflowDESIGN_SPEC Section 6 - Task & Workflow Enginespec:toolsDESIGN_SPEC Section 11 - Tool & Capability Systemtype:featureNew feature implementationtype:testTest coverage, test infrastructure

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions