Why Does Every AI Agent Still Look Like `while (true) { ... }`?
说明与用途
传统 AI 代理使用 while (true) 循环,导致状态脆弱。Pizza 用事件日志替代,支持可靠回滚、分支和更易调试。
问题
Traditional AI agent runtimes rely on a mutable in‑memory state loop (while (true) { … }), which causes brittle behavior such as incomplete turns, ad‑hoc retry logic, awkward parallel tool calls, and inability to rewind or replay sessions.
结果
By treating the event log as the source of truth, Pizza eliminates brittle state handling, supports long‑running sessions, enables easy branching and replay, and allows multi‑agent communication without leaking context.
工作流
- 1. Initialize an EventStore table to record all events.
- 2. On each agent turn, read the latest events to reconstruct the current state.
- 3. Dispatch the next event to the appropriate handler (LLM, tool, or internal action).
- 4. Append the resulting event back to the log.
- 5. Use the log to query UI, context, or to branch by creating a new
thread_idfrom an earlier sequence. - 6. For parallel tool calls, log each invocation as a separate event and combine results before the next plan.
证据
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.
Once you commit to the event log being the source of truth, a bunch of otherwise hard features stop being special cases.
- 记录日期: 2026-09-18T19:00:26.939Z