Stable public Clojure API for library consumers.
This namespace is the supported facade for starting sessions, running turns,
reading canonical session state, and checking claim provenance. It intentionally stays
generic: the model-facing runtime surface remains the six functions installed
inside a session namespace (FINAL, lm, map-lm, rlm, map-rlm,
attach-rlm).
Stable public Clojure API for library consumers. This namespace is the supported facade for starting sessions, running turns, reading canonical session state, and checking claim provenance. It intentionally stays generic: the model-facing runtime surface remains the six functions installed inside a session namespace (`FINAL`, `lm`, `map-lm`, `rlm`, `map-rlm`, `attach-rlm`).
(alias-session! store-root alias session-id)Create an alias fact pointing alias to session-id.
Create an alias fact pointing `alias` to `session-id`.
(auth-status provider-id)Return auth availability data for provider-id.
Return auth availability data for `provider-id`.
(check-claims final)(check-claims final base)Check evidenced claims against the filesystem.
base resolves relative evidence paths.
Check evidenced claims against the filesystem. `base` resolves relative evidence paths.
(check-consistency store-root)(check-consistency store-root opts)Validate the canonical SQLite + BlobStore root and derived Datahike index.
Returns a report map with typed issue maps in :issues; ordinary consistency
failures are reported, not thrown.
Validate the canonical SQLite + BlobStore root and derived Datahike index. Returns a report map with typed issue maps in `:issues`; ordinary consistency failures are reported, not thrown.
(config)(config opts)Normalize engine configuration.
Accepts the same generic keys used by the engine, including :runs-dir,
:models, :max-turns, :max-fanout, :max-leaf-concurrency,
:call-timeout-ms, :retry, and provider-specific test hooks such as
:scripted/responses or :scripted/response-fn.
Normalize engine configuration. Accepts the same generic keys used by the engine, including `:runs-dir`, `:models`, `:max-turns`, `:max-fanout`, `:max-leaf-concurrency`, `:call-timeout-ms`, `:retry`, and provider-specific test hooks such as `:scripted/responses` or `:scripted/response-fn`.
(event-stream locator)Return the canonical event stream for a session locator.
Return the canonical event stream for a session locator.
(extract-claims final)Extract evidenced claims from a final value.
Extract evidenced claims from a final value.
(fork-session! cfg source-handle target-store-root)(fork-session! cfg source-handle target-store-root opts)Fork a session from a canonical session id, alias, or handle and return a live handle.
target-store-root, when present, is the canonical store root for the fork.
opts may include :turn, :id, or :alias.
Fork a session from a canonical session id, alias, or handle and return a live handle. `target-store-root`, when present, is the canonical store root for the fork. `opts` may include `:turn`, `:id`, or `:alias`.
(list-sessions store-root)List canonical session records under store-root.
List canonical session records under `store-root`.
(load-at root-locator address)Load the node at address within a root session locator.
Load the node at `address` within a root session locator.
(load-node locator)(load-node locator address)Load one node from a session locator. Defaults to the root node.
Load one node from a session locator. Defaults to the root node.
(node-locator root-locator address)Resolve a node address to its canonical locator, starting at root-locator.
Resolve a node address to its canonical locator, starting at `root-locator`.
(node-provenance root-dir address)Return the final value, claims, child refs, and leaf refs for a node address.
Return the final value, claims, child refs, and leaf refs for a node address.
(progress locator)A lightweight, ref-free live snapshot of a session locator. Pairs with
run-turn-async!.
A lightweight, ref-free live snapshot of a session locator. Pairs with `run-turn-async!`.
(provider-descriptor provider-id)Return the generic provider descriptor for provider-id.
Return the generic provider descriptor for `provider-id`.
(rebuild-index! store-root)Rebuild the derived Datahike index from canonical SQLite rows and BlobStore refs.
Rebuild the derived Datahike index from canonical SQLite rows and BlobStore refs.
(resolve-session store-root id-or-alias)Resolve id-or-alias to a canonical session locator/ref map.
Resolve `id-or-alias` to a canonical session locator/ref map.
(resume-session! cfg source-handle)(resume-session! cfg source-handle opts)Restore a session from a canonical session id, alias, or handle and return a live session handle.
opts may include :turn or :id.
Restore a session from a canonical session id, alias, or handle and return a live session handle. `opts` may include `:turn` or `:id`.
(run-task! task)(run-task! cfg task)(run-task! cfg task opts)One-shot helper: start a session, run one task, stop the session, and return the turn result map.
opts is passed to start-session!, so callers can set :id, :alias,
:store-root, and :overlay.
One-shot helper: start a session, run one task, stop the session, and return the turn result map. `opts` is passed to `start-session!`, so callers can set `:id`, `:alias`, `:store-root`, and `:overlay`.
(run-turn! session user-message)Run one user message on a live session handle. Returns the turn result map.
Blocks until the turn settles. Throws :fractal/turn-in-flight if another turn is
already running on this handle.
Run one user message on a live session handle. Returns the turn result map. Blocks until the turn settles. Throws `:fractal/turn-in-flight` if another turn is already running on this handle.
(run-turn-async! session user-message)Run one user message on a background daemon thread. Returns a promise delivering
the turn result map (a turn that throws delivers an {:status :error ...} map, not
an escaping exception). Poll progress (or load-node) on the session locator to
watch the turn in flight, then deref the promise for the result. Throws
:fractal/turn-in-flight if another turn is already running on this handle.
Run one user message on a background daemon thread. Returns a promise delivering
the turn result map (a turn that throws delivers an `{:status :error ...}` map, not
an escaping exception). Poll `progress` (or `load-node`) on the session locator to
watch the turn in flight, then deref the promise for the result. Throws
`:fractal/turn-in-flight` if another turn is already running on this handle.(scripted-responder clauses)Build a content-addressed value for :scripted/response-fn. clauses is a
sequence of [match reply] pairs; the first whose match applies wins. match is
a substring of the last user message (string), a predicate on the request (fn), or
:default. reply is a string, a response map, or a fn of the request. Race-free
under concurrent map-lm/map-rlm fanout, so it is the recommended way to script
fanned-out offline runs (a shared response queue has undefined order once leaves
run in parallel).
Build a content-addressed value for `:scripted/response-fn`. `clauses` is a sequence of [match reply] pairs; the first whose `match` applies wins. `match` is a substring of the last user message (string), a predicate on the request (fn), or `:default`. `reply` is a string, a response map, or a fn of the request. Race-free under concurrent `map-lm`/`map-rlm` fanout, so it is the recommended way to script fanned-out offline runs (a shared response queue has undefined order once leaves run in parallel).
(session-derivations store-root session-id)Read derivation/provenance edges where session-id is the source or target.
Read derivation/provenance edges where `session-id` is the source or target.
(session-heads store-root session-id)Read immutable head records for a session.
Read immutable head records for a session.
(session-invocations store-root session-id)Read caller-owned outgoing invocation records for a session.
Read caller-owned outgoing invocation records for a session.
(session-locator store-root session-id)Return the canonical locator for a session id.
Return the canonical locator for a session id.
(session-ref store-root session-id)Read the canonical current-head ref for a session.
Read the canonical current-head ref for a session.
(start-session! cfg)(start-session! cfg opts)Start a fresh live session and return a session handle.
opts may include:
:id stable session id:alias optional canonical alias:store-root canonical store root for SQLite facts and blobs:overlay extra session-level system instructions appended to the base
behavior prompt in the single system messageThe overlay specializes the session transcript; it does not add model-facing functions or change engine behavior.
Start a fresh live session and return a session handle. `opts` may include: - `:id` stable session id - `:alias` optional canonical alias - `:store-root` canonical store root for SQLite facts and blobs - `:overlay` extra session-level system instructions appended to the base behavior prompt in the single system message The overlay specializes the session transcript; it does not add model-facing functions or change engine behavior.
(stop-session! session)Mark a live session stopped and flush the session artifacts.
Mark a live session stopped and flush the session artifacts.
(summarize-claims checks)Summarize claim check verdicts into totals and an overall trust call.
Summarize claim check verdicts into totals and an overall trust call.
(tree locator)(tree locator address label)Load the full addressable summary tree for a session locator.
Load the full addressable summary tree for a session locator.
(view locator)Load a session locator's canonical DB/blob view. Pure read; no provider calls.
Load a session locator's canonical DB/blob view. Pure read; no provider calls.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |