OptionaladapterThe layout: "xml" (default), "chat", "json", an lmcc adapter, or an artifact.
OptionalanswerThe AI function whose answer, as it is written, is the module's answer (streaming.md, Views): a served module's caller sees that function's answer text as the module's, live.
OptionalapiRe-sends after a transient provider error (default 3).
OptionalapproveWho answers a tool call before it runs (contract/tools.md): a function
asked at once, or a rule a person answers later ("changes", "all", a
list of tool names or approval paths). No approval by default.
OptionalcacheAnswer an identical request with the reply it got before (true: in this
process's memory; or a store: a Map, Redis, …). Off by default. It
returns identical samples too: leave it off where you want different ones.
OptionalcallerWho is calling, added to FUNCTAI_CALLER: { kind: "agent", conversation: "…" }.
OptionalcapabilitiesOptionalconfigAny other lm15 Config fields.
OptionaldefinedThe code module the call log files it under (program.module; default: the file's name, without extension).
OptionaldescriptionWhat it does, in words.
OptionalescalateOptionalescalateWhen the first model is less sure of its answer than escalateBelow
(default 0.9), another answers instead: a model, or an AI function. The
first needs to measure its confidence (a baked model, TypeSafe's Jev,
config: { probabilities: "required" }).
OptionalincludeIts inputs, by name: { message: t.string() }, zod, or any Standard Schema. {} for none.
OptionaljournalWhere each call tree's kept log is written while it runs: a store
(best effort: the call never waits), or { store, mode: "required" }
(the call waits until its events are kept, before its code runs, before
each tool and before it returns; at most timeout ms, 30 s by default).
null: none. A program's own setting cannot replace or remove a host's
journal (JournalError journal-policy).
OptionallmThe model: "gpt-4.1-mini", "claude-haiku-4-5", "groq:openai/gpt-oss-120b", …
OptionallogThe call log: a folder, true (the default folder), or false. Unset: FUNCTAI_LOG_CALLS decides.
OptionallogWhich values the call log and the kept form of events keep: true,
false (sizes, times and tokens only), or by field ({ transcript: false };
{ "*": false, question: true } keeps only the question). It only ever
removes: a value is written only when no layer drops it, and
FUNCTAI_LOG_CONTENT=0 drops every value.
OptionalmaxModel calls per tool loop (default 8).
OptionalmaxOptionalmodule"predict" (default) or "cot": reasoning before the answer.
OptionalobserversReceivers of the kept form of every event of the calls in scope (a
page, telemetry). They add up over the layers (configure's replaces
configure's: keep your own list to add one). A function is called
soon after each event, off the call's own turn, from a bounded queue
(an observer 10,000 events behind loses events); it still runs on this
thread, so heavy work belongs in a Worker: an object with
postMessage is posted each event. One that throws is warned about
once and given no more events.
OptionaloutputIts one output (named result), what run returns.
OptionaloutputsSeveral outputs, in order (the last is the answer): run returns a record of each by name.
OptionalpluginsPlugins around the calls in scope (contract/plugins.md): they add up over the layers, the program's own first, the host's last.
Optionalprogramfalse (a host's block or configure): the observers a program sets for
itself are given no event; the host's still are. It only removes: a
program's own true does not undo it.
Optionalprogramfalse (a host's layer): the program's own plugins do not run.
OptionalreplicateThe n-th independent answer to the same request (default 0): part of the reply cache's key, and nothing else.
OptionalretriesRe-asks after an unreadable reply (default 1).
OptionalrouterThe lm15 router calls go through (keys, base URLs, a fake for tests).
OptionalseedOptionalstopOptionaltemperatureOptionaltemplateA chat template of lmcc messages, instead of a named layout.
Optionaltool"report" (the model sees a tool's error) or "raise".
OptionaltopOptionalusesThe AI functions and modules it calls: its version changes when they change.
What
module(name, spec, run)takes besides its code: its interface, what it uses, and settings.