# Explicit State Machine vs Free-form Agent Loop

CURRENT_STATUS: CURRENT
OBSERVATION: SPEC_ONLY
FRESHNESS: CURRENT
PAGE_TYPE: decision
CANONICAL_URL: /tools/ea-270-explicit-state-machine-vs-free-form-agent-loop
CLAIM_IDS: none
EVIDENCE_IDS: EA-270-CURRENT-APPROVAL, EA-270-CURRENT-BODY-READBACK
UNKNOWN_IDS: EA-270-UNKNOWN-01
OPS_IDS: none

## Summary
state machine採用だけでexactly-onceや正当性は保証されず、free-form loopもtermination・権限・checkpoint・readbackを明示すれば統制できる。

## Current judgment
state machine採用だけでexactly-onceや正当性は保証されず、free-form loopもtermination・権限・checkpoint・readbackを明示すれば統制できる。

## Scope
Explicit State Machine vs Free-form Agent Loop

## Confirmed

## UNKNOWN
- EA-270-UNKNOWN-01: organization workflow engine/version、checkpoint store、schema migration、tool idempotency、approval/IAM、turn/time/cost limits、retention、replay/cancellation semantics、external side-effect contract、incident recovery、tenant realized behavior。

## Evidence
- EA-270-CURRENT-APPROVAL (RESEARCH): 現行本文の監査・revision対応
- EA-270-CURRENT-BODY-READBACK (IMPL): 現行本文の収録照合

## 要点と前提
Agent制御はstate machineとfree-form loopの二択ではない。明示state machineは遷移、retry/catch、pause/resume、履歴、再開位置を外部制御面へ出しやすい。free-form loopもmax turns、termination、handoff、tool permission等を外部化できる。

企業運用では、探索の自由度と業務状態確定を分離する。承認、外部副作用、再試行、停止、再開、authoritative readbackはstate contractへ置き、その境界内でLLMに探索やtool選択を委ねる構成を基本候補とする。ただしhybrid構成を普遍的最適解とはしない。

AWS Step Functions Standardのredriveは失敗stepから同じinput・definitionで再開し成功済みstepの結果/historyを保持するが、eligibility、history、workflow mode等の制約がある。LangGraphのinterrupt/pause/resume、OpenAI Agents SDKのmax_turns、AutoGenのtermination conditionsも各framework固有の機能であり横断保証へ一般化しない。

checkpointやworkflow historyはexternal side-effectのexactly-once保証ではない。再実行され得るtool/APIにはidempotency key、precondition、deduplication、compensation、authoritative readbackを別途設計する。

Failure envelope: non-termination、transition drift、stale checkpoint、definition/version drift、duplicate side effect、wrong resume point、hidden tool state、partial update、handoff cycle、termination error、context loss、approval bypass、schema migration failure、quota/retention exhaustion、cancellation inconsistency。

## OPEN_UNKNOWN
organization workflow engine/version、checkpoint store、schema migration、tool idempotency、approval/IAM、turn/time/cost limits、retention、replay/cancellation semantics、external side-effect contract、incident recovery、tenant realized behavior。

## SAFE_WORDING
state machine採用だけでexactly-onceや正当性は保証されず、free-form loopもtermination・権限・checkpoint・readbackを明示すれば統制できる。

NEXT: /agent/start.json
STOP: This is a knowledge projection, not an execution order.