Skip to contents

A journal keeps the kept form of every call tree whose outermost call starts where it is set (ai_config(journal = ...), with_ai_config(..., journal = ...), or an AI function's own .journal), in a store (memory_store(), or one of your own). Best effort (the default) never stops a call: a store that fails is warned about once, and events it did not answer are sent again with the next one. Required makes the call wait until its start, each tool call that changes things, and its end are confirmed kept: when its start or a tool call is not, the code or the tool does not run (journal-barrier); when its end is not, the call raises journal-end holding what it did (see settle()).

Usage

ai_journal(store, required = FALSE, retries = 2L)

Arguments

store

A store: memory_store(), or a list of append, claim and read functions.

required

Whether calls wait for it (see above).

retries

How many times an event is sent again in a row before the writer gives up on it for now.

Value

A journal.

Details

A host's journal holds: a function's own setting cannot replace or remove it, and nothing closer can weaken or remove a required one (journal-policy, refused before the call runs). Observers add up across layers (observers = list(f)); a host's program_observers = FALSE gives a function's own observers nothing.