Skip to main content
Durable tool runs journal every model and tool boundary so a crash mid-loop resumes from the exact step it left off β€” recorded tool results replay instead of re-executing.

Quick Start

1

Record each boundary

Open a run under a stable id and append an event at every model decision and tool result.
2

Resume after a crash

Re-open the same run id, then replay recorded steps so side-effecting tools do not fire twice.

How It Works

The journal records one event per boundary keyed by (run_id, seq, kind). On resume the loop is re-driven from the top; journalled steps return their recorded payload instantly, and only un-journalled steps do real work. A run moves through three states:

Event Kinds

Each boundary is recorded under a kind. Recorded results replay on resume instead of re-executing.

Configuration Options

RunJournal(db_path=None) β€” the constructor is the whole surface. Key methods:

Common Patterns

Long-running scheduled job that survives a container restart:
Batch of paid API calls that must never double-charge β€” replay the recorded receipt instead of re-calling:
Pause-for-approval flows survive a restart because the approval decision is journalled β€” see Durable Approvals.

Best Practices

Key the run on the order id, ticket id, or job id ("order-A-1042") so a restart can find the right journal row with interrupted_runs() or replay_index().
The default ~/.praisonai/runs/journal.db is lost when a container is recreated. Pass an explicit path on a mounted volume, e.g. RunJournal("/data/praisonai/journal.db").
The journal prevents re-execution of recorded completions. A tool that crashed before its tool_result was appended still needs an idempotency key at the tool layer.
The journal keys on run_id verbatim. Reusing an id for a different task replays the wrong recorded steps.

Run-State Journal

The SQLite layer under durable runs.

Durable Approvals

The approval event β€” pause-for-approval that survives a restart.

Execution

Agent execution limits and configuration.

Gateway Session Persistence

Persist gateway sessions across restarts.