Migrate agent CLI from Engine.hs to Op-based implementation

t-383·WorkTask·
·
·
Created1 month ago·Updated1 month ago

Description

Edit

Currently there are two agent implementations that aren't connected:

OLD (used by agent CLI):

  • Omni/Agent/Engine.hs - monolithic loop
  • Own Tool type, AgentEvent types, loop logic

NEW (used by experiments only):

  • Omni/Agent/Op.hs - free monad DSL
  • Omni/Agent/Interpreter/Sequential.hs, Parallel.hs
  • Omni/Agent/Programs/Agent.hs, Coder.hs, etc.
  • Own Tool type, Event types, loop logic

Problems:

  • Duplication of Tool types, Event types, loop logic
  • Op system is cleaner but unused in production
  • Trace.hs vs Engine.AgentEvent vs Events.hs - three places for 'what happened'

Migration plan: 1. Unify Tool types (or keep minimal in Op, full in Tools.hs) 2. Unify Event types (single source of truth) 3. Replace Engine.runAgentWithProvider with Op-based loop 4. Update agent CLI to use Interpreter/Sequential 5. Delete Engine.hs loop logic (keep provider code) 6. Ensure agentd containers work with new implementation

Benefits after migration:

  • Single implementation to maintain
  • Checkpointing/resume for free
  • Par/race available if needed
  • Cleaner observability via traces

Risks:

  • Breaking changes to agent behavior
  • Need thorough testing

Timeline (6)

🔄[human]Open → InProgress1 month ago
🔄[human]InProgress → Done1 month ago
💬[human]1 month ago

Agent CLI now runs via Op + Sequential interpreter and emits Trace.Event JSON; agentd status/watch updated to parse trace schema.

💬[human]1 month ago

Added trace custom thinking events (emitted by Sequential interpreter) and watch/CLI display support for parity with old -v2 behavior.