# ADR-005 — چرا Runtime ابتدا محدود باشد؟

Why start with a bounded runtime?

Status: proposed · Date: 2026-10-15

## مسئله / Context

agent عمومی با انتظار، retry، cancellation و اثر بیرونی از یک حلقهٔ while پیچیده‌تر است.

General agents with waits, retries, cancellation, and external effects are more complex than a loop.

## گزینه‌ها / Alternatives

state machine دامنه‌ای کوچک؛ workflow engine آماده؛ موتور عمومی سفارشی.

A small domain state machine, an existing workflow engine, or a custom general engine.

## انتخاب فعلی / Choice

ابتدا state machine محدود برای یادگیری قرارداد؛ پیش از workflowهای بلند و پیچیده، engine آماده را benchmark کنیم.

Use a bounded state machine to learn contracts; benchmark an existing engine before long complex workflows.

## چرایی و trade-off / Rationale and trade-off

قرار نیست موتور workflow عمومی بازنویسی کنیم. نقطهٔ یادگیری، مرز commit، epoch و outcome نامعلوم است.

Do not rewrite a general workflow engine. Learn commit boundaries, epochs, and unknown outcomes.

## فرض‌ها / Assumptions

E02 میانگین ۸ call فرضی است؛ سقف step و deadline باید جدا تعیین شوند.

E02 assumes eight calls on average; step caps and deadlines need separate decisions.

## روش آزمون / Validation

kill/resume؛ stale-owner rejection؛ pause پس از tool effect؛ ابزار write باید خود idempotency enforce کند.

Kill/resume, stale-owner rejection, pause after tool effects; write tools enforce their own idempotency.

## بازنگری / Revisit

با انتظار انسانی، DAG پیچیده یا تغییرات ناسازگار workflow، ادامهٔ موتور دستی دوباره توجیه شود.

Rejustify custom runtime work when human waits, complex DAGs, or incompatible workflow evolution appear.

DDIA: 5, 8, 9, 10
