Dauerhafte Agentenausführung
Macht Agentenausführung durch klare Lebenszykluszustände, dauerhafte Werkzeughistorie und begrenzte Fortsetzung nach Unterbrechungen wiederherstellbar.
agent-runtime-state
Entdecke, wie der Skill hilftWann ist der Skill hilfreich?
Nutze ihn, wenn Läufe auf Freigabe warten oder abstürzen, während ein Werkzeug bereits Änderungen bewirkt haben könnte.
Wobei hilft er dir?
- Definiert Warteschlange, Ausführung, Freigabe und Endzustände ausdrücklich.
- Speichert Werkzeugabsichten vor Ausführung und verwendet vorhandene Ergebnisse.
- Begrenzt Schleifen und klärt unsichere Schreibvorgänge vor Wiederholung.
Das könntest du fragen
Stelle einen unterbrochenen Agentenlauf ohne doppelte Nachrichtenzustellung wieder her. Simuliere einen Absturz nach der Zustellung, aber vor dem letzten Speicherpunkt. Gleiche die Nachrichtenkennung ab und setze nur unerledigte Arbeit fort.
Ausführliche Dokumentation
Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.
Weniger anzeigen
Agent Runtime & State Machines
Treat an agent run as a durable, event-sourced state machine rather than an in-memory while loop around an LLM call. Every model turn, tool invocation, human approval pause, and cancellation must transition through explicit states and persist enough history to resume cleanly after a process restart or crash.
Explicit Run State Machine
Model the lifecycle of an agent run and each turn with unambiguous states and legal transitions:
| State | Meaning | Allowed Next States | Persistence Requirement |
|---|---|---|---|
queued |
Run created, awaiting worker slot | running, cancelled |
Initial input, configuration, correlation ID |
running |
Model inference or turn orchestration active | awaiting_tool, awaiting_approval, completed, failed, cancelled |
Append turn_started and streamed deltas or final assistant message |
awaiting_tool |
One or more tool calls dispatched | running, awaiting_approval, failed, cancelled |
Persist tool_call_requested with tool_call_id, name, and canonical arguments before executing |
awaiting_approval |
Paused on human or policy gate | awaiting_tool, running, cancelled, timed_out |
Persist pending tool_call_id, approval payload, and resume token |
completed |
Terminal goal or stop condition reached | (terminal) | Final structured output, stop reason, aggregated usage |
failed |
Unrecoverable error or budget exhausted | queued (explicit retry/resume) |
Structured error code, failure phase, last checkpoint ID |
cancelled / timed_out |
Aborted by caller, signal, or deadline | queued (explicit resume) |
Cancellation reason, any partial tool outputs completed before abort |
Append-Only Event Log & Checkpointing
- Write-ahead tool intent: Persist the assistant message containing
tool_useblocks to the run store before invoking any tool handler. If the worker crashes mid-tool, recovery knows exactly which tool call was in flight. - Idempotent tool result recording: Record each
tool_resultkeyed by(run_id, turn_index, tool_call_id). When resuming an interrupted turn, replay already-recordedtool_resultentries from storage instead of re-executing completed tools. - Side-effect classification:
read_only: Safe to automatically re-run on crash recovery if no result was recorded.idempotent_write: Safe to re-run only when called with the persisted deterministicidempotency_key(sha256(run_id + tool_call_id)).non_idempotent: Never auto-retry after an ambiguous crash (in_flightwithout result); transition toawaiting_approvalor emit a reconciliation status check tool first.
Loop Guards, Budgets & Termination
Never rely solely on the model deciding to stop:
- Hard turn & step ceilings: Enforce
max_turnsandmax_tool_calls_per_turn. Whenturn_count == max_turns - 1, inject a final system notice instructing the model to synthesize its best answer or return a structured partial-progress handoff without calling further tools. - Token and cost budgets: Track cumulative
input_tokens,output_tokens,cache_creation_input_tokens, andcache_read_input_tokensafter every response. Halt withbudget_exceededbefore starting a turn that would breach the run budget. - Cycle and repetition detection: Hash
(tool_name, canonical_json(args))across a sliding window. If the agent invokes the identical failing or no-op tool call $N$ times (e.g., 3 consecutive identical calls), intercept the call and return a syntheticisError: truetool result explaining the loop and requiring a different strategy. - Cooperative cancellation (
AbortSignal): Thread anAbortSignalinto both the LLM stream and every tool execution context. On abort, cancel in-flight HTTP streams, terminate child processes withSIGTERMfollowed bySIGKILLafter grace period, and close the turn with a synthetic cancelledtool_resultso conversation history remains valid for future resumption.
Enthaltene Dateien 1
SKILL.md
Über dieses Skill-Paket
agent-runtime-state
agent-runtime-state: Entwickelt KI-Agentenfunktionen mit klaren Werkzeugverträgen, kontrollierten Berechtigungen, dauerhaftem Zustand und nachvollziehbarem Modellverhalten.
Weniger anzeigen
agent-runtime-state
agent-runtime-state: Entwickelt KI-Agentenfunktionen mit klaren Werkzeugverträgen, kontrollierten Berechtigungen, dauerhaftem Zustand und nachvollziehbarem Modellverhalten.
Enthält den vollständigen Skill und seine Begleitdateien (1 Dateien). Der genaue, ursprünglich verfasste Anwendungsbereich bleibt unten erhalten.
Ursprüngliche Skill-Beschreibung (Quellsprache)
Use when designing, implementing, or debugging agent runtimes, execution loops, turn state machines, tool execution checkpoints, timeouts, cancellation, crash recovery, or replayable event logs.
Installiere den Skill, prüfe seine Quelle und Vertrauenseinstellungen und aktiviere ihn für das passende Projekt oder den Agenten.
Voraussetzungen
- Orqestria auf deinem Computer installiert.
