Skip to content

Implement agent engine core with ExecutionLoop protocol integration (DESIGN_SPEC §3.1, §6.1, §6.5) #11

@Aureliolo

Description

@Aureliolo

Context

This is the heart of the framework — the core agent execution engine. It implements the orchestration layer that loads agent config, constructs prompts, calls the LLM via the provider layer, and processes responses including tool calls.

The engine uses the ExecutionLoop protocol (§6.5) to define how an agent processes a task. The MVP implements the ReAct loop through the protocol interface, enabling future addition of Plan-and-Execute and Hybrid loops without modifying the engine.

Acceptance Criteria

Core Engine

  • Core orchestration: 1) load agent config, 2) construct system prompt, 3) inject working memory, 4) delegate to ExecutionLoop for task processing, 5) collect response with metadata
  • AgentIdentity + TaskResponse as the primary interface
  • System prompt constructed from agent configuration
  • Response metadata includes: tokens used, cost, duration, iterations
  • Fully async execution
  • Max iteration limit to prevent infinite loops

ExecutionLoop Protocol Integration (§6.5)

  • Engine delegates task processing to the configured ExecutionLoop implementation
  • execution_loop config key selects which loop to use ("react" for MVP)
  • Engine is loop-agnostic — it sets up context and delegates, not concerned with loop internals
  • ReAct loop is the default and only implementation for M3 (Plan-and-Execute and Hybrid are future — see §6.5 issue)

Tool Calling

  • Iterative tool-calling loop within ReAct (LLM can make multiple tool calls per task)
  • Tool results fed back to LLM for next iteration

Testing

  • Unit tests with mock LLM provider (>80% coverage)
  • Integration test demonstrating full loop with tool calls

Dependencies

  • Depends on provider adapter layer (M2, done)
  • Depends on agent identity and config (M1, done)
  • Related: §6.5 ExecutionLoop protocol issue (defines the protocol + ReAct implementation)

Design Spec Reference

  • §3.1 — Agent Architecture
  • §6.1 — Task Execution
  • §6.5 — Agent Execution Loop (ExecutionLoop protocol)

Updated 2026-03-06: Added §6.5 ExecutionLoop protocol integration. Engine now delegates to the configured loop implementation rather than hardcoding a single loop. ReAct is the M3 MVP default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:criticalBlocks other work, must do firstscope:large3+ days of workspec:agent-systemDESIGN_SPEC Section 3 - Agent Systemspec:providersDESIGN_SPEC Section 9 - Model Provider Layerspec:task-workflowDESIGN_SPEC Section 6 - Task & Workflow Enginespec:toolsDESIGN_SPEC Section 11 - Tool & Capability Systemtype:featureNew feature implementation

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions