Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Why Does Every AI Agent Still Look Like `while (true) { ... }`?

Описание и применение

Традиционные AI‑агенты используют простую петлю while (true) с мутируемым состоянием, что приводит к ломкости и трудностям при прерываниях, повторениях и параллельных вызовах. В проекте Pizza состояние заменено журналом событий, где каждое действие записывается как событие. Это обеспечивает воспроизводимость, ветвление, совместную работу и унифицированный интерфейс.

Задача

Traditional AI agent runtimes rely on a simple while (true) loop with a mutable state object, leading to brittle behavior, difficulty handling interruptions, retries, parallel tool calls, and lack of replayability.

Результат

Switching to an event-sourced architecture eliminates brittle state handling, enables session replay, branching, and multi-agent collaboration, and unifies multiple interfaces over a single log.

Рабочий процесс

  • 1. Initialize EventStore table for events.
  • 2. On each turn, read the latest events to reconstruct current state via projection.
  • 3. Send LLM plan request with current state context.
  • 4. Execute tool calls as events (e.g., cli tool for shell commands).
  • 5. Append results as new events to the log.
  • 6. Repeat until isDone condition met or user interrupts.
  • 7. For branching, create new thread_id from earlier sequence and replay events to that point.

Доказательства

Every message, tool call, result, and file edit becomes one row in an EventStore

Источник

The runtime doesn’t hold state in memory. It reads the tail of this log, dispatches the next event to a handler, and appends the result back.

Источник

If you want to branch the conversation, you start a new thread_id from an earlier sequence.

Источник

  • Дата записи: 2026-09-12T03:15:34.684Z