The version-one contracts in pkg/addons/contract define managed-process addons.
The owner installs, verifies, starts and supervises them, and a deployment with
several frontends forwards every addon request to that owner over a pinned mutual
TLS carrier. The routes are described in Public API, the Apps and
Add-ons pages in Apps, and Tables, the first first-party add-on, in
Tables. The first-party package is described in
First-party package and release channels;
CI publishes it, not the tests or acceptance: the master workflow publishes the development channel, and a release tag publishes the pinned entries of the release.
Trust has three parts, and they are different:
Package identity. A package is installed only after its digest matches the
catalog entry and, when the library requires it, its signature matches the
identity policy of that library. A library, a channel and a trusted signer never
change by themselves, and an upgrade is refused when the trusted identity of the
new package differs from the installed one.
Executable code. An installed executable is trusted code, not sandboxed
code. It runs as the owner’s operating system user, with the owner’s file system
and network. The host gives it a loopback port, a per-start credential and its
own data directory; it does not confine it. Install only packages you trust.
Authority. An addon never decides who a caller is or whether a change was
approved. The host supplies the actor from the authenticated session or key,
decides every role, and applies a mutation from an API client, an MCP session or
the OpenAI-compatible chat route only after the proposer’s own browser session
confirms it. The one exception is the chats on the server (/api/chats), their
agents and their triggers: turning an add-on on for a chat or an agent is the
consent, and the change is applied at once, with the credential of the chat turn,
for the user who turned the add-on on, and with an undo where the add-on keeps
one (see Proposals and confirmation). Prompt text,
a model and an addon cannot supply that approval.
Every addon requires an executable; a UI bundle alone is not an addon.
The owner’s resource policy also serves the resource kinds that are not add-ons.
Share with your team describes their roles, the
grant to @everyone and the /api/shares routes.
Pages of this reference
Host policy: Host policy and the administrator host operation policy.
Look up the internal host policy store and the rules for administrators. This page is part of the Add-on contract reference.
Internal host policy store
core/services/addons/hostsettings provides internal, host-owned durable policy
infrastructure. The gateway now provides typed read/update actions over the existing
owner carrier. The owner revalidates the authenticated actor and checks current host
administrator authority before updates; caller-supplied role flags are rejected.
Reads are explicitly read-only. Lost mutation responses retain the carrier’s
unknown-outcome behavior, with operation IDs and durable receipts for reconciliation.
Trusted host consumers can also read snapshots over a pinned mutual-TLS internal
route, without impersonating an end user. Frontends never fall back to local policy
when the owner or its store is unavailable.
All read, update and replay results expose only schema version, revision and policy, excluding private migration provenance retained in owner storage.
Application initialization opens host-settings.json under the add-on owner root
after acquiring the owner storage guard and attaches it to the gateway. Frontends
only forward requests; they never open or import this store. Startup failure,
context cancellation and application shutdown close the store once. A restart
retains the saved policy and revision rather than importing configuration again.
Studio now reads the owner’s network policy for new-chat defaults, administrator
network views, chat network settings, approval-card decisions and connection checks.
These reads carry the request context and return errors. A frontend uses the pinned
mutual-TLS internal route; an owner reads its durable store directly. Each host check
reads current policy, so tightening applies to the next request on an existing
frontend without restarting it. A waiting approval card rechecks policy when it
wakes or polls, including after an answer. The Sandbox proxy’s existing short-lived
verdict cache still bounds reuse of an earlier connection verdict as described below.
An unavailable owner or store does not substitute frontend settings or a cached allow.
Defaults, views and card decisions return an error; connection checks and waiting
cards return a blocking verdict with a policy-unavailable error. When add-ons are
disabled, Studio retains its existing local configuration behavior, including the
last valid parsed lists. An enabled add-on deployment with no owner gateway instead
fails closed.
Studio also reads the owner’s chats_tool_providers map for replaceable tools
and skills. Provider selection, command availability, skill indexes and
administrator tool/skill views read current pins with the request context. An
owner update takes effect on the next read without restarting frontends or chat
workers. When the owner or store cannot supply policy, these operations return
an error rather than use frontend pins, a cached choice or a built-in fallback.
A mandatory provider-policy failure during chat-tool priming prevents the
harness from starting. On a running chat, that failure aborts the turn with a
fatal error before the model receives the message or any tool executes.
This differs from a stopped or unusable add-on: with policy available, the
existing built-in fallback rules still apply. Optional connector and skill-listing
failures retain their existing behavior; an optional connector failure does not
abort the turn. With add-ons disabled, Studio continues to use its local
chats_tool_providers configuration.
The legacy /api/settings route does not read or update owner policy. With
add-ons enabled, GET /api/settings omits the eight migrated fields listed below
and returns addon_host_settings_authority: "owner_required", even if the owner
is unavailable. POST /api/settings returns 409 Conflict if any migrated field
is present, including null, case-insensitive names or duplicate keys. A mixed
patch is rejected atomically before any local setting is applied or persisted.
Unrelated local settings remain readable and writable; chats_egress_audit_days
is local audit retention, not migrated owner policy. With add-ons disabled, the
legacy GET and POST behavior is unchanged. The settings UI is not yet connected
to the owner store.
The schema is limited to six network fields (chats_egress_ceiling,
chats_egress_default, chats_egress_allow_private, chats_egress_ports,
chats_egress_extra_registries, chats_egress_allowed_hosts), provider pins
(chats_tool_providers) and the owner’s upgrade switch (auto_upgrade_addons).
Audit retention is excluded. The intended consumers are the Sandbox’s host network
checks, chat tool and replaceable-skill selection, and the owner’s upgrade loop.
Provider pins name replaceable tools (bash, web_search, web_fetch) or skills
(xlsx, docx, pptx, pdf), not protected or plain add-on skills.
The store uses one private file on trusted owner storage, with an exclusive lock,
atomic replacement and file/directory sync. It is owner-only state, not a replicated
frontend cache; the host must authenticate and authorize callers before updates.
On first start, the default standalone --addons-role=combined instance imports
its sole effective host configuration automatically, including legacy runtime
settings. A fresh dedicated --addons-role=owner with no legacy host policy
starts with restrictive defaults. If that owner has non-default legacy policy,
startup requires explicit selection with --addons-migrate-host-settings
(or LOCALAI_ADDONS_MIGRATE_HOST_SETTINGS=true). This owner-only option selects
only that process’s effective configuration; it never selects, merges or imports
frontend copies. Review the owner configuration before enabling it. The option
is unnecessary after migration: an existing valid store remains authoritative.
Migration records private source/version provenance. Missing or ambiguous migration
input fails closed, and a corrupt existing file never triggers re-import or
defaults. Keep this state on trusted owner storage with working exclusive file
locks, atomic rename and file/directory sync; do not share it as a frontend cache
or run multiple owners against it. Existing singleton-owner deployment constraints
still apply.
Updates use an expected revision (compare-and-swap), presence-aware patches and an
operation ID. Omitted fields stay unchanged; explicit empty strings and false values
clear their fields, and a null provider entry deletes that pin. Stale revisions
conflict rather than overwrite another edit. A matching operation ID and body replay
the saved result; reusing a retained ID with a different body fails. The store keeps
at most 1,024 durable receipts and prunes the oldest revisions. A retry after its
receipt is pruned conflicts on its stale revision rather than applying again.
Acknowledgement follows durable persistence; uncertain durability requires reopening
and reconciling the operation before further use.
Host access in the UI
An administrator gives an add-on its host operations in the browser, at install and at upgrade. No file edit and no restart are needed. The policy file and flags still work. They are a floor that the UI shows and cannot change, and the deny rules of the file always win. Only the administrator’s own browser session can change host access. An API key, a tool call or an agent cannot grant, revoke, edit a deny rule or change the blanket switch. Each refusal of such a caller is written to the audit file with the kind of credential.
With sign-in off, UI grants are locked. Without sign-in every caller that reaches the port is the same local owner, and the checks that tell a person from a script are headers that the caller sets. So in that mode the UI cannot change host access by default: the policy file and flags still grant, attempts to change grants answer 403 locked_by_deployment, and the page and the install dialog show the operations read-only with the reason. To allow UI changes anyway, start with --addon-host-ui-grants-without-auth. The server then logs a warning, and anyone who can reach the port can grant host operations, set deny rules and turn the blanket switch on. Turn sign-in on instead when other people or programs can reach the server.
A reviewed library install can proceed under the lock if all required operations are already allowed. The UI cannot name operations to grant, and blanket approval does not apply. The only exception is the verified first-install network defaults of the official Sandbox when sign-in is off. A missing required grant disables installation in the preview (canInstall: false). At submit time, a lock refusal can include error.lockedReason (no_auth or deployment); a blocked_by_policy refusal can include error.operation naming the denied operation. File installs still require unlocked UI grants.
The owner never grants what the verified package does not declare. A grant is always the operations you approved, that the package declares, and that this LocalAI supports.
The install step
When the manifest of an add-on declares host operations, the install dialog shows a Host access step before Add to queue. It lists each operation with a short title, one sentence and a risk word (reads, changes data, network, runs jobs), grouped by family.
Required operations are on and cannot be turned off. The add-on does not run without them.
Optional operations are off. The add-on runs without them, with fewer features. Turn on the ones you want.
An operation that your policy blocks is greyed out and says “Blocked by the administrator policy”. If a required operation is blocked, the install button is disabled and the dialog says why. The owner refuses the same install.
An operation that the deployment already allows says so and needs no choice.
An operation that this LocalAI does not support says “Not supported by this LocalAI”.
For add-ons of the official library the required operations are already on and you still confirm the install. For an add-on of another library the warning below names the library it comes from.
Where the list comes from: when the library entry lists the host operations of its package (the hostOperations field of the index), the dialog shows that list at once, with no download. Otherwise the owner downloads and verifies the package to read its manifest, and the dialog says that it is checking the package. The library list is a hint and grants nothing. When the owner installs, it verifies the package and compares its manifest with the operations the dialog showed. If the manifest asks for an operation that was not in the list, the owner installs nothing, grants nothing and fails the install with approval_stale, so that you review it again. For a pinned entry the approval is also bound to the digest of the package; a development entry with a moving tag has no digest in the library, and its approval is bound to the operations you reviewed.
Add-ons from another library
An add-on runs as trusted code on this server, whatever library it comes from. The first step of the install dialog therefore shows a warning for every add-on that is not from the official library, whether or not it asks for host operations:
This add-on comes from library, not the official library. It runs as trusted code on this server and can use the credentials it is given. Install it only if you trust its author.
The same warning shows above the approval form of a held upgrade when the package is not from the official library. The dialog warns unless the library entry is marked official and the owner’s preview agrees (the preview also checks the signature). A host that sends no answer gets the warning. The Host access step does not repeat it.
An agent that installs an add-on through the dispatch route carries no approval. If the add-on needs a host operation that is not held, the owner answers approval_required.
Upgrades that ask for more
If a new version asks for a required operation that the add-on does not hold, the upgrade is held and the current version keeps running. The Installed tab shows a banner and a “Waiting for approval” label, and the Host access tab shows how many approvals wait. Select Review and approve to see what the new version adds, then Approve and upgrade. New optional operations never block an upgrade. They stay off, and the add-on runs without them. Automatic upgrades never approve anything. A version that asks for fewer operations does not remove any grant. The page lists the extra ones as “no longer requested” and you can turn them off.
The Host access page
The Host access tab of the Add-ons page (administrators only) shows, for each add-on, every operation it asks for and what it holds.
Each operation shows where its grant comes from: Deployment (policy file or flags, read-only), You (install, upgrade or edit) and Blanket (the switch below), with the date.
Turn an operation off to revoke it. The change applies to the next call at once. Calls that already run finish. If you turn off an operation that the add-on requires, the page says that the add-on stops, and asks first.
Revoke all removes everything that you or the blanket switch granted. Keep as my own turns blanket grants into explicit ones, so revoking the blanket grants later does not remove them.
A grant that was made for a different package under the same name has no effect. The page marks it and offers to remove it.
Never allow lists deny rules. Rules of the policy file or flags are locked. Rules made here can be removed. Before a new rule is saved, the page shows which add-ons lose which operations and which will stop. A rule can name one add-on or all add-ons, an operation, a family that ends with a dot, or *.
If the deployment sets --addon-host-ui-grants=false, or sign-in is off and --addon-host-ui-grants-without-auth is not set, the page is read-only and says why.
A grant is tied to the add-on ID and to the library and signer the package came from. An install or upgrade that resolves to another library or signer is held until you approve it in the browser, like an upgrade that asks for more. The old version keeps running. When an uninstall cannot delete the grants of the add-on, it fails and the add-on stays installed.
Each change is written to the audit file before it is applied. If the audit file cannot be written, the change is refused with 503 and nothing changes.
Blanket approval
The switch Approve everything an add-on asks for is off by default. When it is on, an add-on that you install or upgrade gets the host operations that its manifest declares as required, without the install step. The scope is Official library or Any library. You can also include optional operations, and you can apply the switch to add-ons that are already installed. It never grants an operation that the manifest does not declare, and it never overrides a deny rule. It never grants a privileged operation.
To turn it on you type a sentence that matches the scope. The dialog states the risk first. For Any library, every entry of every library that you configured receives the operations its manifest declares, so a malicious or compromised entry gets them at once. A deployment can set the switch with --addon-host-blanket. The page then shows it read-only.
When you turn the switch off, the grants that it made stay and stay marked Blanket, so nothing stops by surprise. The page offers Revoke all blanket grants, and the dialog can revoke them as it turns the switch off.
Administrator host operation policy
--addon-host-policy (environment: LOCALAI_ADDON_HOST_POLICY) selects an
administrator-controlled JSON file. Use an absolute path to a readable regular
file, at most 64 KiB. LocalAI reads it once at startup; changes require a restart.
There is no implicit search, remote download, or manifest-selected policy path.
Keep the file outside addon-writable directories. The deployment administrator
must protect its ownership and mount permissions. A symlink to a regular file is
accepted; path validation does not prove that the file is administrator-owned.
local-ai run --addon-host-policy=/etc/localai/addon-host-policy.json
# Equivalent selection:LOCALAI_ADDON_HOST_POLICY=/etc/localai/addon-host-policy.json local-ai run
# Explicitly grant nothing from the file (its deny rules, if any, still apply):local-ai run --addon-host-ops=# Disable policy selection inherited from the environment:local-ai run --addon-host-policy=
The file requires schemaVersion. Version 1 also requires grants (an object)
and has no deny. Version 2 adds an optional deny object and makes grants
optional, so a file that only denies is valid. Keys are case-sensitive. Unknown
fields, duplicate keys, duplicate entries, malformed JSON and trailing data are
errors. An empty grants object is valid.
The limits are 128 addon IDs and 32 prefixes (or deny entries) per addon. IDs use
lowercase ASCII letters, digits and hyphens and start with a letter or digit.
Grant prefixes use the same grammar as --addon-host-ops: lowercase ASCII letter
segments, each ending in a dot, such as workspace. or workspace.files.. They
are not regular expressions or exact operation names. The broker must still
register an operation before any prefix can authorize it.
Field
Version
Meaning
schemaVersion
1, 2
Integer 1 or 2. A larger number stops startup with policy requires a newer LocalAI.
grants
1 (required), 2 (optional)
Addon ID to list of operation prefixes.
deny
2
Addon ID, or "*" for every addon, to a list of deny entries.
Keep the file at schemaVersion1 until you need a deny rule. A LocalAI binary
that predates version 2 refuses a version 2 file and does not start. That is
intended: an older binary must never start and silently drop a deny rule.
Remove the deny object and set the version back to 1 before you run an older
binary.
Deny rules
A deny rule forbids host operations for good, whatever grants them: the policy
file, --addon-host-ops, a grant that an administrator makes in the UI, or the
blanket approval. Deny always wins. A deny entry is one of:
a prefix such as egress., which names every operation that starts with it;
an exact operation name such as workspace.admin;
the single token "*", which names every operation. It must be the only entry
of its list.
The key "*" applies a rule to every addon. It cannot be an addon ID.
--addon-host-deny (environment: LOCALAI_ADDON_HOST_DENY) gives the same rules
as a comma list of addon-id=entry pairs, and *=entry for every addon:
local-ai run --addon-host-deny='*=connector.,web=workspace.admin,telegram=*'
The deny rules of the file and of the flag are added together. They are read once
at startup, so a change needs a restart. A deny rule that an administrator adds
in the UI applies at once and can be removed in the UI. A rule from the file or
the flag cannot be removed from a browser. An install or upgrade that needs a
denied operation is refused.
Selection uses presence, not string length:
An explicit --addon-host-ops wins, including an empty value.
Otherwise, an explicitly set LOCALAI_ADDON_HOST_OPS wins, including empty.
Otherwise, the selected policy supplies the complete grant map.
The generic configuration resolver grants nothing when unconfigured.
Overrides replace the grants of the file; they never merge with them. The
selected file is always opened, even when a flat list replaces its grants,
because it may hold deny rules and a deny must not disappear when someone adds a
flag. LocalAI then logs grants ignored, deny applied. A file at schemaVersion1 has no deny rules, so a deployment that sets both a v1 file and a flat list
sees no change except that the file must now be valid. An invalid selected file
stops startup. An explicitly empty --addon-host-policy disables an environment
policy and supplies no grants. Startup logs report the source and counts, not
file contents. Manifests, addon requests and libraries cannot grant host
operations. In split deployments, the owner enforces authority; frontend settings
cannot add grants. Programmatic WithAddonHostOps, including an empty map, is an
exact startup decision and takes a copy of the supplied map and prefix slices.
Grants that an administrator makes in the UI add to the file and flag grants.
The effective set of an addon is the grants of the file and flags, plus the grants
of the UI, plus blanket grants, minus every deny rule. The file and flags stay a
read-only floor in the UI.
Setting
Environment
Effect
--addon-host-deny
LOCALAI_ADDON_HOST_DENY
Deny rules, added to those of the file.
--addon-host-ui-grants=false
LOCALAI_ADDON_HOST_UI_GRANTS
Makes the UI grant store read-only, so the file and flags are the only source of grants. On by default.
--addon-host-ui-grants-without-auth
LOCALAI_ADDON_HOST_UI_GRANTS_WITHOUT_AUTH
Lets the UI change host grants although sign-in is off. Off by default: with sign-in off the UI grants are locked, because anyone who can reach the port could change them. Logs a warning when set.
--addon-host-blanket=off|official|any
LOCALAI_ADDON_HOST_BLANKET
Fixes the blanket approval mode. The UI then shows it as set by the deployment. Unset leaves the choice to the administrator. The deployment value is applied when it is read and is never copied into host-grants.json: remove the flag and the switch returns to what an administrator set in the UI.
Privileged operations
Some operations control the instance itself. Their names start with system.,
models.recommend, models.install, models.status, backends.,
settings.updates., credentials., branding. or setup.. This version
registers only the
registry credential operations.
The rules for their grants apply to all these names, and so do the rules for
calls without a user.
Policy file and flags. A grant counts only while the package that runs is
the one that the preinstall file
names for that add-on ID: the same library ID, library URL and channel, a
verified signature, and the same exact signer identity and issuer. Without a
preinstall entry the grant gives nothing. An add-on of the same ID from a file,
another library or another signer gets nothing. A library whose signer is a
pattern cannot match. The preinstall file works on a single node only, so
in distributed mode the policy file grants no privileged operation.
Administrator. A grant counts only when an administrator made it at
install, at upgrade or on the Host access page. Blanket approval and
first-install defaults never make one. While UI grants are locked, stored ones
do not count either.
What an approval is for. A privileged grant of an administrator, and the
credential hosts approved with it, belong to one grant key. For a signed
package the key is the library ID, the library URL and the whole signer
policy that was verified (issuer, identity or pattern, source repository), so
later versions keep the grant. The official library keeps one key across
LocalAI releases. An unsigned package has no signer, so its key is its
digest: every new file needs a new approval of these powers.
Another key. A package with another key does not get the stored grant. The
install or upgrade review lists the operation as not allowed, and you can
leave it off. If the add-on holds such a grant, a replacement with another key
waits for a review, also when nothing new is asked. If an approved upgrade
fails, the earlier package keeps its grant. If you later restore an earlier
package of another key, approve the operation again.
Older grants. A stored grant without a key gives no privileged operation.
Library preview. When a library lists a privileged operation for a package,
LocalAI downloads and verifies the package before it shows the host access.
Deny rules win over all of these.
Breaking upgrade change: standalone and custom deployments
The generic binary no longer grants host operations by default. Upgrading
an unconfigured standalone or custom deployment removes the former implicit
grants, even when official addons are already installed. Those addons can lose
host-backed functionality. Startup warns about unconfigured grants even before
any addon is installed. LocalAI does not infer consent from installed addons,
write migration grants into addon storage, or automatically restore old grants.
Existing explicit flag or environment settings keep their effective grants,
including explicitly empty settings. An override replaces the grants of the
file; it never unions with them. A missing or invalid selected file fails startup.
To retain the former grants, review deploy/addons/host-policy.json from your
trusted LocalAI release, then install and explicitly select it:
sudo install -d -m 0755 /etc/localai/addons
sudo install -o root -g root -m 0644 deploy/addons/host-policy.json /etc/localai/addons/host-policy.json
local-ai run --addon-host-policy=/etc/localai/addons/host-policy.json
# Or configure this environment variable in your service, then restart:# LOCALAI_ADDON_HOST_POLICY=/etc/localai/addons/host-policy.json
The exact former explicit setting remains valid:
local-ai run --addon-host-ops='fine-tuning=finetune.,quantization=quantize.,sandbox=workspace.,sandbox=egress.,office=workspace.,web=workspace.,telegram=connector.'
The reviewed deployment file contains exactly:
Addon ID
Prefix grants
fine-tuning
finetune.
quantization
quantize.
sandbox
workspace., egress.
office
workspace.
web
workspace.
telegram
connector.
This file is host-owned deployment policy, not authority supplied by a manifest
or catalog. Grants trust addon identity, not a verified signature or provenance.
Installing different code under a granted ID gives that code the selected grants,
except privileged operations.
Protect the file against writes by addons and untrusted users. Review and reduce
the grants if you do not intend to trust every listed ID.
Maintained launcher selection
The stock Docker runtime copies the reviewed file to
/etc/localai/addons/host-policy.json and explicitly selects that path through
LOCALAI_ADDON_HOST_POLICY. No executable-relative or working-directory search
is involved. --addon-host-ops= overrides this selection with zero grants.
--addon-host-policy= disables the image’s policy selection and gives zero
grants unless an explicit host-operations override is present.
Inherit the stock runtime image selection; custom images must select their own policy. Only the addon owner enforces grants in split mode.
website/static/install/kubernetes.yaml
Inherits the stock image selection. A custom image must ship/select policy or mount an administrator file and select its absolute path.
External Helm chart referenced by the Kubernetes guide
Not shipped here. Check the selected image and chart environment; custom images are unconfigured unless the operator selects policy.
.devcontainer/docker-compose-devcontainer.yml
Uses the development target, not the stock runtime stage. A manually launched binary is unconfigured.
Release binaries, website/static/install.sh, the desktop launcher packages (launcher/)
Unconfigured standalone behavior. Operators must explicitly select policy or host operations; packaging does not migrate consent.
Custom systemd services
No maintained unit ships in this tree. Set LOCALAI_ADDON_HOST_POLICY or explicit host operations in the unit, protect the file, and restart.
docs/docker-compose.yaml
Documentation-site server only; it does not launch LocalAI.
These non-stock launchers do not promise the former implicit grants. Automatic
policy installation or selection for them is deferred; use the explicit upgrade
procedure above. Merely copying a file without selecting it does not grant
anything. Do not fetch host policy from an addon library.
Owner-resolved execution observations
The owner resolves execution-status bindings from an authenticated actor and a
conversation ID. Callers cannot choose the provider, tools, runtime incarnation,
agent grants, or consent. The resolver uses the chat’s current add-on switches,
agent grants, provider pins, and installed-provider ordering. An installed but
idle pinned provider does not fall through to another add-on.
Execution observations read the same current owner policy as normal execution,
not frontend-local provider pins. Owner policy outages fail closed; a CAS pin
change invalidates a binding whose current selection no longer matches.
The binding path uses existing principal-scoped chat and agent reads on the
owner, supporting JSON and SQL/GORM stores. Named actors use their account ID;
the local owner uses the anonymous chat principal. Current account status,
feature permissions and credentials are checked through normal authorization.
The owner must have these stores; frontend tool lists are never authority.
The status gateway re-resolves current authorization and selection before
dispatch and before publishing positive facts, and compares the exact generation,
runtime incarnation and tools. A changed current selection withdraws old facts;
a fresh request can succeed after access is restored. This is current-read
consistency, not a historical revoke-and-restore (ABA) guarantee or a database
transaction spanning the read. The host compares
current selection identity only; it is not a durable revision or owner nonce.
A binding does not authorize command execution, grant access or replace consent.
Request/session integration shares observations only within a bounded request.
Execution safety notices
The Sandbox document skills (docx, xlsx, pdf, pptx) are offered only
while the Sandbox reports an isolated backend. When it runs the chat’s commands
and is not known to be isolated, the skill list and load_skill say so, with the
reason the status is unknown, instead of saying the chat has no skills.
The chat Tools menu and command chip describe the actual selected execution
provider, not an installed app’s name. Any provider that reports host execution
gets a no-isolation warning. Unknown readiness or isolation gets an explicit
warning, not an isolated or safe badge. A status read does not grant execution
permission or replace the built-in host command consent flow.
Provider explanations are bounded plain text. Dismissing a notice applies only
to that mounted chat context and exact provider binding, including generation,
incarnation, readiness and isolation. Loading, switching providers,
changing isolation, changing actors or logging out resets the dismissal.
Actor or authentication-session changes also invalidate pending status reads
before the next effect runs; logging in as the same user starts a new epoch.
Built-in command execution, including fallback from an unavailable provider,
shows the generic host warning without Sandbox installation or repair advice.
This warning does not change command consent or administrator settings.
The network panel retains the configured policy when the backend cannot verify
its enforcement. It explicitly says that the policy does not apply to commands.
Provider-reported isolation alone does not establish network enforcement.
Missing current authorization, selection or runtime context yields unknown;
installing an app does not confer authority or prove network enforcement.
The chat /about card reports isolation from the selected command provider.
When the provider status is missing or unknown, the card does not claim isolation.
After an authentication refresh or account change, pending Apps reads and action
results cannot populate the new session. The server still authorizes every action.
Model destinations (contract and backend metadata)
An installed addon can declare optional capabilities.ui.modelActions:
Each entry requires an existing non-native model capability and a declared UI
page. The optional relative suffix must stay beneath that page. One entry per
capability is allowed within an addon, with at most 27 entries. Native chat and
completion cannot be shadowed; aggregate FLAG_LLM and FLAG_ANY are excluded.
The remaining concrete host model flags form the vocabulary, guarded by parity
tests. No labels, priorities, permissions, URLs or query templates are accepted.
The combined page/suffix follows SDK routing bounds: at most 256 ASCII characters
and eight segments, each 1–64 characters from [A-Za-z0-9._~-]; . and ..
segments are forbidden. Absolute paths, empty suffixes, percent escapes, queries,
fragments, unknown keys, duplicate keys and noncanonical keys are rejected.
Installed Apps metadata preserves these typed declarations and existing
unavailable-UI omission; it does not discover or promote catalog entries.
Studio declares its existing image, video, speech and sound tabs. Talk declares
its transcription landing page, Face face recognition and Voice speaker
recognition. Talk currently has no selected-model query semantics; its landing
behavior is unchanged. This backend milestone does not yet alter model Open
dispatch or remove historical frontend routes.
Look up the optional typed extensions that an add-on manifest can declare. This page is part of the Add-on contract reference.
Optional typed manifest extensions
These declarations extend the strict manifest contract. They keep
schemaVersion: 1, host/protocol/data-format level 1 and UI SDK 2. The manifest
api range is exactly 2 ("api": {"min": 2, "max": 2}). A manifest with another range, or with none, is refused at install.
The Go contract parser is authoritative; there is no separate JSON Schema.
The fragments below merge into an otherwise valid manifest, not a complete
installable package. The executable, identity, compatibility and UI
entry/SDK fields remain required.
homeCommands is opt-in and has at most 8 records. Each has a unique id
accepted by contract.ValidName. Optional alias uses the same lower-case,
slash-free identifier syntax; it requests convenience naming, not ownership.
Optional page must belong to pages, even if not in navigation. Omission
uses a nonempty, declared mainPage, never the first page or an external URL.
Optional label is a Localized string or language map (not a default
wrapper), with at most 60 Unicode characters per label and the existing
plain-text and language rules. Omission selects the installed localized title
and, for a non-main destination, the page identifier. Optional icon is an
allowlisted semantic host icon or exactly the packaged ui.icon; omission
selects the installed app icon, then puzzle. Omit unused overrides rather
than sending empty strings or null. No tool, URL, command text, install action
or component can be a command destination.
Home commands from installed apps
Home reads only the authenticated installed Apps registry, never the catalog.
A contribution is actionable only while its app is enabled, running, compatible
with the host SDK, and has validated immutable assets and a declared destination.
Loading, list errors, forbidden access, absence, disabled installations and failed
installations remain distinct; a list error does not mean “not installed”.
Mounted consumers keep bounded polling alive after disable or failure so recovery
appears without reloading. Drawing commands does not load addon JavaScript.
Every eligible contribution has /addon:<addonId>:<commandId>. Optional aliases
cannot take any native command name, even a hidden native command, or any usable
skill name. If multiple contributions request the same alias, all lose that alias;
the canonical commands remain. Order is addon ID then contribution ID in the Apps
group. Home shows deterministic, actor-visible alias diagnostics to administrators
in its expandable command diagnostics section. Labels do not identify commands.
Clicking a command or submitting its exact text uses the same navigation guard.
Commands accept no arguments and do not execute prefixes. The guard re-reads the
authenticated installed registry and checks actor, permissions, generation,
immutable entry and declared page before navigating. Disabled, failed, upgraded,
removed or inaccessible apps cannot be opened by a previously captured menu entry.
Logout aborts pending reads; even a response that ignores cancellation cannot
publish into another actor’s registry. Installed commands are Home-only; /apps
remains generic native navigation to installed apps. Uninstalled apps never get
install commands or promotional examples. Studio owns its /studio alias in its
manifest rather than in Home code. Historical URL redirects and pin migration
remain unchanged.
tools contains 1–8 unique declared action tools with executable definitions.
The current chat binding requires each bound tool to shadow bash through
shadows; existing shadow validation still applies, including its uniqueness
rule. This declaration neither grants shadow authority nor changes provider
arbitration or execution authorization.
jobs is optional, feature level 6: {"jobs": {"tool": "job"}} names the
tool that runs the background jobs of the host’s job tool. It is a declared
kind: "action", uiOnly: true tool that shadows nothing, is not an admin tool
and is neither a bound execution tool nor the status tool. It is the only
page-only tool that may be an action tool. No model is offered it and no page
can call it: the host calls it through the act path, with the chat as the
resource and the person as the actor, and with the arguments and answer below.
A provider without jobs cannot run background jobs. The host then answers
job start with “The add-on here cannot run background jobs: it is
older than this LocalAI. An administrator can update it.” and does not run the
job anywhere else. A manifest with jobs and a lower featureLevel is
refused; an older host refuses the add-on with “needs a newer LocalAI”.
The arguments of the jobs tool are contract.JobArgs: verb (start,
list, read, input or kill; the key is verb because action is a name
no tool schema may use), id (job- and six base32 characters), command and
label (start; the label is one line of at most 80 characters), since (an
absolute byte offset; omitted, the read goes on where the model’s last read
ended), maxBytes (256 to 65536, default 16384), observe (a read that does
not move the model’s cursor and carries the last 2000 bytes as tail: the
check of a wait), input (at most 2000 bytes) and closeInput, and for a kill
signal (term, the default, int or kill) and reason. reason is why
the host ends the job: stopped (the person’s Stop), chat_deleted,
agent_ended, shell_off, group_off or fenced. The add-on records it as
the job’s end (stopped with the state killed, the others exited);
without it the end is killed. The host’s execution call options are
added as for bash. The answer is contract.JobReply: ok, job or jobs
(id, label, state, end, exit, started, ended, lastOutput,
total, idleMs; never the command), and for a read output, from and
next. A refusal is ok: false with code (unknown, ended, limit,
busy, invalid, failed) and an error the model reads. The host checks
every answer against its arguments (sizes, offsets, states, job IDs) and shows
nothing of one that fails, and a job of another person or chat is unknown.
While the add-on reports a started job as running, the owner keeps the
start’s request live as a job lease, so the job’s final checkpoint
(workspace.commit, workspace.changes) and its network checks (egress.check,
egress.audit) still find a live request after the call returned. The lease
has the actor, scope, resource and chat of the start. It ends when an answer of
the jobs tool reports the job finished, two hours and five minutes after the
start, or when the add-on process stops. A kill does not end the lease: the
job’s final checkpoint runs after the kill. The host asks the jobs tool every
30 seconds while a chat it follows has a running job, so a finished job’s lease
ends soon after the job. Under a lease the channel allows only those four
operations, and an add-on holds at most 64 leases. The owner takes the place
of a lease before it sends a start; with every place taken or held by a start
in flight, it does not send the start and answers it as a refusal with the code
limit. The in-flight
table, and so the lease, lives in the owner process, where every act of a
frontend is forwarded.
statusTool is a separately declared kind: "read", uiOnly: true tool,
not an execution binding or admin tool. Its input schema is an object accepting
{}, with no required inputs, no resource, and additionalProperties: false.
It must answer without mutation. An owner-side typed read must invoke it;
the model-facing tool adapter intentionally excludes uiOnly tools.
The existing result envelope carries this JSON in payload:
{"readiness":"available","isolation":"isolated","explanation":"Commands use the configured isolated backend.","networkPolicyEnforced":true}
networkPolicyEnforced is optional and false when absent. A provider sets it to
true only when every network connection of its commands goes through the host’s
network policy (the Sandbox does, through its proxy). The host honors it only
for a status that is available and isolated; it then shows the chat’s
Network row. Without the report the chat says that network-policy enforcement is
not verified for the provider.
contract.DecodeExecutionStatus accepts at most 2048 UTF-8 bytes. Both enums
are required: readiness is available, unavailable or unknown; isolation
is isolated, host or unknown. Optional explanation is nonempty plain text,
at most 200 Unicode characters, without markup, controls or direction overrides.
Unknown or duplicate fields, trailing JSON, outputs, private ok fields,
backend names and warning booleans are not accepted. Invalid payloads return
an error and unknown/unknown, never partial provider data. Non-available
readiness normalizes isolation to unknown. Status describes only the bound
tools of that addon incarnation; it is not a host isolation guarantee.
Studio consumes this declaration through the owner-selected conversation binding,
not an addon ID or a private settings payload. Prompt construction, command
status and nested egress reads share one observation within a turn. Priming and
standalone command-status or egress requests have separate, bounded scopes.
Consumer cancellation stops that wait; turn completion cancels the observation.
A failed read settles as unknown with a reason (unknown_reason: owner_unreachable, not_reported, stale, invalid_status, not_selected, no_answer, reported_unknown or draft, for a chat that is not created yet), which the Tools menu shows. It is not retried at once. After a failure that a restart of the add-on owner can cause (owner_unreachable, no_answer, stale), a scope that is still open (a long turn) binds and reads again, at most once every five seconds. A refusal of the binding or of the payload is not retried. Each
consumption revalidates the complete owner binding, including conversation,
current selection identity and runtime incarnation.
The application resolver reads the current principal-scoped chat and agent from
JSON or SQL/GORM stores and revalidates current account credentials in named-user
mode. Local-owner mode maps to the anonymous chat principal. Reads are advisory,
not transactional snapshots: revoke-and-restore changes between reads are not
remembered. Ordinary execution authority and consent remain unchanged. An undeclared
legacy provider does not acquire an isolation claim. Sandbox retains its existing
private Settings status response and separately declares the typed page-only
execution-status read. Unknown backends report unknown, never inferred isolation.
Provider-reported isolation and a declared network control do not establish
host network-policy enforcement. The egress API therefore does not claim policy
applicability for addon command runners until the host can prove enforcement.
Built-in or explicitly host execution continues to report the host-execution
reason. Controls can still identify the addon that draws its settings row.
The Apps tab binds each list request and registry ingestion to the authenticated
session epoch. A same-user refresh or account switch immediately hides the old
list and rejects its pending responses, even before effect cleanup. A new list
request can populate the refreshed session. These in-memory scopes contain no
credentials.
Execution descriptor of a commands tool
On the definition of a tool that shadows bash:
{"name":"bash","kind":"action","shadows":"bash","description":"...","inputSchema":{"...":"..."},"execution":{"class":"commands","title":"Runbox","note":"The environment has python3, jq and sqlite3.","skills":{"providesRuntimeFor":["documents"]}}}
The descriptor says what the add-on is, so that the host can write about it
without knowing its ID. It grants no authority. Whether commands are ready and
isolated stays what the provider reports in its execution status (see above);
the host decides from that report.
Field
Meaning
class
Required. commands: the tool runs shell commands and code.
title
Optional, at most 40 characters of plain text. The host calls the provider by this name in the prompt and in the Tools menu text (“Runbox runs commands in an isolated environment”, “switch the Runbox add-on on”). Without it, the host uses the add-on’s own title.
note
Optional, at most 600 characters of plain text. One sentence for the model, such as the programs the environment has. The host adds it to the Commands block only while the provider reports isolated.
skills.providesRuntimeFor
Optional list of skill kinds. documents means the add-on’s document skills (xlsx, docx, pptx, pdf) run on this provider.
The host offers the document skills of an add-on only while that add-on serves
the chat’s commands and its status reports isolated. When the status is
host or unknown, or another provider serves the commands, the skills are left
out and the chat says why. A tool descriptor may leave providesRuntimeFor
out to opt out of that check, because its skills do not need its commands.
The field is optional and does not change the protocol. An add-on
whose commands tool declares no descriptor still works: the host treats it
as a provider of commands under the add-on’s own title, with no note, and keeps
the isolation check for its document skills. The host never compares the add-on
ID with a fixed name for any of this, so a second add-on that runs commands gets
the same behavior with its own title.
The same holds for the rest of the interface. Settings, the Tools menu, the
network card of a chat and the model prompt describe the provider by its
declared title, or by generic words (“the add-on that runs commands”) when none
is installed. Core text never names a shipped add-on, so the title you declare
is the only name your users see for it. A test reads addons/*/manifest.json
and fails when a locale string, a Settings label or a Go string of core names an
add-on that provides a role.
The declaration says that the add-on runs commands behind a proxy that asks the
host about each connection. The host attaches the network-policy control to
it, and writes about the network from it, without knowing the add-on ID. It
grants no authority: the host enforces the administrator’s limit and the chat’s
rules, and it answers egress.check only for an add-on whose host setting
grants that operation. The tool that runs commands does not have to shadow
bash for the control to attach.
Field
Meaning
exactDestinations
Optional boolean, default false. The proxy supports exact destination grants. The apps list exposes this as network.exactDestinations; declaring it grants nothing. The operator must grant the authenticated add-on ID each DNS host and TCP port in chats_egress_allowed_destinations.
kind
Required. egress-check: the add-on’s proxy calls the host operation egress.check for each connection, and the add-on blocks what the host refuses. The manifest must list egress.check in hostOperations.
title
Optional, at most 40 characters of plain text. The host names the network by it in the text the model reads (“The server’s setting for the Runbox network”) and in the network object of the API. Without it, the host uses the title of the commands tool, then the add-on’s own title.
presets
Optional, at most three entries of id (off, registries or all, no repeats) and title (at most 40 characters). The chat Tools menu and the network cards show these titles for the host’s presets (here “Closed” for off and “Open web” for all). A preset you leave out keeps the host’s title.
The apps list and the chat’s network view carry the result in a network
object (title and presets). The settings keys do not change. The host keeps
the names chats_egress_ceiling, chats_egress_default, chats_egress_ports,
chats_egress_extra_registries, chats_egress_allowed_hosts,
chats_egress_allow_private and chats_egress_audit_days, with the values
and the API they have today, so a running instance needs no migration. They are
host settings, not settings of one add-on. The setting chats_host_exec, which
lets the host run commands when no add-on provides bash, is also a host
setting and names no add-on.
The host attaches the control to an add-on that asks for network-policy in
ui.controls, declares network and is granted egress.check. A manifest
that declares no network gets no network control, whatever tools it replaces.
The field does not change the protocol.
Each name must pass contract.ValidHostOp exactly: no wildcard or prefix grant.
There are at most 32 entries total, unique across both lists. An empty object
is invalid. Omission preserves legacy/unspecified requests, not an empty grant
and not a request for every operation. Required operations declare service
prerequisites; optional denials must support degraded operation. Unknown but
syntactically valid names are unsupported, never grants by inference. Requests
do not create host endpoints or change administrator-controlled grants.
Official operation audit
The official manifests request the operations their production hostclient calls use.
Deployment prefixes in deploy/addons/host-policy.json remain separate administrator grants.
The generic binary selects no policy automatically.
Fine-tuning and Quantization include operation names passed through mutation and undo wrappers.
They do not request the host’s unused progress operations.
The finetune.start and quantize.start operations take an optional backend.
The host accepts only an installed backend whose gallery entry carries the tag of the operation (fine-tuning or quantization).
When the call names no backend, the host uses the first installed backend of that tag in gallery order.
A new engine needs only a gallery entry with the tag. With no engine installed, the call fails with a 400 that says so.
Telegram’s historical connector. deployment grant does not imply a hostclient call or manufacture a manifest request.
Sandbox’s proxy uses the optional egress operations when configured connections need policy decisions.
Missing grants do not authorize connections; the proxy cannot obtain an allow verdict.
Sandbox’s settings, Web’s provider settings, the limits of the Home Assistant add-on and the per-device switches of the PiKVM add-on use workspace.admin to check administrators.
Without that optional operation, these settings refuse changes; ordinary tools can remain available.
The shipped deployment policy covers every official required operation.
The package tests compare all twelve manifests with this source audit and the host’s registered vocabulary.
Their package-builder fixtures use temporary executable and UI bytes, not official release binaries or frontend build artifacts.
Release packaging
Every package declares manifest api 2, which is the only version the host
speaks. Catalog version ranges do not negotiate individual fields and cannot
guarantee eligibility before staging. These declarations alone do not install
packages, grant operations or activate runtime/UI integrations.
Resource listing
An add-on that keeps resources can ask the host for a read tool that lists the
resources the caller may use, so a model finds the resourceId that its other
tools take. The add-on writes no code for it: the host builds the tool from its
own record of the grants.
list.tool is the tool name. The model sees it as addon__<id>__<tool>. It
must not be the name of a tool, an admin tool or a tool definition of the
manifest; the host refuses such a manifest.
list.items is the key of the result array. It defaults to resources.
agentScoped: true (feature level 2) lets a saved agent name the resources it may
use. It needs a list, because the host builds the choices from it. See
Resource listing for agents.
The manifest api range must reach 2. A manifest that declares a listing with
api.max 1 is refused.
The tool is a read tool that takes exactly {}. The result lists at most 100
entries, ordered by resource ID, with resourceId, an optional name and the
caller’s role. truncated is true when the list is incomplete. There is no
pagination.
The tool is offered only to actor-bound consumers, only while the add-on is
enabled and running, and only for resources the caller owns or that were shared
with the caller. Existing chat opt-ins, hidden add-ons and allowlists apply.
An add-on that declares no list gets no listing tool, whatever else it
declares.
Credentials and a resource list
An add-on whose tools call a service with a secret of the person, such as an
access token, can ask the host to keep the secret and to check which resources
a call may reach. The model never sees or sets either.
The secret and the list live in the person’s binding of the add-on’s
connector kind. The host seals the secret. The list is Binding.Resources: at
most 50 entries, each an external name (owner/name for a repository) with a
host ID made from its hash. The person edits it where they edit the binding.
resourceArgument names a string argument that carries the external name. A
tool that declares it must require it, unless the slot sets resourceOptional. Before the add-on is called, the host
matches the argument against the list of the one binding that the call
names, without regard to case. A name that is not on that list is refused with
the code resource_not_allowed and the names of that list; the add-on is not
called. The host never picks a binding: a chat uses the connections that the
person or the saved agent enabled for it (or the person’s only one). When two or
more are enabled, the host adds a required connection argument to every tool
of the add-on in the definitions it gives the model, an enum of the names of the
enabled connections, checks the name against that set and removes the argument
before the call. The add-on’s manifest and tools do not change and must not use
an argument of that name (a tool that does is not offered when a chat enables
two or more connections). A call with no usable connection is refused with the
code select_connection. The result of a call and the card of a proposal say
which connection acted, for example “as Work, repository acme/widgets”; a
proposal is applied with the binding it was previewed with. The word for the
resource in these lines is resourceLabel, and the host takes nothing else
about the add-on from its identity: any add-on that declares a credential
behaves the same way.
resourceLabel is optional (at most 24 characters of plain text): the word for
the resource in that line. Without it the host says “resource”.
resourceOptional (default false) lets a call leave the resource argument out.
The tools then declare the argument and do not require it. The host uses the one
resource that the selected binding lists, so the connection is the only source
of the target and the model never has to write it. A binding that lists several
resources refuses the call with resource_not_allowed and names them. A call
that names a resource is held to the list as before. An add-on that does not set
it is not changed.
A call that passes the check carries Request.Credential (the secret),
Request.ResourceKey (the name as the person wrote it) and Request.ResourceID
(the host ID). The host drops these three fields from any request a client
sends. A person with no binding gets the code no_credential.
Request.GrantedScopes is dropped the same way.
A manifest with credentials must accept api 2, declare a connector kind and
declare read tools only: a change under a credential needs a write mode, which
this version does not have. Tools of such an add-on name no resourceId.
A tool with uiOnly: true (see the uiOnly field of a tool definition) gets no credential and no resource, even in an add-on that declares a slot. It is for the add-on’s own page, which has no chat to name a connection, so it works with no connection or with several. The Home Assistant add-on keeps the limits for all its connections this way.
The secret is an opaque string of at most 16384 bytes (16 KiB), and the host never reads
it. An add-on whose service needs more than a token (servers, a login and a
password) can seal a small versioned JSON record as the secret and keep only
the resource name in the list, as the Mail add-on does (see
Mail). The host cannot show a
sealed record back, so the add-on’s page asks for all of it again when a person
changes any part. A service that is not HTTP and is not reached through the
sandbox network check must apply the address guard of pkg/web/safehttp itself.
An add-on that is rate limited returns contract.ErrRateLimited{RetryAfter}.
The runtime answers HTTP 429 with Retry-After; the model gets the code
rate_limited, retryAfter in seconds and a note not to retry before then.
OAuth 2.0 credentials
A credential slot of kind oauth2 says that the host logs the person in to the
service with the OAuth 2.0 authorization code flow. The slot carries an oauth
descriptor, which is required for this kind and refused for kind token. The
add-on never sees the client secret, the authorization code or a refresh token;
it only gets a short-lived access token in Request.Credential, like any other
credential.
authorizeUrl and tokenUrl are required; revokeUrl is optional. Each URL
uses https, has no user info, query or fragment, uses no IP address and
uses port 443 or none.
hosts has one to four patterns. A pattern is an exact lower-case DNS name
of two or more labels, or *. followed by such a name; a wildcard matches
exactly one label. Every URL must match one pattern. A browser reads some
names as an address of this machine, so the host refuses them: a label that
is a number (2130706433, 127.1, 0177.0.0.01) or a hex number
(0x7f000001, 0x7f.0x0.0x0.0x1), a top-level label that is not letters or
punycode (xn--...), localhost and any name under it, and a trailing dot.
scopes.required and scopes.optional have at most 16 scopes each, no scope
in both, and no repeat. A scope is an RFC 6749 scope token of at most 128
bytes.
pkce must be S256.
clientAuth is how the host authenticates at the token endpoint: basic,
post, or none for a public client that uses PKCE alone.
authorizeParams has at most four {name, value} pairs of extra authorize
parameters. The names come from a closed registry: prompt, audience and
resource (a value of 1 to 128 characters from A-Z a-z 0-9 . _ : / -),
access_type (only offline) and include_granted_scopes (only true).
Names that the host sets itself, such as client_id, redirect_uri,
scope, state and code_challenge, are always refused.
The manifest parser is strict: an unknown field is refused.
The descriptor is data. It adds no route and makes no network call, and it
carries no authority. The host works out a SHA-256 digest of its canonical form,
which does not depend on field order, on the order of the host, scope and
parameter lists, or on whitespace. An administrator approves the add-on for
that digest, and a change of the descriptor, for example in an upgrade, voids
the approval.
An upgrade that changes the descriptor does not log people out. Their logins
keep their tokens but are held: the host neither uses nor refreshes them, and
the connections show needs_approval, until an administrator approves the new
descriptor. The approval then moves each held login to the new descriptor when
it sends the refresh token to the same tokenUrl and revokeUrl as before,
and the login works again without a reconnect. When either endpoint changed,
the host never sends the refresh token there: the login ends with the reason
endpoint_changed and the person connects again. A login that lacks a scope
the new descriptor requires ends with scopes_missing, and the scopes the new
descriptor no longer names are dropped.
A new login keeps only the scopes the descriptor names, required or optional,
even when the service grants more (incremental authorization). A login that
lacks a required scope fails with scopes_missing.
The apps list (GET /api/addons/apps) gives an add-on with an oauth2 slot an
oauth object with requiredScopes and optionalScopes, so the Connections
page can offer the optional scopes when a person connects, and the add-on’s
Settings tab shows the administrator the form that approves the login. For an
administrator, its admin object also has sourceId and official (the
official library, with the signature checked); the form shows the
untrusted-source warning above the approval when official is not true. The
addresses of the login are not in the list; an administrator reads them with
the OAuth client (see the login routes).
The list does not say whether an administrator approved the client. A
connection’s oauth.has_client does, and a start with no approved client is a
409 needs_approval. An add-on page that logs in (the Gmail and Google Drive
pages) draws the host’s login component, sdk.ui.ConnectionLogin: it adds the
connection, starts the login with the page as return_to, shows the state of each
connection, and offers an administrator a link to the add-on’s Settings tab while
there is no approved client.
A request also carries Request.GrantedScopes, the scopes the host holds for
the person’s login. The host sets it; it is not a secret, and the host drops it
from any request a client sends.
When the service refuses the access token, the add-on answers HTTP 401 with the
reason credential_rejected. It does so only when the service refused the token
and nothing changed. The host then decides whether to refresh the token or to
ask the person to reconnect; a 401 with another reason is an outage. An add-on
built on the public Go package github.com/mudler/LocalAI/pkg/addons/sdk/protocol returns
contract.ErrCredentialRejected (wrapped or not) from a handler, and the
package sends this answer. When the
connection has expired or was revoked, the model gets the code
reconnect_needed and a note to tell the person to reconnect on the Connections
page. The model is told not to repeat the call and not to report an outage.
Where the host keeps an OAuth login
A binding has an auth kind. An empty kind or token is a binding whose token
the person gave; it works as before. A binding of kind oauth2 holds no token
of its own: its tokens are in its grant, and the binding is a usable
credential only while it has one. The auth kind must match the add-on: an
add-on whose credential slot is oauth2 takes oauth2 bindings only, and any
other connector add-on token bindings only. The connector kinds
(GET /api/chats/connectors/kinds) say auth_kind: "oauth2" for the first.
The host keeps three records, in the same store as the bindings (the
studio_connector* tables of the database, or connectors.json in the data
folder of a single process):
Record
Table
Key
Sealed
Plain
Grant
studio_connector_grants
binding
access token, refresh token, token type
expiry, scopes, account label, state (connected, needs_approval or reconnect_needed), reason, descriptor digest, token and revocation endpoints, version, lease
OAuth client
studio_oauth_clients
add-on ID
client secret
descriptor digest, client ID, who approved it and when
Sealed values use AES-256-GCM with the sealing key of the bindings. Each
record type has its own additional data (a grant’s names its binding, owner
and add-on), so a sealed value copied to another row does not open.
The host never stores the state parameter itself. A login state lasts 10
minutes and works once: the callback removes it in the same step that reads
it, on whichever frontend serves the callback, even when the exchange that
follows fails.
The tables and the auth_kind column are added when the server starts.
Existing bindings have an empty kind and need no change.
Login, refresh and disconnect
An administrator saves the client ID and secret of an add-on for the descriptor
digest they saw; the save is the approval, and the host refuses it when the
descriptor changed in the meantime. A status read says whether a secret is
stored and never returns it.
A login starts only when the approval holds for the current descriptor. The
host makes a 256-bit state, a PKCE verifier and a nonce for a cookie of the
browser, and asks for the required scopes and the optional ones the person
ticked. At the callback the state is used up first; then the person and the
nonce must match the start, and the approval must still hold. The host trades
the code at tokenUrl, checks that the required scopes were granted, and asks
the add-on’s connector op me, with the new token, who the person is. An
unauthorized answer fails the login. The host removes control and format
characters (such as bidirectional overrides) from the account name, folds white
space and keeps at most 128 characters, so “Connected as” cannot show another
account than the one linked. The outcome is one of ok, denied,
invalid_state, provider_error, exchange_failed, scopes_missing,
token_too_large (the access token is larger than the 16384 bytes a request
carries) and unavailable; nothing the service wrote is copied into it.
Every credentialed call reads the grant:
The access token is refreshed when less than two minutes of its life are
left, or less than half of it for a token that lives under four minutes. A
service that gives no expires_in is refreshed only after a
rejection. The proposal broker reads the credential at preview and again at
apply, so a confirmation hours later gets a fresh token.
When the add-on answers credential_rejected to a read, a preview or an
apply, the host refreshes once and retries the call once, unless the grant
changed since the call began; then it retries with the newer token. A second
rejection ends the grant, and the call is refused with reconnect_needed. A
rejected apply changed nothing, so its proposal stays pending.
The new access token, its expiry, the granted scopes and a rotated refresh
token are written in one compare-and-set step before the token is used. When
that write fails after the service rotated the refresh token, the host tries
three times and then ends the grant.
The service answers
Result
Grant
Network error, timeout or 5xx
the call fails as an outage and may be repeated
unchanged
429
rate_limited with the Retry-After of the service
unchanged
invalid_grant, invalid_client, another refusal
reconnect_needed
secrets wiped, state reconnect_needed
an access token over 16384 bytes
reconnect_needed, reason token_too_large
secrets wiped
a scope without a required scope
reconnect_needed, reason scopes_missing
secrets wiped
a scope with other scopes
the token is used
the granted scopes become those of the login that the service still grants; a scope the login never had is not added
(descriptor changed, not approved yet)
reconnect_needed to the call; the connection shows needs_approval, and no token is used or sent
secrets kept, state needs_approval
(new descriptor approved, same tokenUrl and revokeUrl)
the login works again, without a reconnect
moved to the new descriptor
(new descriptor approved, another tokenUrl or revokeUrl)
reconnect_needed, reason endpoint_changed; the refresh token is never sent to the new endpoint
secrets wiped
Disconnect revokes the refresh token (or the access token when there is no
refresh token) at revokeUrl when the descriptor has one, with a 10 s limit,
and then deletes the grant even when the revocation failed. The answer says
whether the service was told. Deleting the connection revokes the same way
first; a person’s delete asks the add-on owner, so it works on any frontend,
while an administrator’s delete revokes only on a process that runs the
add-ons. A login whose callback finishes after its connection was deleted
stores nothing: the store writes a grant only while its binding exists, in the
same step.
The token client follows no redirect, reaches public addresses only, waits at
most 30 s and reads at most 64 KiB. It accepts bearer tokens only, an access
token must fit in 16384 bytes, and expires_in is clamped to one minute through
one day. A granted scope must be RFC 6749 scope tokens of at most 128 bytes,
the rule Request.GrantedScopes is checked with, so an answer with any other
scope fails the login or the refresh instead of every later call. Its errors
are fixed classes: no token, code, verifier, state, client secret or answer of
the service goes into a log, an error or a tool result.
Uninstalling an add-on does not touch its grants or its client yet: the
add-on manager has no hook for it. The bindings stay, as they do for a token
binding.
The login routes
Route
Who
Body
Answer
POST /api/chats/connectors/{id}/oauth/start
the owner of the binding
{"scopes": ["write"], "return_to": "/app/chats/connectors"}, both optional
The person’s routes need the connectors feature and, because a login is an
add-on call, the addons feature. The client routes need the administrator
role. None of these routes has an MCP tool: a client secret must not pass
through a chat, and a login is a person’s act in their own browser.
Test a connection.POST /api/chats/connectors/{id}/test on an oauth2
binding asks the add-on’s me with the access token, renewed first when it
ends soon. It answers with the types of the login routes: 409 not_connected
before the login, 409 reconnect_needed when the login ended, 409 needs_approval, 429 rate_limited with Retry-After, and 503 unavailable
when the login cannot be checked now. A frontend does not read the add-on’s
login, so a test there answers 503 unavailable; test on the add-on owner, or
in a combined process.
Limits of the start. A binding can have at most 5 logins that wait for
their callback, and a person at most 20; a login stops waiting when its
callback comes or after 10 minutes. A person can start at most 10 logins a
minute. Past a limit the start answers 429 with the type too_many_logins
and stores nothing. The count of starts per minute is kept by the add-on
owner, which serves every start; the waiting logins are counted in the shared
store.
Register the callback with the service. Every add-on uses one redirect
URI: the base URL of the server followed by
/api/chats/connectors/oauth/callback, for example
https://localai.example.test/api/chats/connectors/oauth/callback. The client
read returns it as callback_url. The host builds it, in this order, from
LOCALAI_BASE_URL, from the forwarding headers of a trusted proxy (see
reverse proxy), or from the
request when the host is localhost or a loopback address. When none of them
applies, the start is a 409 with the type base_url_required, because the
service would otherwise send the code to an address that anyone can choose.
The address must use https, so that the code, the state and the nonce cookie
do not cross the network in clear text: a trusted proxy that forwards plain
http for a host that is not loopback also gets base_url_required. An
http address works only for a loopback host, or when an administrator sets it
as LOCALAI_BASE_URL.
The address of a login is stored with its state and sent again at the
exchange.
Approve an add-on. Read the client: current_digest is the digest of the
login the add-on declares now, and descriptor shows it in plain fields
(addresses, hosts, required and optional scopes, client authentication and
authorize parameters). Register the callback address with the service, then
save the client ID and secret with descriptor_digest set to the digest you
read. The save is the approval. When the add-on’s login changed in the
meantime, nothing is saved and the answer is 409 with the type
approval_stale and the new current_digest; read it again and review the
change. client_secret is write-only: an absent secret keeps the stored one,
and a public client (clientAuthnone) has none. The read says
has_secret, approved and who approved when.
Log in. The start checks the binding, the approval and the optional
scopes, and sets a nonce cookie for this login (HttpOnly, SameSite=Lax,
Secure over HTTPS, ten minutes). Each login has its own cookie, named
localai_oauth_nonce_ and the first eight hex digits of the SHA-256 of its
state, so two logins started in one browser do not break each other. The return page must be a
page of the web app: a path under /app with an optional query and no
fragment, as the add-on SDK accepts; anything else is a 400. Open
authorize_url in the same browser. The service sends the browser back to the
callback, which:
needs the session of the person who started the login. The session cookie is
SameSite=Lax, so the browser sends it on that redirect. With
authentication off there is no session, and the nonce cookie alone binds the
login to the browser;
finds the nonce cookie of its login by the state in the query and clears
that cookie, whatever the outcome; the cookies of other logins stay;
always answers 303 to the return page, with oauth=ok, oauth=denied
(the person declined; a connection that worked keeps working) or
oauth=error&class=<class>, where the class is invalid_state,
provider_error, exchange_failed, scopes_missing, token_too_large or
unavailable. The
error_description of the service is never copied into the address, a page
or a log.
See the state. The binding JSON (GET /api/chats/connectors and
GET /api/chats/connectors/{id}) has auth_kind: "oauth2" and an oauth
object: state (connected, reconnect_needed, not_connected or
needs_approval), the fixed reason of a reconnect, account_label,
scopes, expires_at and has_client. It never holds a token. The state is
read from the shared store, so every frontend shows the same; a login whose
descriptor changed in an upgrade shows needs_approval once a call or a
refresh found it, and the result of the approval as soon as an administrator
saves it. The add-on list of a chat (GET /api/chats/{id}/addons) gives each
connection a connection_state, and the add-on a connection_state of
reconnect_needed when a connection the chat may use must be connected again.
OAuth with several frontends
State mode: stateless per request, with a claim in the database. Every
frontend reads the OAuth records from the shared database, and the sealing key
is in the same database, so any process with the database can open them. No
process keeps a copy. Two things keep one refresh at a time:
In one process, one refresh per grant and version runs, and the other callers
wait for its result.
Across processes, a refresher takes a lease in the grant row (a conditional
update on the version, 90 s: three times the 30 s limit of the token request,
so a slow service cannot outlive it). The other callers look at the row every
200 ms for up to 10 s and use the token the winner wrote. A service that
rotates its refresh tokens can revoke the whole login when one refresh token
is used twice, so this matters.
Each process compares the lease with its own clock. Keep the clocks of the
hosts in sync (NTP): a host whose clock is ahead sees the lease end early by
as much.
In a split deployment the refresh runs on the add-on owner: the frontends
forward credentialed tool calls to it, the owner adds the credential and calls
the add-on, and when the add-on rejects the token the owner refreshes and
retries before it answers. Only the final reconnect_needed refusal crosses
back to the frontend.
The OAuth descriptor comes from the manifest of the installed add-on, which
only the owner reads. So the start, the callback, the disconnect and the
client routes are owner dispatch, in a combined process and in a cluster
alike: the frontend that gets the request forwards it over the carrier with
the signed caller, and the owner serves it. The service can send the browser
back to any frontend; that frontend forwards the query and the nonce cookie as
fields of the call (never as headers), the owner trades the code, and the
frontend answers the redirect. A frontend never serves these routes from a
service of its own: when the owner cannot be reached, the person’s routes
answer 503 and the callback ends with the class unavailable. An owner
that predates the calls answers 503 with the reason that it must be
upgraded.
Preparing a provider resource (feature level 13)
A provider can mark a page-only action tool with "preparation": {"kind": "search-index", "keys": ["products", "articles"]}. The tool name is the provider’s choice. Its schema takes one required string, key. A provider may declare multiple resource kinds, but only one action per kind. Keys are bounded identifiers, not paths or URLs. Neither an execution provider nor a progress tool is required. See tests/addons/fixtures/contracts/search-preparation.json for a complete manifest.
The host feature that accepts a selection checks its own policy before dispatching that action as the actor. On launch an owner may instead pass a preparation hint for a declared kind, naming a default key and eligible keys for cache refresh. No hint means no startup preparation. A declaration by itself does not authorize an action or a background download. An older host cannot serve a package requiring level 13; an older provider without a declaration remains usable without preparation.
For non-execution resources the administrator opts in through POST /api/addons/dispatch. First read host-settings-read to obtain the current revision. Send host-settings-update with a fresh operation ID and these arguments (replace 7 with that revision):
This replaces the whole list; [] clears it. Each entry authorizes exactly one key per add-on and kind. On the next provider launch the owner supplies that default only if the installed manifest still declares the key. To prepare it immediately without restarting, send the following request to the same endpoint, using the current installed generation and a fresh operation ID:
The owner checks administrator authority, the persisted choice, and the live declaration before delivering {"tool":"build-index","key":"products"} to the add-on. The action does not change policy. execution-image is reserved for the sandbox profile policy and cannot be opted in through this list.
A feature-level 13 provider can report progress for a running tool by declaring
contract.ProgressDefinition() ("progress": true on the UI-only tool-progress
read). The name alone does not opt in. The read receives the provider’s invocation
ID and returns {"progress":{"message":"Indexing documents","percent":40}};
omit percent when unknown and return {"progress":null} to clear. The SDK’s
progress.Store scopes these snapshots to the authenticated actor and invocation.
Look up how the one process that owns the add-ons works, and how to turn it on or off, run it on its own and upgrade it. This page is part of the Add-on contract reference.
Singleton owner and its limits
Addon state lives in one place. Exactly one LocalAI instance is the owner of an
addon root (its storage identifier and Root directory): it holds the journal of
installed packages, the resource policy store, the proposals, the artifact store, the
backups and the data of every addon, and it supervises the addon processes. The other
instances are frontends: they authenticate the caller against the shared account
store and forward the typed operation to the owner. The consequences are by design:
No second owner. A second process that opens the same root is refused while the
first holds it; two owners are never active. There is no election and no automatic
failover. Moving the owner to another machine is an operator action: stop the owner,
move or mount the root, configure the new owner and start it.
An owner outage is an addon outage. While the owner is down, every frontend
answers 503 for every response type (JSON, progress, status, file, asset and
proposal calls) with the same typed error, and executes nothing locally. Nothing is
queued or applied later. A mutation whose reply was lost is reported as
outcome_unknown with its original operation ID and is resolved by receipt lookup
after the owner is back, never by sending it again under a new ID.
No state on frontends. A frontend keeps no addon data, no addon process and no
sticky session. Any frontend can serve any request, and a request may use another
frontend than the previous one.
One writer per database. A Tables database is one SQLite file on the owner’s
disk with a single writer. Throughput is bounded by that machine, and the data is
only as available as that disk and its backups.
The addon process is local to the owner. It listens on loopback only. The
carrier between a frontend and the owner is the only network path, and it is
authenticated in both directions by pinned certificates and signed requests.
A deployment with one instance is the owner and has no frontend; everything above
still holds.
The --addons-role flag chooses how a process takes part. combined is the
default and is both the owner and the only frontend. owner and frontend split
them, as described in Running the owner as its own workload.
Distributed state. In distributed mode,
the owner is a single runner by design: the operator runs one owner replica, and the
lock file in its root is the guard against a mistake, not a way to scale. The
frontends are stateless for add-ons. The one exception is the add-on pins of a
frontend that has no account database, which are per-instance state (see
Frontend limits).
Turning the owner on or off
A normal local-ai run starts the addon owner, so Apps, Add-ons and Tables work
without extra setup. The node is its own owner: it keeps addon state under the
addons folder of the data path (--data-path) and reaches the owner over a
loopback carrier with keys that are made at each start and never written to disk.
Flag
Environment variable
Default
What it does
--addons-enabled
LOCALAI_ADDONS_ENABLED
true
Runs the addon owner. --addons-enabled=false turns it off completely: no owner starts, no addon runs, the UI hides the add-on entries, and every add-on, fine-tuning and quantization route answers 503. See The addons feature gate.
--addons-ownership-mode
LOCALAI_ADDONS_OWNERSHIP_MODE
local-owner when authentication is off, named-user when it is on
named-user gives each account its own access. local-owner makes every caller share one owner. A value you set always wins over the default. Any other value stops startup with an error.
--addons-official-library
LOCALAI_ADDONS_OFFICIAL_LIBRARY
true
Registers the official library on the first start. --addons-official-library=false does not register it.
--addons-backend-library
LOCALAI_ADDONS_BACKEND_LIBRARY
true
Registers the backend library on the first start, like the official library. A build from master reads it as the backend source; a tagged build reads the backend gallery until the release cutover. --addons-backend-library=false starts without it and reads the backend gallery on every build. A library you remove stays removed.
--official-libraries
LOCALAI_OFFICIAL_LIBRARIES
true
Use the default library sources of add-ons, backends and models. --official-libraries=false leaves them listed but unread. It is also the runtime setting official_libraries. See Library sources.
--addons-backend-max-bytes
LOCALAI_ADDONS_BACKEND_MAX_BYTES
8589934592 (8 GiB)
Largest compressed size of a backend image installed from a library. Add-ons keep their own limit of 512 MiB.
--addons-wsl-distro
LOCALAI_ADDONS_WSL_DISTRO
empty (the default distribution)
Windows only. The WSL 2 distribution that runs the add-ons whose manifest has osSettings.windows.execution set to "wsl2", such as the Sandbox. See Install on Windows.
--addons-role
LOCALAI_ADDONS_ROLE
combined
combined is the single node described above. owner runs only the owner and serves the carrier on the network. frontend runs no owner and forwards every add-on request to it. Any other value stops startup with an error.
--addons-owner-address
LOCALAI_ADDONS_OWNER_ADDRESS
empty
https://host:port of the owner carrier, with no path. Use a stable service name, never a pod address. Required for owner and frontend; an error with combined.
--addons-owner-listen
LOCALAI_ADDONS_OWNER_LISTEN
empty
owner only. The address the carrier listens on. Empty listens on all interfaces, on the port of --addons-owner-address.
--addons-carrier-dir
LOCALAI_ADDONS_CARRIER_DIR
empty
Directory with the carrier key set made by local-ai util addons-carrier-keys. Required for owner and frontend; an error with combined.
named-user needs authentication. With authentication on and no mode set, LocalAI
uses named-user. With authentication off there are no accounts, so LocalAI uses
local-owner by default: every caller that can reach the server shares one owner and
can install, run and remove add-ons. See
Explicit local-owner mode for what that means. To keep
add-ons off on a server without authentication, set
--addons-enabled=false, or set --addons-ownership-mode=named-user; with
authentication off, named-user leaves the owner off and LocalAI logs a warning.
The owner and frontend roles split the owner from the frontends. The frontend
role does not create or open the addons folder of the data path. The key set for
both roles comes from local-ai util addons-carrier-keys; see
Running the owner as its own workload.
The addons feature gate
Fine-tuning and quantization are add-ons, so --addons-enabled=false turns off all
three. GET /api/features reports one key, addons, and the keys fine_tuning
and quantization carry the same value. The key is true when add-ons are
available on this instance:
In the combined and owner roles it is true when add-ons are enabled.
In the frontend role it is true when add-ons are enabled and the owner
answered a reachability call within 2 seconds. The answer is kept for 10 seconds,
so /api/features does not contact the owner on every request.
While the key is false:
The UI shows no Add-ons entry, no pinned apps, and no fine-tuning or
quantization entry. /app/addons and canonical add-on page addresses lead back
to /app. The UI does not call /api/addons/pins or /api/addons/builtin. A
server that sends no addons key counts as true in the UI.
Every path under /api/addons, /api/fine-tuning and /api/quantization
answers 503 with the same body, also for a path that does not exist. The
answer does not show which routes exist. The body is the LocalAI error envelope
({"error": {"message", "type", "code"}}, code unavailable). The message is
“add-ons are turned off on this instance” when the feature is off and “the
add-on owner is not reachable” when a frontend cannot reach the owner.
With --addons-enabled=false the handlers of these routes are not registered at
all. A frontend with --addons-enabled=false needs no --addons-owner-address
and no --addons-carrier-dir. It loads no keys and builds no carrier. If you set
--addons-role, --addons-owner-address, --addons-owner-listen or
--addons-carrier-dir, LocalAI ignores them and logs one line.
This gate is for the whole instance. It does not replace the permission of each
user: the addons, fine-tuning and quantization permissions of a user are checked
after the gate.
The reachability answer of a frontend is a per-instance observation and is not
shared. Two frontends can disagree for up to 10 seconds after the owner goes up or
down. A request through a frontend that still reports true gets the 503 of the
carrier while the owner is down.
Running the owner as its own workload
A normal local-ai run is both the owner and the only frontend (the combined
role). In a deployment with several frontend replicas, run the owner as one
separate workload and let the frontends forward to it. The owner keeps all its
state in files under one root, as before. Frontends keep none and scale freely.
One owner, one volume. Run exactly one owner replica (--addons-role=owner)
with its own volume for the data path. Use a recreate-style rollout, so two
owner processes never overlap: the old one must stop before the new one starts.
A second owner on the same root stops at once with “addon storage already owned”
and the process exits with an error. It does not wait.
Fixed mount path. The journal stores absolute paths. Mount the volume at the
same path on every start. If the data path or the mount point changes, every
installed add-on points at a directory that does not exist.
A local volume. The root needs a local file system with working flock,
atomic rename and directory fsync. A network block volume that one node mounts
at a time is fine. A shared network file system is not supported.
A stable owner address. Frontends reach the owner at --addons-owner-address.
The owner does not store it, so you can change it between starts. Use a stable
service name, never a pod address.
Frontends have no add-on volume. A frontend (--addons-role=frontend) does
not create or open the addons folder. Give it no volume for it.
Existing add-ons. A root written by a single node loads under the owner role
when the owner uses the same owner and storage identity. The stored address does
not matter. The journal keeps absolute paths, so the owner must see the same data
path and mount point as the node did. Otherwise the installed add-ons point at
missing directories. For an empty volume, the owner starts fresh.
Warning
The owner is a node-bound singleton. If the owner is down, add-ons are down: the
frontends stay up and answer 503 for every add-on request. Failover is manual.
There is no election and no standby owner.
What runs where
The three roles split the work of a LocalAI process as follows.
Work
combined (default)
owner
frontend
Add-on processes, the gateway and the host operations
Yes, in this process
Yes
No. It forwards to the owner.
The carrier
Loopback, with keys made at each start
Served on the network
Client only
Chat turns
Yes
No
Yes
Model loading
In this process, or on workers in distributed mode
No models. In distributed mode it routes loads to workers.
In this process, or on workers in distributed mode
Connector polling (Telegram, Slack, Discord)
Yes
No
Yes, on the one leader frontend
Triggers, loops and agent jobs
Yes
No
Yes
API and UI for users
Yes
No. Send users to a frontend.
Yes
A single node is combined: the add-ons run in the same process as the chats and
the models, and nothing else is needed. Use owner and frontend only when you
run several frontend replicas.
The owner in distributed mode
When the frontends run in distributed mode,
the owner must join distributed mode too. Give it the same settings as the
frontends:
the same NATS URL (--nats-url) and registration token (--registration-token);
the same PostgreSQL database (--auth-database-url), with --auth-enabled on;
--distributed.
With these, the owner takes part in the leader locks and sends model loads to the
workers. Without them, the owner acts as a separate single node in the cluster:
It tries to load models in its own process. It has no backends, so the load fails
with backend not found.
It does not see the leader lock of the connectors. It polls the same bots as the
leader frontend, so a Slack message gets two answers.
An owner should not run chats at all. In the release that contains pull request
13052, an owner that has no distributed settings skips connector polling,
triggers, loops and agent jobs, and refuses the push operation connector.inbound
with an error. In earlier releases, give the owner the distributed settings, or
turn the connectors off on it with LOCALAI_DISABLE_CONNECTORS=true.
Make the carrier keys
The frontends and the owner trust each other through a static key set. Make it
once, anywhere you can run local-ai:
Store the set as a secret and mount only the files of each role. Point
--addons-carrier-dir at the mount. LocalAI refuses key files that group or other
users can read, so give them mode 0600 or tighter.
All frontend replicas share one identity and one signing key, so a new or
rescheduled frontend is accepted at once and the owner needs no list of replicas.
Anyone who holds the frontend files can act as a frontend. A forwarded request
still carries the user, and the owner checks that user against the account
database, so the key set does not give a user any authority on its own. The command
does not keep the CA key, so nobody can make a third certificate from the set.
Note
Rotation is a coordinated restart. The frontends pin the exact certificate of the
owner and the owner pins the one of the frontends. To change the key set, make a
new one, update the secret, and restart the owner and every frontend. There is no
overlap window and no automatic renewal.
Example
This Docker Compose file shows the add-on flags of one owner and two frontends.
Add the other flags of your deployment (the database, NATS and the rest of
distributed mode) to each service as
usual.
./carrier-keys-owner holds the owner files and ./carrier-keys-frontend holds the
frontend files from the table above.
Settings every role shares
The same ownership mode. Every role of a deployment must use the same
--addons-ownership-mode.
The same account database. In named-user mode all roles must use the same
account database. The owner checks the user of each forwarded request against it.
--addons-enabled=false keeps its meaning in every role.
What a restart looks like
When the owner stops, the kernel drops its lock and its add-on processes end with
it. The new owner takes the lock, checks its identity file, and reads the journal:
operations that had only started are marked failed, and operations that were
already prepared or applied are finished. Recovery journals and pending proposals
finish or wait for an administrator. Then the add-ons that were enabled start again.
While this happens, the frontends answer 503. A frontend that starts while the
owner is down starts normally and answers 503 until the owner is up. Some state
is in memory only and is lost: an upgrade that was being canceled becomes failed,
and the memory of failed automatic upgrades is cleared. A mutation whose reply was
lost is reported as outcome_unknown with its operation ID, and relays that were
in progress (progress, file and asset) are cut. The owner picks a new audience at
each start. A request signed for the old owner is refused, and the frontend gets
the new audience on its next call without any action.
The models path
Fine-tuning and quantization export models into the models path of the owner.
The owner and every frontend must mount the same models storage at the same
absolute --models-path. LocalAI checks this with a probe file:
At start, the owner writes .localai-addons-probe.json into its models path.
It holds a random nonce that changes at every start. Do not delete it, and do
not exclude it from the shared volume. LocalAI does not list it as a model.
Each frontend checks at start, and then every 60 seconds, that it sees the
same file with the same nonce at the same absolute path. If it does not, the
frontend logs an error, reports model_exports: false in /api/features,
and answers the export and import routes with 503.
The owner refuses an export or import while its own probe file is missing,
also for the add-on host operations. If the owner cannot write the probe at
start, it keeps running and refuses exports.
If the owner is unreachable, or is an older version without the probe, the
state is unknown. LocalAI logs a warning and leaves exports on. The state
clears within 60 seconds after the owner is back.
The /api/fine-tuning and /api/quantization routes of a frontend still write
to the models path of that frontend. The probe is what blocks them when that
path is not the shared storage.
Frontend limits
A process with --addons-role=frontend holds no add-on state. This has these
consequences:
Library sources live on the owner and are changed through it. The frontend
never opens, creates or writes sources.json or anything else under the addons
folder of the data path. Every /api/library/sources route is forwarded to the
owner, which is the only writer. The caller must be a named account and an
administrator: the frontend checks the account, and the owner checks the
administrator right again, as it does for its own routes. A legacy API key has no
named user and gets 401 on a frontend, in local-owner mode too. The routes
answer the same statuses as on a single node (404 for an unknown source, 409 for
a duplicate, 400 for an invalid request). With add-ons off a frontend has no owner
to reach, and these routes answer 503 with the message “library sources are
managed on the owner”. When the owner is down they answer 503 with
“the add-on owner is not reachable”. A change whose reply was lost answers 503
with the operation ID in the message; read the list again before you repeat it.
The gallery lists follow the owner. A frontend asks the owner for its source
list every 60 seconds (a read over the pinned carrier that needs no signed-in user)
and, only when the list or the official_libraries setting
changed, rebuilds its model and backend gallery lists from the galleries named by
--galleries and --backend-galleries plus the owner’s sources. A change made on
the owner shows up on every frontend after at most 60 seconds, and a change made
through a frontend shows up on that frontend at once. Until the owner has answered
once, a frontend reads only its own flags. While the owner does not answer, the
frontend keeps its last lists and logs that they may be stale. This is a
per-instance observation: two frontends can show different lists for up to 60
seconds.
official_libraries is set on the owner. The owner’s value is the value of
the deployment, and a frontend takes it at each refresh. POST /api/settings with a
different official_libraries value answers 409 on a frontend. Set it on the
owner.
Backend installs run on the frontend node.POST /backends/library/install
and GET /backends/library/updates work on a frontend. The owner resolves the
entry (including the choice of a meta backend for the capability of the frontend)
and pins the image by digest. The frontend then installs it into its own backends
path, verifies the signature there, and applies its own size limit and
--require-backend-integrity. The owner’s backends path stays unchanged. The
update check compares the local backends with the releases the owner lists.
The background update check has no user, so it works in named-user mode through
one read-only system call (POST /addons/library/system, capability
library-system). The owner accepts it only from a pinned frontend, only for the
release lookup, and without an actor. Every call a user starts still needs the
administrator check on the owner.
The owner and the frontends must run on the same OS and architecture. The
owner resolves entries for its own platform, so a frontend checks the platform the
owner reports (GET /addons/capabilities) and refuses every library call to an owner
on another one with a 503. A frontend also refuses library calls to an owner that
does not serve them, with “the add-on owner does not support library operations;
upgrade the owner”. Upgrade the owner before the frontends.
Pins are per frontend without an account database. With an account database,
the pins of the Apps entry are shared by all frontends. Without one, each
frontend keeps its own pins in a file in its own data path, so two frontends can
show different pins. A frontend logs a warning at start when it has no account database.
Operations and reads during an upgrade
An install, an upgrade or a removal runs on the owner and can take a minute or
more: it fetches and checks the package, backs up the data, publishes the new
generation and starts it. The owner runs one such operation per add-on at a
time. A second upgrade of an add-on that is already changing is refused with a
conflict; it is never queued or run in parallel.
Reading never waits for an operation. The apps list, the host access overview
and the installed list answer from a snapshot of the last journal write, so an
upgrade in progress does not make the Add-ons page slow or empty. While an
operation runs, each add-on that it touches carries an operation object in
the apps list:
phase is queued, downloading (fetch and check the package), backing-up,
installing, migrating, starting or working. state and generation are
still those of the running add-on until the new generation is published.
A frontend that forwards a read to the owner waits at most eight seconds. When
the owner does not answer in that time, the route fails closed with the same
typed 503 from every frontend, and never with an older list of its own:
owner_busy: the owner is up but did not answer in time.
owner_unavailable: the owner could not be reached at all.
A frontend keeps no copy of the apps list, because two frontends with different
copies would give different answers for the same request. GET /api/addons/pins
answers the same way instead of returning pins without the add-ons it could not
check. When the owner is reachable and busy, it still answers from its snapshot,
so the apps list is a normal 200 with the operation fields above.
The Add-ons page keeps the last list it received in the browser (in memory and,
for a page loaded during an upgrade, in the session storage of the tab). On a
503 it keeps showing that list, shows a notice such as “The add-on server is
busy. Showing the last known state.”, and asks again with a growing delay. It
only says that no add-ons are installed when the owner answered with an empty
list.
Look up the add-on manifest, the runtime wire version, the default limits and the verification of a package. This page is part of the Add-on contract reference.
Manifest
ParseManifest accepts a single JSON object, at most 64 KiB, and rejects unknown
fields, duplicate keys, trailing values, and nesting beyond 64 levels.
ValidateManifest additionally checks the supplied host compatibility tuple.
See tests/addons/fixtures/contracts for service-only, headless service/tool,
page/navigation, chat-action-only, and incompatible-host fixtures.
The required fields are schemaVersion (1), id, version, executable, os,
arch, host, api, protocol, dataFormat, and capabilities. The optional
osSettings block holds OS-specific runtime settings (see OS settings). Compatibility
ranges are inclusive positive integer {min,max} pairs, not semver expressions.
The package version uses immutable major.minor.patch, optionally a lowercase
prerelease starting with a letter; moving aliases and build metadata are not
package versions. Registry channels are separate from package identity.
Namespace IDs match [a-z][a-z0-9-]{0,63}. IDs are never paths. An add-on ID
must not be one of the first path segments the host serves under /api/addons/:
apps, proposals, artifacts, resources, conversations, dispatch, relay,
catalog, icon, assets, installed and sources. Such a manifest is refused at
parse, at install and when a catalog library is refreshed, because the asset URL
/api/addons/<id>/assets/... would be answered by the host route of the same
name. A test derives the registered segments from the real routes and fails when
one is missing from this list. Executable and UI
asset paths are normalized package-relative ASCII paths: no absolute paths,
parent traversal, backslashes, percent escapes or URL schemes. These checks do
not substitute for safe extraction, symlink checks, executable mode validation,
or checking declared files exist, which belong to package installation.
OS settings
osSettings is optional. It holds runtime settings that apply on one OS only. Each key
is an OS, and the value is the settings object of that OS. When osSettings is absent,
the executable runs natively on os and arch with no OS-specific setting.
This version defines one key and one setting:
"osSettings":{"windows":{"execution":"wsl2"}}
osSettings.windows.execution is the execution environment of the executable. The only
value is "wsl2", and only with "os": "windows" and "arch": "amd64". Such a
package installs on a Windows host, but its executable is a linux/amd64 program (no
.exe name) that the owner runs in a WSL 2 distribution. The owner talks to it over
its standard streams (see Packages and runtime). Use it only
for an add-on that cannot run on Windows itself, such as the Sandbox add-on.
The host refuses:
an osSettings object with no OS key,
an OS key other than windows, and the windows key on a package whose os is not
windows,
an unknown field in an OS object,
a missing execution, or any value other than "wsl2" on windows/amd64.
A manifest that sets osSettings must declare featureLevel: 10. An add-on author does
not write osSettings in the manifest template. The packager takes it from the
execution key of the platform row in platforms.yaml, and the package verifier
refuses a manifest whose osSettings differs from the row.
Feature level
The four compatibility ranges above are integers that every published add-on states
(host, api, protocol, dataFormat). A new optional manifest field cannot use them
without making every published add-on incompatible, so the host also has a feature
level: one integer that counts the additive manifest features it understands.
The host declares its level (contract.HostFeatureLevel). This version has level 22.
A host that predates the levels is level 1.
A manifest may set featureLevel (a positive integer, default 1). It states the level
the add-on needs. A manifest that uses a field of a higher level must say so: the
parser refuses a manifest that uses capabilities.resources.agentScoped,
capabilities.resources.nounPlural or i18n.<language>.resources and does not declare
featureLevel: 2. capabilities.ownerData is level 3.
The setup text (setup on the manifest, kinds[].setup and the setup of a kind translation) is level 4.
kinds[].toolOnly is level 5.
capabilities.executionProvider.jobs is level 6.
capabilities.client is level 7. A wildcard tail ({name...}) as the last segment of a client
route is level 8; a host of level 7 refuses such a manifest with the reason below.
capabilities.modelSearch (a source of the model-search slot) is level 9.
osSettings (see above) is level 10.
deferred on a tool definition (see Deferred tools) is level 11.
capabilities.events (see Events) is level 12.
preparation and progress on a tool definition (see Preparing a provider resource) are level 13.
ui.glyph (see below) is level 14.
Level 15 adds no manifest field: a host of level 15 sends the privacy level of each call
(see Privacy level of a call) to an add-on that declares
featureLevel: 15 or higher.
chatFiles on a write tool definition (see
Save a file into the chat’s files) is level 16.
Level 17 adds capabilities.credentialHosts: the registry hosts for which the add-on
asks to set a username and password with credentials.set. Each is a host or
host:port name in lower case, without scheme, path, wildcard, user or the port 443.
The list holds at most 32 hosts and needs credentials.set in hostOperations.
See Registry credentials.
Level 18 adds ui.setup: the page of the add-on that sets up the server.
See Setup page.
Level 19 adds typed events: the lifecycle occurred and icon, hint, fieldsVersion,
fields, dynamicFields, setup, detect and minIntervalSeconds on capabilities.events[].
See Typed events.
Level 21 adds effects, output and idempotent on a tool definition, capabilities.subscribes and the
events.deliver op. See What a tool does, and subscriptions.
Level 22 adds execution.customProfiles on the tool definition that replaces bash. It
says that the add-on can run sandbox profiles
that an administrator adds, each with its own image. It needs a non-empty
execution.profiles. For such a profile, the host puts the image and the limits in the
custom field of the options of a call. The model cannot set that field.
A host with a lower level refuses the add-on with the plain reason needs a newer
LocalAI. The add-on is not installed and not upgraded. A failed install or upgrade has
the cause needs_newer_host, and an update check shows the add-on as incompatible with
the reason feature-level.
The Add-ons page and the install and upgrade dialogs show it as “This add-on needs a newer
LocalAI.” in every language of the interface.
The library entry has the optional requires.featureLevel. The host reads it before it
downloads the package. If the entry says nothing, the manifest is checked when the
package is staged, with the same reason.
An older host cannot read the new names. It refuses a manifest with an unknown field, and
it also refuses a library index that has an unknown field, because the index reader is
strict too. So one entry with requires.featureLevel makes the whole index unreadable
for a host that predates the field. For that reason the catalog command of the packager
writes the field only when it gets --feature-level-in-index, and the committed index
does not have it. Without it an older host still lists the add-on and refuses it when it
stages the package. Turn the flag on once no host without the field needs the library.
Capabilities are independent: service is a boolean, tools is a unique list
of namespace names, and optional ui contains required entry and sdk range,
optional css, pages, navigation, and chatActions lists. Navigation names
must refer to declared pages. UI assets must not duplicate each other. Absent UI
requires neither assets nor SDK compatibility. Declared UI must be consistent;
an empty object does not count as a valid declaration. A chat action is either
a bare identifier (inert: it has no placement and is never drawn) or a full
declaration, and ui.slots and ui.renderers place components in closed host
slots (see Extension points and slots). They are
host-controlled entries, not DOM hooks or permission to read chat history. Platform tuple equality is compatibility only,
not evidence that any release platform has passed native runtime tests.
Four optional fields describe how an addon appears as an app (see Apps).
Every one is optional, so earlier manifests stay valid and a headless manifest
needs none of them.
Field
Meaning and bounds
launchMode (top level)
Absent or always: the owner runs the addon while it is enabled. on-demand is reserved and, like any other value, is rejected at install.
ui.mainPage
The page the Open action navigates to. It must be one of ui.pages. Without it the addon has no Open action. ui.entry keeps its meaning: the packaged ES module.
ui.setup
Optional, feature level 18. The page that administrators are sent to from the home page until the add-on calls setup.complete. It must be one of ui.pages, so it cannot name an address or a page of another add-on. It works only with a grant of setup.complete; setup.reopen alone is not enough. See Setup page.
ui.icon
A packaged image: .png, .webp, .jpg or .jpeg, a normalized package-relative path of at most 256 bytes, at most 256 KiB. A remote URL, a data: URL, an absolute path and a traversal are rejected. It cannot also be the module or a stylesheet.
ui.glyph
Optional, feature level 14. The mark of the icon alone: one colour on a transparent canvas, with the shape in the alpha channel. .png or .webp only (a JPEG has no alpha), under the same path and size rules as ui.icon, and a file of its own (not the icon, the module or a stylesheet). The host draws it as a mask in the text colour where a coloured tile would not fit, such as the chat composer buttons. Without it the host draws the first letter of the title there.
ui.title, ui.description
Plain text: one string, or a map of BCP 47 language tag to string (at most 16 tags). At most 80 and 280 characters. Markup characters (<, >), control characters and direction overrides are rejected.
Privacy level of a call
A web UI chat can be incognito (see Incognito chats).
The host puts the level of the call in request.privacy of the envelope: memory-off or
zero-retention. A call with no incognito promise has no field. The host sets the field
alone and replaces any value a caller sent.
The host sends the field only to an add-on that declares featureLevel: 15 or higher,
because the strict request reader of an older SDK refuses a field it does not know. An
add-on of a lower level gets no field, and its calls are not refused.
Before an add-on keeps anything of a call (a new or changed record, a history entry, a
copy of a file), it asks env.Request.KeepsContent(). It is false for zero-retention:
the add-on skips the write and says so in its answer instead of claiming it saved
something. Deleting is always allowed. memory-off keeps the long-term memory of the
host out of the chat, and an add-on may still keep what the person asked for.
Cache folders
An add-on can name folders of its data directory that hold only files it can make again,
such as trees it unpacks from files it keeps or programs it copies from its package:
A backup of the add-on’s data does not copy, hash or verify these folders, and they do
not count in the free-space check. This keeps a backup short, and the add-on is stopped for
less time during an upgrade. A restore, and the rollback of a failed upgrade, gives each
folder back empty. The add-on must cope with an empty or missing cache folder and fill it
again. Use data.cache only for files that are safe to lose.
Each entry is a path relative to the data directory: slash-separated ASCII letters,
digits, _, . and -, at most 256 bytes, with no empty, . or .. segment and no
leading or trailing slash. Absolute paths, backslashes and drive letters are refused. An
entry must not repeat another or lie inside another, and there are at most 16 entries.
The check is lexical. The host never follows a symbolic link at a cache path: a backup
skips a link, and a restore creates a real, empty folder. An empty list is valid and
leaves out nothing. The host takes the list from the package that wrote the data, so the
first upgrade to a package that adds the field still copies everything once.
Translated text
The English text of a manifest is the source and the fallback. An add-on can
carry the text that LocalAI shows to people in other languages, so the library
list and the add-on cards read in the language of the user. Two fields do this.
The title and the description of the add-on use the language maps of
ui.title and ui.description (see the table above). Write the English text
under en, then one entry for each language:
"title":{"en":"Tables","it":"Tabelle","de":"Tabellen","pt-BR":"Tabelas"},"description":{"en":"Databases of tables.","it":"Database di tabelle."}
The kinds of a connector add-on use the optional top-level field i18n.
It is an optional addition to api 2. Its shape is closed on purpose:
"i18n":{"it":{"kinds":{"telegram":{"title":"Telegram","description":"Parla con uno dei tuoi agenti salvati da un bot Telegram."}}},"pt-BR":{"kinds":{"telegram":{"title":"Telegram","description":"Converse com um dos seus agentes salvos por um bot do Telegram."}}}}
Rule
Value
Language tags
A BCP 47 subset: two or three letters and up to three subtags, such as it, pt-BR, zh-CN. At most 16 languages. A tag is unique whatever its case. en is refused: the English fields are the manifest.
Fields
kinds.<id>.title, kinds.<id>.description and kinds.<id>.setup. The kind must be declared in capabilities.connector.kinds, and a description or a setup can be translated only when the English kind has one. An unknown field fails the strict parser, as does a duplicate key.
Text
Plain text, as for ui.title: no < or >, no control characters, no direction overrides, no leading or trailing space. A title has at most 80 characters, a description at most 280 and a setup at most 120. All the translated text of one manifest has at most 12 000 characters. The whole manifest keeps its size limit.
Fallback
A field that a language leaves out, and every language that the manifest does not list, shows the English text. Each field falls back on its own.
Not translatable
Tool descriptions, input schemas and skills are written for the model and stay English. User setting keys and values are identifiers. The text of the add-on’s own pages is part of the UI bundle and has its own strings.
A host that does not know i18n refuses a manifest that has it, as it refuses
any unknown field, so a package with i18n needs a host that reads it. The
language maps of ui.title and ui.description are older and every host reads them.
The field is part of the manifest, so the package digest and its signature cover
it: a changed translation is a new package.
What the host does with it. The library index carries the translated title and
description of each entry (ui.titles and ui.descriptions, by language), so the library
lists them before the add-on is installed. The generator of the index
(scripts/addons/catalog.sh) copies them from the manifest, so they are never
edited in the index. A search matches the English and the translated text.
GET /api/addons/apps and GET /api/chats/connectors/kinds return the text of every
language in titles and descriptions. When the request names a language, each item that
translates it also has language and the resolved localizedTitle and
localizedDescription (localized_title and localized_description for connector kinds). The
language is the lang query parameter; without it, the Accept-Language header (quality values
are honored); without both, English and no extra field. An unknown or malformed lang is
English and the header is not read behind it. title and description never change, so an
existing client sees the same answer as before. The UI reads the maps and picks the language of
the user itself.
Setup text
Some add-ons do nothing until the person gives them something: a bot token, an access
token, an account on another service. The setup text says so in one short phrase, so the
UI can show “Needs a bot token from @BotFather” before the person starts. It is plain
text that completes the sentence “Needs …”. Write it without a capital letter, a final
full stop or a verb of its own: a bot token from @BotFather, an access token and the repositories it may use.
It has two places, and both are optional:
A connector kind declares kinds[].setup in capabilities.connector.
An add-on that has no connector kind (a tool add-on) declares the top-level
setup. It is one string or a map of language tag to string, like ui.title.
"featureLevel":4,"setup":{"en":"an access token","it":"un token di accesso"}
Rule
Value
Length
At most 120 characters, and not empty.
Text
Plain text, as for ui.title: no < or >, no control characters (so no line break and no tab), no direction overrides, no leading or trailing space. It is not Markdown.
Translation
For a kind, i18n.<language>.kinds.<id>.setup, only when the English kind has a setup. For the add-on, the language map of setup. A language that leaves it out, and every language that the manifest does not list, shows the English text.
Feature level
Level 4. A manifest that uses it must declare featureLevel: 4. A host with a lower level refuses the add-on with “needs a newer LocalAI”; a host that predates feature levels refuses the unknown field. Do not add it to a package that older hosts must still install.
What the host does with it.GET /api/chats/connectors/kinds returns setup (English),
setups (every translation, by language tag) and, when the request names a language that
the kind translates, localized_setup. GET /api/addons/apps returns setup, setups and
localizedSetup for an add-on in the same way. The fields are left out when the manifest
declares no setup. The language is chosen as for the other texts: the lang query parameter,
else Accept-Language. Each localized field falls back to English on its own.
Authoring. Translate by hand, in the tone of the main locale of the language. Keep product
names (GitHub, Slack, Telegram, Discord, Jellyfin, Home Assistant, LocalAI) as they are. Keep the
meaning of the English text; do not add claims to it. The packaging tests require every first-party
add-on to have the title and the description in en, it, de, es, fr, id, ko, pt-BR
and zh-CN, and every connector kind to have the same fields as its English kind in each of them.
Skills
An add-on can ship skills, the procedures a chat model reads before a task
(see Skills). The model loads one by
its name with the chat’s load_skill tool, which also names the files of the
skill’s folder, such as references/, for read_file. The manifest declares
them in capabilities.skillDefinitions and the package holds the files:
skills/<name>/SKILL.md
skills/<name>/references/<file> (up to 3 folders below the skill folder)
The description is not in the manifest: the SKILL.md frontmatter is its only
source. The manifest is checked at parse, at install and when a library is
refreshed:
Rule
Limit
Skills per add-on
16
Name
[a-z][a-z0-9-]{0,63}, unique in the manifest
A plain name
the add-on ID, or the ID and - and more (office-quickstart), so two add-ons never ship one name
A reserved name
refused for a plain skill: core names writing-skills, localai-workspace, localai-apps, assemble-media, media-prompting, and document names docx, pptx, pdf, xlsx
shadows
optional; must repeat name and name a slot: one the skill declares with slot (needs api 2), or a default slot (xlsx, docx, pptx, pdf)
slot
optional, needs shadows and api 2; see Document skill providers
Staging checks the files against the manifest. The folders under skills/
must be the declared names, and a package that declares no skills must have
no skills/ folder. Every entry is a plain file or a folder: links, special
files and executable files are refused. A path segment uses lowercase ASCII
letters, digits, ., _ and -, does not start with a dot, and a path is at
most 128 bytes. A file is a .md, .txt, .json, .csv, .yaml or .yml
file of UTF-8 text with no NUL byte. There are no scripts: .py, .sh,
.js and other files are refused. A procedure can declare requires: [exec], but its skill tree still contains no executable files. SKILL.md is at most 64 KiB and must
parse with a name equal to its folder and a description; a reference file
is at most 256 KiB; a skill has at most 64 files and 1 MiB, and a package at
most 4 MiB of skill files. The receipt records each file with its size and
SHA-256 digest.
The add-on owner copies the skills into the chats’ add-on skill layer, in the
workspace at /addon-skills/<add-on>/, when it installs or upgrades the
add-on and every time it starts, and deletes them when the add-on is
uninstalled. Each copied file is checked against the digest in the receipt,
so a package folder changed after install never reaches a chat. A copy that
fails is logged; the add-on itself still installs and runs. The files stay
while the add-on is stopped. A chat offers them only while the add-on is
installed, running, usable by the user and on for that chat, and for a chat
with a saved agent only when the agent grants the add-on.
Document skill providers
A slot is a skill name that one add-on serves in place of another. The host
holds no list of formats: the add-on that provides a skill declares its slot.
For manifests that declare nothing, the host reads four default slots (docx,
pptx, pdf, xlsx) from a data file in the contract, so existing packages
keep working.
Core does not embed these document procedures. Its remaining built-in skills cannot be replaced.
The existing shadows declaration identifies a document provider:
A manifest of api 2 can declare the slot, which also adds a format the host
has never heard of. extensions and words tell the host which files the
skill covers and how to find the skill by name when a chat meets such a file,
and library is the hint it gives for a script:
kind is documents: the skill is offered only while the add-on’s commands
provider reports isolated execution. At most 8 extensions (lower case, with the
dot) and 8 words. A slot may not be the name of a protected core skill.
In a chat.load_skill xlsx returns the eligible provider’s instructions.
Folder, personal, and shared overrides still take precedence.
Eligibility first. A provider must be enabled, running, visible to the user, and on for the chat.
A saved agent must grant the add-on explicitly.
Sandbox document procedures also require usable isolated execution through the selected Sandbox command provider.
A host command runner or an installed but unselected Sandbox does not qualify.
Office procedures require no command execution.
Several providers. An administrator chooses in Settings > Tools, using chats_tool_providers, for example {"xlsx": "office"}.
Without a choice, the eligible provider installed first serves.
An unavailable or ungranted pin stays unavailable; it does not select another provider silently.
GET /api/chats/admin/tools lists skill providers and candidates in skills.
No core fallback. A stopped, disabled, OFF, removed, or ungranted provider does not restore a built-in document procedure.
If no provider qualifies, the document authoring skill is absent or explains its unavailable pin.
Core document-text extraction, read_file, and search_files remain unchanged.
Before install. The library and installed views retain skillShadows as the compatibility field.
The install dialog describes the skill provided, not a nonexistent built-in replacement.
On the Add-ons page. Details list the document skills an add-on provides.
An administrator can use Use for xlsx in the chats to choose between providers.
This writes the same setting as Settings > Tools; it does not grant access to an agent.
The workspace store shares skill files across frontends; only the owner writes verified package contents.
Each turn reads provider availability from the broker. When the owner is down, add-on document skills do not fall back to core.
Saved skill names and explicit pins remain intact.
Legacy built-in document OFF preferences migrate to add-on OFF preferences through the persisted settings path.
See Document skills for setup and preference behavior.
SDK versions
This host provides SDK version 2. An add-on that has a UI declares the SDK
versions it works with in ui.sdk as a range, for example
"sdk": {"min": 1, "max": 2}. The host installs and loads the add-on only when
its own SDK version is inside that range. If it is not, the install is refused
with a message that names the range the add-on needs and the SDK version the
host provides:
the add-on needs SDK 3 to 3 and this host provides SDK 2
The dispatch response for that refusal has status 403 and error type
sdk_incompatible, with the message above. A package that does not match its
library entry, or is not a valid add-on package, is 403 with error type
package_unverified and a message that says nothing was installed. A failed
install or upgrade can also name its step in the error type: library_unavailable
(the library could not be read), library_conflict (two enabled libraries list the
add-on), release_not_found (the library has no such add-on or version for this
platform), package_fetch_failed (the package could not be downloaded) and
install_storage_failed (the package could not be written to the add-on storage).
The owner writes the underlying error to its log as Addon operation failed, with
the action, the add-on ID and the operation ID. Every other failed install keeps the
generic Addon request denied message. The owner reads the library once on demand
when its startup refresh left nothing in the cache, so an install does not depend on
that refresh having finished. If the administrator sends the same
operation ID again, the owner returns the stored failure, so the repeat gets the
generic message and not the refusal text. Use a new operation ID to see the
refusal again.
The SDK 2 surface
An add-on page gets these from the SDK object. The page component also receives the
query string of its address as search, next to page and path. Props pass through unchanged, and
the components are the ones the core pages use, so an add-on page and a core page
draw the same thing.
sdk.ui: Button, Text, Stack, Badge, Spinner, EmptyState, and the
shared PageHeader, ConfirmDialog, SideSheet, SidePane, PaneLayout,
ActionMenu, ErrorWithTraceLink, ModelSelector,
MediaInput, WaveformPlayer, DistributionBars, EmbeddingInspector,
TabSwitch, LoadingSpinner, Modal, Lightbox and ModelPicker. A ref
reaches the host component, so ModelPicker keeps its handle (open() and
focus()). ModelPicker is the one model picker of the core pages. It lists the
installed models and shows an alias as alias of <model>; an alias takes its
capabilities from the model it points to, so a capability filter finds it. Props:
value and onChange; capability; multiple (an array value, shown as chips);
allowCustom (a typed name is accepted); clearable; searchable; variant
(chip or field); models and loading when the add-on holds the list itself.
HomeModelPicker and ModelSelector stay as names for the same picker.
sdk.ui also has the settings kit, for a settings section or any form: see
The settings kit.
sdk.ui also has the Share dialog, ShareDialog, and the role and sharing line
of a list row, RoleBadge and SharedByBadge. sdk.resources.shareClient(resourceId)
is the dialog’s client for one resource of the add-on. See
The Share dialog.
sdk.theme.tokens: the host’s design tokens as CSS values (var(--dk-...)), for the
add-on’s own scoped style sheet: text, muted, surface, inset, edge, hover,
accent, accentText, accentWash, onAccent, okText, okWash, warnText,
warnWash, errorText, errorWash, space1 to space6, radius, radiusSmall,
radiusMedium, textMeta, textSmall, textBody, fontBody and fontMono. Every
value is a custom property the host theme defines, in both themes. The same custom
properties can be written in the style sheet directly.
sdk.hooks: useMediaCapture, useObjectUrl, useDelayedAction,
audioBufferToWavBlob, useModels, useResources, useVoiceProfiles,
useOperations and useMCPClient. They run in the host React, so call them like
any hook. A host without them gives an empty object.
sdk.navigation.openApp(address, { replace, state }): opens a page of the web app,
a core page or a page of another add-on. Only addresses under /app pass; any
other address, scheme or API route is refused. The only state a page may pass is
the way back, { from, fromLabel }, which the Model Editor reads.
sdk.portal(children, node): draws children into a node outside the add-on’s own
tree, for a full-screen sheet.
sdk.userSettings: get() and set(key, value), the settings that the add-on declared
for the signed-in person (see User settings). Both calls are bound to
the add-on that makes them; a page cannot name another add-on. A write is the person’s
own action from their browser session.
sdk.viewer: isAdmin() and hasFeature(name). They answer for the signed-in
user and are read-only. The server still decides every call.
sdk.iconNames: the icon names sdk.Icon can draw. Any other name draws a
neutral glyph. SDK 2 adds arrow-left, arrow-right, chart-bar, circle-dot,
clipboard, code, cube, filter-off, gender, globe, headphones,
help-circle, mic, play, plug-off, save, shield, smile, waveform,
camera, stop, circle, image, spinner, user-shield and mask. The Studio
and Talk add-ons add boxes, compass, gauge, ghost, git-branch, images,
key, layers, maximize, memory, music, pencil, repeat, server,
sliders, square-dashed, store, undo, video, volume, palette, phone,
columns and chevron-left. sdk.Icon passes a style object.
SDK 2 is a superset of SDK 1, but a range is checked as written. A manifest
that declares only "max": 1 is refused by a version 2 host. Before you raise
max to 2, check the add-on against the SDK 2 surface. A range that is
malformed (for example min above max) keeps the generic invalid or incompatible UI error.
Panels: a sheet, a pane and a row menu
sdk.ui also carries the three parts of a list with a detail and a form, the way the host’s
Add-ons and MCP connectors pages draw them. Use them instead of a panel of your own: Escape,
focus, the scrim and the phone layout are the host’s.
A create or edit form over the page: a head, one scrolling body and a footer for the buttons, with the primary action last. It is a dialog: focus moves in, Tab stays inside, Escape and a click on the scrim call onClose. Do not set a width on it; wide is the only other size.
The details of one item beside a list. Put it in a PaneLayout next to the list. From 1280 px it docks and pushes the list; below that it overlays the page, and on a phone it is a bottom sheet. Escape closes it and focus returns to the control that opened it.
PaneLayout
none
The row that holds the list column and a docked SidePane.
The connector pages (addons/internal/connector-ui) are the reference: a row list, a docked
pane and a sheet.
Runtime wire version 1
JSON field names and ordering follow the exported DTO declarations and
encoding/json; envelope.json fixes the canonical envelope representation.
Opaque arguments, payload, and preview summary are JSON, not executable
SQL or authority. This is not a cross-language cryptographic canonicalization
scheme; forwarding must bind the actual transmitted bytes. Unknown/duplicate
fields are rejected at manifest and envelope/result/preview/receipt boundaries.
An envelope consists of request and host-issued authority. Request carries
addonId, optional resourceId (empty for addon-level actions), operationId,
nonzero lifecycle generation, action, and object arguments. Authority
carries actor (userId, credentialId, mode), scope, and RFC3339
expiresAt. Modes are named-user and explicit local-owner; scopes are
read, preview, apply, output and act. The scope act and the action
act go together: an envelope has one only with the other. Principal IDs are opaque nonempty
strings up to 256 bytes. Syntactic validity is not authentication: the owner
must create authority, verify current identity/credential/ACL and mode, and bind
scope to the actual method. Never accept browser/model-provided approval.
Call Validate(now, limits) at admission; unmarshalling checks structure and
nonzero expiry but intentionally does not use the wall clock.
Runtime provides Read, Preview, Apply, Receipt and OpenOutput. A runtime that
serves action tools also implements ActRuntime (Act), described below. Preview is
{operationId,revision:{schema,data},expiresAt,summary}. Schema revision is
nonzero; data revision can start at zero. Apply receives that exact revision
separately and must reject stale schema or data. Receipt is
{operationId,state,revision:{schema,data},result}. States are pending,
committed, rejected, unknown; unknown is not success or rejection and must
be reconciled before another mutation. Committed receipts require a nonzero
schema revision. Result has optional payload and outputs; each output has
opaque handle, safe basename name, MIME mediaType, and nonnegative size.
Handles are not URLs or filesystem paths. A read tool may return payload next to
outputs: the host refuses a payload over 128 KiB and gives the model the payload as a
short excerpt next to the handles. OpenOutput returns an authenticated
stream; callers close it. DTOs do not create artifacts or authorize downloads.
The settings kit
sdk.ui carries the host components a settings section, or any form of an add-on, is
made of. They use only the host’s classes and tokens, so an add-on draws its settings the
way the host draws its own, in the light and the dark theme and at phone width, without a
style sheet of its own. Use them instead of plain <input>, <select> and class names of
your own: a class the host does not define has no style.
Component
Props
What it draws
Section
title, description, actions, testId
A titled block with a line under the title. Sections that follow each other are separated by a rule.
Field
label, help, unit, error, testId
A label, the control (the children), its unit after it and a help line under it. The label names the control.
Rows in one bordered list: a name, a line under it, a chip on the right, and details collapsed under a toggle.
Code
testId
A monospace block for a raw error or a command, wrapped and scrolled.
Actions
none
A row of buttons that wraps.
Table
caption, columns: [{key, label}], rows, testId
The host table.
Notice
severity (info, warn, error), title, reason, fixLabel with onFix, testId
What is off or not available, why, and one action. Hosts older than this release do not have it: fall back to Callout.
ExternalLink
href (https only), testId
A link out, in a new tab.
The Sandbox and Web sections are made of these components only (addons/sandbox/ui/src/Settings.jsx,
addons/web/ui/src/Settings.jsx).
Operation IDs and errors
Generate an operation ID once, before submission. Bind it to actor, addon,
resource, generation, action, arguments, and expected revision. Repeated IDs
with identical binding retrieve the same durable outcome; changed binding is a
conflict. Never retry a mutation under a new ID after timeout, disconnect or
unknown receipt. Cancellation does not prove rollback. Runtime implementations
must preserve these invariants transactionally; these contracts contain no
storage or deduplication implementation.
HTTP adapters should map malformed input to 400, missing authentication to 401,
current permission denial to 403, absent permitted resources to 404, stale
revision/generation or conflicting operation binding to 409, expired proposals
or artifacts to 410, oversized requests to 413, admission/quota limits to 429,
and unavailable owner/runtime to 503. A timeout (504) is an uncertain mutation
outcome requiring Receipt lookup, not implicit retry. Errors must be redacted
and must not leak paths, credentials or unauthorized resource existence. No HTTP
error DTO or endpoint is implemented by this package.
Finite implementation defaults
Start with DefaultLimits(), change explicit host configuration fields, then
call Validate(). All values must remain positive; zero never means unlimited.
Durations are time.Duration (nanoseconds if serialized as JSON). These are
implementation defaults, not immutable product requirements.
Limit
Default
Manifest / envelope / payload bytes
64 KiB / 2 MiB / 1 MiB
Read / preview / apply / shutdown timeout
30 s / 30 s / 60 s / 10 s
Initial / maximum backoff; attempts
250 ms / 30 s; 5
Batch size / query depth / query rows
100 / 8 / 1000
Query result bytes
1 MiB
Proposal expiry / artifact expiry
5 min / 1 hour
Single artifact / aggregate artifact quota
100 MiB / 1 GiB (a stored artifact is at most 64 MiB, the relay bound)
Artifact count / concurrency
100 / 4
Initial backoff cannot exceed maximum; single artifact cannot exceed quota;
query bytes cannot exceed payload bytes, which cannot exceed envelope bytes;
query depth cannot exceed the parser’s 64-level ceiling. Runtime/owner consumers
must enforce timeouts, bounded backoff (without new mutation IDs), query/batch
limits, proposal lifetime, artifact expiry/quotas and concurrency. DTO validation
alone does not run timers or jobs. Default JSON unmarshalling and ParseManifest
use fixed default ingress bounds; a transport needing different bounds must use
a bounded, strict wire decoder and validate the resulting DTO with its configured
limits (not rely on default unmarshalling to enlarge ingress limits).
Verification
Run sh scripts/addons/verify.sh contracts. The inventory requires every named
Ginkgo case to pass in its JSON report: no empty selections, skips, stale reports,
or successful commands without reports. sh scripts/addons/verify.sh prerequisites
regression-tests those gates and checks real native toolchain/browser readiness.
Look up the private catalog service, how a package is staged and verified, the durable lifecycle and the managed runtime. This page is part of the Add-on contract reference.
Private catalog service
core/services/addons/catalog provides owner-side source configuration, refresh,
search and release resolution. It does not expose routes, UI, installation or
runtime execution yet. Model and backend managers remain separate.
Construct Sources with a protected owner configuration path, an authoritative
AdminCheck, and a CredentialResolver. Save creates or replaces a source;
Source{ID: id, Removed: true} explicitly removes one. Source records contain
ID, display name, HTTP(S) URL, enabled state, authentication reference and
verification policy. Files are replaced atomically with mode 0600. The operator
must provide a private parent directory and only one writer. Loading rejects
symlinks and group/world-readable files. Source edits invalidate cached results.
Removing a source never opens or changes installed packages, receipts or data.
Installed receipts must retain their pinned source; changing that association
requires a separate authorized lifecycle operation, not a catalog refresh.
Authority and credentials
The existing core/http/auth.RequireAdmin checks an authenticated Echo user’s
role. contract.Actor has no role and is not an authenticated Echo context.
This service therefore injects AdminCheck(context.Context, contract.Actor);
a missing checker denies all edits and configuration reads. The future owner adapter must revalidate
current user, credential and administrator status. It must not infer privileges
from user IDs, mode strings, model arguments or browser values. Refresh is an
internal owner operation; a future public refresh/test route must enforce admin
authority before calling it. No new secret endpoint is provided.
Configure reference bindings only in trusted owner code. Each binding pairs an
exact scheme/host/port origin with a pkg/credentials.Store. That store supports
bearer/basic secrets, including existing environment/file references. Secrets
resolve at request time. Source JSON contains only the reference; resolver JSON
omits bindings. Catalog credentials are not installed into the OCI downloader’s
store and releases do not carry authentication references. Configure OCI pull
credentials separately. Plain HTTP credentials require the store’s explicit
allow_insecure setting; use HTTPS in production. URLs with embedded credentials,
query parameters or fragments are rejected.
All catalog requests use pkg/httpclient, a 30-second timeout, and no redirects.
Redirect, credential, HTTP-status and parse failures return redacted errors, not
remote bodies or URLs. A failed refresh records its check time and last successful
refresh time and prevents stale cached releases from resolving successfully.
Catalog document and limits
A catalog (the library index) is one YAML document: a block list of releases with
id, name, optional description, version, artifact
(oci://host/repository), digest (sha256: plus 64 lowercase hex characters),
os and arch. It uses the same format as the model and backend gallery indexes:
- id:tablesname:Tablesdescription:Tables for LocalAIversion:1.0.0channel:latestartifact:oci://quay.io/go-skynet/local-ai-addons:1.0.0digest:sha256:0000000000000000000000000000000000000000000000000000000000000000os:linuxarch:amd64ui:title:TablesmainPage:databases
An entry may carry a kind (see Backends in the library);
without it the entry is an add-on. Unknown fields, a second YAML document and duplicate keys are rejected. A JSON
array is refused too, even though YAML can read it: write the index as a block
list. An empty library is []. Package manifests (manifest.json) stay JSON; only
the library index is YAML. Source identity and verification policy always
come from protected source configuration, not from the remote release.
The policy describes requirements for later package verification; refresh does
not claim to verify executable signatures.
A release may carry an optional ui object of display hints: title, description
(default-language plain text), mainPage, icon (a path inside the package, never a
URL) and launchMode. They follow the manifest rules for bounds, markup and
launch mode, and a catalog that breaks them fails refresh as a whole. They only
help browsing before install: the manifest inside the verified package is what an
installed addon shows, and the host serves an icon only after install.
A release may also carry toolCount and tools, the same names the installed view
uses: the chat tools the package declares in capabilities.tools (admin tools are
not chat tools and are not counted). tools holds at most 32 names and toolCount
is the full number. The add-on cards, the Find add-ons tab and the details panel show
“Adds N tools” from them before install. addonpkg catalog writes both fields, and
addonpkg catalog-tools adds them to an existing index from the manifests in
addons/<id>/manifest.json. They are a hint like ui, and only an add-on entry may carry them.
A release may also carry hostOperations, with required and optional lists: the host
operations that the manifest requests in capabilities.hostOperations, sorted. The UI shows
them before install, so a person does not need to download the package. The release index
(addons-index.yaml) and the development index (gallery/addons/index.yaml) carry the field
for every add-on entry, and hostOperations: {} means the manifest requests none. A host that
predates the field (before commit f36dd6a5d) refuses an index with an unknown field, so a
development or master build older than that commit lists no add-ons until it updates.
addonpkg catalog and addonpkg catalog-tools write the field only when they get
--host-operations-in-index, and catalog.sh passes it for both channels. An entry
without the field has no hint. The field is a hint like ui: the install checks the verified
manifest in the package, and the request there decides what the add-on asks for.
Every release that the host lists also carries official. The host sets it when it reads
the index, from the ID and the address of the library. It is true only for the official
library at an address that LocalAI ships, so a library that an administrator named official
at another address does not qualify. An index cannot set it: the host overwrites whatever
the index says. The install dialog uses it to decide whether to warn about the source.
Refresh accepts at most 1 MiB and 1,000 releases. Duplicate release identities
within a source fail. Duplicate names across sources remain distinct. Search
matches names, IDs and descriptions, sorts by source/release identity and uses
a default page size of 50 (maximum 100). Disabled sources are neither searched
nor fetched. Resolve requires an explicit source, addon ID and exact version;
it selects only the exact owner target OS/architecture. Configure Catalog.TargetOS
and Catalog.TargetArch in trusted owner code before use; each empty field defaults
to this process’s runtime.GOOS/runtime.GOARCH. Forwarded installs must use the
owner’s target, never the forwarding frontend’s platform. An absent target returns
ErrNotFound; ambiguous exact-target entries fail closed (duplicate identities are
also rejected during refresh). Search still shows all available platforms. Optional channel labels (for example latest, development, or branch/name)
resolve to a single exact-platform release and its pinned digest. version remains
the immutable manifest version; selection is stamped by Resolve, never trusted
from remote metadata. This service does not silently choose a source or upgrade.
Sources.List(ctx, actor) and Sources.Get(ctx, actor, sourceID) recheck the same
authoritative AdminCheck used for edits. List returns all configured sources in ID
order, including disabled libraries and libraries with no releases or no successful
refresh. Get returns ErrNotFound for an unknown source after authorization. Both
return independent value copies with authentication references and verification
policy, never resolved credential values. Reads are serialized with source edits
and refresh; configuration remains readable after reload without refreshing.
State uses the documented per-instance designated-owner exception: only the
configured owner constructs this service. Configuration persists; the bounded
catalog cache is rebuilt by explicit refresh after restart. Replicas must forward
to that owner, not construct independent caches or fall back on owner failure.
Run sh scripts/addons/verify.sh catalog for private bearer/basic HTTP fixtures,
redirect rejection, isolated credential references, disabled sources, refresh
failure, duplicate names, owner-target resolution, source persistence/removal,
denied reads/edits, defensive copies and concurrent configuration reads.
Verified immutable package staging
The designated owner uses packages.Installer.Stage followed by Commit. Stage
re-resolves the exact catalog selection and rejects caller-substituted policy,
source, platform, artifact or digest. A stale channel selection must be resolved
again explicitly. Package metadata cannot override the source administrator’s
verification policy. Installable code is trusted code, not a sandbox.
OCI images are distribution archives, not running containers: no Docker daemon
is needed. The installer pulls the catalog-pinned per-platform manifest digest,
checks image platform and compressed layer hashes, and uses the existing
Sigstore verifier when the configured source requires signatures. The original
reference and selected channel are retained alongside the actual digest. OCI
credentials remain in the registry credential store; catalog HTTP credentials
are never passed to a registry or package URL. A registry may redirect a
digest-pinned blob download to a storage host, as quay.io does. The installer
follows that redirect only, at most three times, without the registry
credential, and checks the blob digest on the bytes it receives. Every other
registry redirect is refused.
When the manifest declares ui.icon, staging opens it inside the package without
following links and requires a regular file of 1 byte to 256 KiB whose first bytes
are the signature of the declared type (PNG, WebP or JPEG). A missing, empty,
oversize, linked or mistyped icon fails staging. The receipt records the icon’s path,
SHA-256 digest, size and media type; the host serves the icon only if the bytes still
match that digest. A declared ui.glyph is checked and recorded the same way, with
PNG and WebP as the only types.
HTTPS package URLs distribute uncompressed tar archives with a required catalog
SHA256. HTTP is rejected unless an administrator explicitly sets the source’s
allowLoopbackHTTP for a literal loopback IP (development/testing only); public
insecure HTTP and credential-bearing URLs are rejected. HTTP package downloads
are anonymous and do not reuse catalog credentials; redirects are refused.
Archive signature verification is not implemented: a source requiring signatures
must distribute OCI, and HTTP packages from that source fail closed.
Packages contain manifest.json, the declared executable, and any declared UI
entry/CSS files. A service-only manifest needs no fake UI files. Host/API/protocol,
data format, SDK (only with UI), identity/version and platform must match. All
entrypoints/assets must be real regular files inside the immutable package;
executables must have the owner execute bit. Links, special files, traversal,
duplicate paths, file/directory collisions, and a supplied receipt.json are
rejected. OCI layers cannot overwrite earlier paths: packages are flattened
application bundles, not general-purpose container root filesystems.
Defaults cap compressed downloads and extracted content at 512 MiB (a backend image has its own
limit) and archive
entries at 10,000; owner configuration may set smaller positive limits. Staging
is private, cancellation-aware, and removed on failure. Existing packages are
never replaced or deleted. Commit publishes a unique read-only package directory
with receipt.json containing source, selection/channel/reference, verified digest,
verification result and manifest. The opaque stage handle is installer-bound and
single-use. Root must be owner-controlled, separate from mutable data, backups,
and addon-writable directories. Publication does not activate or start code;
lifecycle journaling and abandoned-stage recovery belong to the owner manager.
Run sh scripts/addons/verify.sh packages for local HTTP and OCI registry fixtures,
malicious archives, compatibility checks, cancellation, storage failures and
immutable publication. No external container images are published or downloaded.
Package transport applies the source’s allowLoopbackHTTP development opt-in
at the OCI transport boundary, including registry authentication and signature
requests. Without it, implicit loopback HTTP fallback is rejected before any
plaintext request. Non-loopback HTTP is always denied, and a blob redirect
target must use HTTPS or, with the opt-in, a literal loopback IP. Other registry
redirects are denied.
The expanded package byte limit counts the entire decompressed stream before
TAR parsing: PAX/GNU metadata, file headers, payload, padding, and trailing bytes,
cumulatively across OCI layers. Downloaded compressed bytes have a separate
budget of the same configured size. Failed staging leaves installed packages intact.
The focused package tests use local OCI registries and block external trust
requests. Hermetic signed fixtures include trusted Fulcio, SCT and Rekor material
and exercise successful cryptographic verification, staging and commit. They also
verify rejection of signed identity, digest and trust mismatches. These offline
checks do not demonstrate live Sigstore verification; production signature
requirements are unchanged.
Extraction bounds both the decompressed TAR stream (including metadata, padding,
and trailing bytes) and cumulative file output across all OCI layers. Sparse
files cannot bypass the output limit by representing large holes with small TAR
entries. Failed staging removes temporary output without changing old packages.
Embedded hosts may explicitly provision Installer.SignatureTrust for a private
Sigstore deployment. This is host configuration, never catalog or package data;
it replaces only the trust material. Certificate identity, SCT, Rekor timestamp,
and artifact digest checks remain enabled. Leaving it unset retains public
Sigstore TUF trust. Offline acceptance fixtures generate local CA, signing, CT,
and Rekor keys and exercise the same signature verification and staging path;
they do not disable cryptographic requirements or depend on live services.
Durable lifecycle and designated ownership
The lifecycle library uses a designated-owner per-instance state exception.
It does not use a rotating leader loop, election, or automatic failover.
Embedded hosts construct addons.NewManager with an explicit OwnerConfig:
InstanceID identifies this process’s deployment role.
OwnerID identifies the only role permitted to own addon storage.
OwnerAddress is the configured HTTPS address of that owner.
StorageID identifies the durable local volume.
Root is an absolute, private, owner-controlled directory.
SharedStorage must be false. Shared-storage deployments are unsupported.
The host must assign unique instance identities and a local filesystem with
working advisory locks, atomic rename, and file and directory synchronization.
A process holds the storage lock until Manager.Close. The stored owner identity,
address, and storage identity must match on restart. A conflicting configuration
fails instead of adopting existing storage. Do not mount this root on replicas.
A frontend manager never creates or opens the root, even when the owner is absent.
Its lifecycle calls return ErrNotOwner; forwarding transport is a separate layer.
Application bootstrap accepts config.WithAddons(config.AddonConfig{...}).
Enabled defaults to false; no owner is inferred from missing configuration.
The owner loads protected sources and reconciles its journal before exposing
Application.AddonManager(). Application shutdown releases the storage lock.
Forwarding instances construct no catalog or installer and never reconcile storage.
AdminCheck is mandatory on the owner and excluded from serialized settings.
Host optionally sets compatibility; its zero value uses the current host and
version-one contracts. OwnershipMode is named-user (the default when empty) or
local-owner; see “Explicit local-owner mode” below. local-ai run sets it from
--addons-ownership-mode. Like the rest of AddonConfig it is startup-only
configuration with no runtime setting, and every frontend of one
deployment must use the same value.
Application bootstrap starts enabled addon processes after durable reconciliation.
The host supplies an authoritative catalog.AdminCheck. It must check current
account, credential, and administrator status, including for duplicate requests.
Actor fields do not grant administration rights. Installation rights do not grant
database access.
Submit accepts install, upgrade, enable, disable, and uninstall.
Install and upgrade consume the actual catalog and immutable package installer.
Installation starts disabled. Enable records desired state; it does not report
that a process is running. Status separates installed state, desired state, and
observed health. StartEligible requires ownership, installation, enabled intent,
and no unfinished operation. Runtime supervision is a separate layer.
Operation IDs are global to the owner journal. A retry must carry the same actor
and complete command. Conflicting reuse returns ErrConflict. Failed operations
remain failed; an explicit retry needs a new operation ID. Commands serialize
through the manager lock, including commands for the same addon.
The journal synchronizes complete snapshots at intent, prepared, applied, and
completed boundaries. Published packages are synchronized before prepared state.
Call Reconcile after restart before admitting runtime work. Recovery fails
unfinished intent rather than repeating a download or publication. Prepared and
applied operations finish from their recorded generation without resolving a new
catalog release. Persistence errors block further commands until reconciliation.
Uninstall clears installed and enabled intent. It retains the generation
history, addon identity, data paths, and grant metadata. Mutable data lives under data/;
owner metadata lives under metadata/; immutable packages live under packages/.
Reconciliation removes abandoned stage-* directories. It then removes the
published package-* directories that nothing needs. The same sweep runs after
each completed install or upgrade. A failed upgrade publishes its candidate
before it starts it, so each failed attempt leaves one. The journal keeps the
receipt of every generation, but only two packages of each add-on stay on disk:
the current generation and the one before it, which a failed upgrade starts
again (installed or not). A package is also kept when it is one of those two
generations in the pending state of an operation, the package of a running
process, the canceled upgrade that the same operation ID can continue, or when
an unfinished data recovery upgrade names its digest. A
package published just before a crash, whose operation recovery marks failed,
is removed. When a recovery journal or state file cannot be read, or the journal
names a package outside packages/, the sweep removes nothing and logs why.
Links are never followed. Each removed directory is logged with its add-on ID
and size, followed by the total freed.
Drain, backup, and migration hooks are interfaces only. The lifecycle library does
not claim to execute those operations. Later runtime integration must implement
these hooks before changing packages for running processes or migrating data.
Run sh scripts/addons/verify.sh lifecycle for journal interruption, ownership,
idempotency, retention, and real catalog/package integration tests.
Owner bootstrap reconciles the journal and starts the enabled add-ons, and refreshes
all persisted enabled sources in the background. The server does not wait for the
refresh: until it ends, the release cache is empty, as after any failed refresh. The
release cache is not durable. The whole startup refresh has a 30-second deadline (or the
earlier application-context deadline); an offline or invalid enabled source costs a log
line, not the start. The enabled add-ons start four at a time. Disabled sources are never fetched. Forwarders neither read source metadata nor
contact catalog/package servers. Embedding hosts can use Application.AddonSources()
(owner only; nil on forwarders) for authoritative source administration and explicit
live Refresh(ctx, sourceID) calls; no background update loop is started.
Recovery rejects symlinked package roots and ancestors before enumerating staging.
Staging cleanup uses directory-rooted operations and descriptor-based permission
changes so links cannot redirect cleanup into external storage.
Managed runtime
Application startup attaches the process supervisor only on the configured owner,
after journal reconciliation. Enabled generations start at attachment. Enable,
disable, upgrade, uninstall, and application shutdown synchronize process state;
disable and uninstall retain data. Forwarders do not attach a supervisor or execute
packages. No automatic owner failover is provided.
An upgrade of a running add-on proves the new generation before the journal
moves: the owner stops the running process, starts the new generation and waits
for it to become ready. When it does not become ready, the previous generation
is started again, the journal keeps it as the installed generation and the
operation fails (a new operation ID retries). The published package of the failed
release stays on disk; retained data is untouched. Killing the owner during that
start has the same result after a restart, because the journal never named the
new generation.
An enabled add-on whose process cannot start does not stop the owner. Startup
records the failure for that add-on only: it stays enabled in the journal and
stopped in the observed state, the other add-ons start, and commands on other
add-ons are not delayed or failed by it. The command that enables or upgrades the
broken add-on reports the failure, and a restart tries it again.
The owner executes the receipt’s package-relative executable directly with the
single argument --localai-addon-v1. There is no shell. The environment allowlist
is LANG=C and TZ=UTC; host credentials and proxy variables are not inherited.
Descriptor 3 contains an ephemeral listener bound to 127.0.0.1. Descriptor 4
contains one newline-terminated JSON runtime.Startup object: registration,
private random bearer credential, and finite host limits. The child must monitor
that descriptor after decoding and exit on EOF. EOF is cooperative liveness, not
an ownership fence: a paused child may not observe it before its owner restarts.
Windows cannot pass numbered descriptors, and a child cannot turn an inherited
socket into a listener. On Windows the owner passes two inherited pipe handles
instead and names them in two more environment variables:
Variable
Handle
LOCALAI_ADDON_STARTUP_HANDLE
Read end of the startup pipe. It carries the same runtime.Startup object as descriptor 4, and EOF has the same meaning.
LOCALAI_ADDON_ENDPOINT_HANDLE
Write end of the endpoint pipe.
The child binds its own listener to 127.0.0.1 on an ephemeral port, writes the
address as one line (for example 127.0.0.1:49152, at most 64 bytes with the
newline) on the endpoint pipe and closes it. The owner then writes the startup
object, whose registration names that endpoint. The owner stops a child that
reports any other address, or that does not report within the ready timeout.
The environment of the child also has SYSTEMROOT (the network stack of
Windows needs it) and TMP and TEMP (the temporary folder of LocalAI). The
executable must end in .exe, because Windows has no execute bit.
A package with "osSettings": {"windows": {"execution": "wsl2"}} (see Manifest) runs in a WSL 2
distribution on a Windows host. No handle of the owner exists there. The owner starts
the executable through wsl.exe with LOCALAI_ADDON_CHANNEL=stdio, and the standard
input and output of the process carry one multiplexed session (yamux). The owner is the
client and the add-on is the server:
Stream
Opened by
Carries
First stream
owner
The add-on writes its process ID as one decimal line (at most 24 bytes with the newline). The owner then writes the runtime.Startup object. The end of this stream, or of the session, has the meaning of EOF on descriptor 4.
Every later stream
owner
One connection to the protocol endpoint of the add-on.
Every stream
add-on
One connection to the host operation endpoint.
The owner serves the protocol endpoint on a 127.0.0.1 port of Windows, so the
registration names a Windows address. The SDK serves the host operation endpoint on a
127.0.0.1 port in WSL and writes that address in the startup object, so the add-on
reaches the host without a network path from WSL to Windows. Standard error stays the
log stream. The SDK points standard output at standard error, so a print never goes
into the session. When the session ends, the SDK ends the process after the shutdown
budget and two more seconds.
The Go SDK does this for you: protocol.Run uses the descriptors, the handles or the
standard streams, whichever the owner passed. An add-on that does not use protocol.Run calls
protocol.StartupChannel and protocol.Listener in place of opening
descriptors 4 and 3 itself.
The supervisor requires a private durable StateRoot (application default:
<addon root>/runtime). The path must be absolute and must not contain a symbolic
link. A separately locked, fsynced process ledger records the boot identity, PID,
kernel start time, and incarnation of each child before startup credentials
are sent. A pending record is persisted before exec. A restarted owner recovers
all recorded children, checks exact identity, sends termination, and waits for
confirmed exit before any replacement launch. Reused PIDs are not signaled.
Corrupt, incomplete, unreadable, or uncertain pending
records fail closed; operators must establish that prior children are gone before
repairing the ledger. Do not delete runtime metadata to bypass recovery.
How identity is read and how a child is stopped depends on the platform:
Platform
Identity
Recovery
Linux
/proc boot ID and process start time
A pidfd is opened before the identity is read and the signal goes through that handle, so a recycled PID cannot be hit. Readable /proc and pidfd support are required.
macOS
kern.boottime and the process start time from kern.proc.pid (microsecond resolution), read through sysctl
The identity is read, then the PID is signaled. macOS has no pidfd, so the check and the signal are two steps. PIDs on macOS rise in sequence and wrap at 99999, so a recycle inside that gap is not realistic, but the gap is not zero.
Windows
The process creation time, an absolute time with 100 ns resolution, read through a process handle
A process handle is opened before the creation time is read, and the process is terminated through that handle, so a recycled PID cannot be hit.
Other systems refuse runtime startup rather than weaken identity checks. This is not a sandbox
or descendant containment: installed code is trusted, and must not detach workers
outside the supervised process lifetime. On Windows the owner also puts each
add-on process in a job object that stops every process in it when the add-on
stops, and when LocalAI itself exits. On Windows the state root must not be a
link, but it has no permission check: see the security limits in
Install on Windows.
Every local HTTP request requires the bearer credential and
X-LocalAI-Incarnation. The authenticated /health response must exactly match
the supplied registration, including protocol 1, endpoint, generation, incarnation,
and manifest capabilities. Capabilities are visible only after readiness and are
withdrawn on stop, exit, or failed health. Health is checked periodically. A restart
uses a fresh credential and incarnation, bounded exponential backoff, and the
configured attempt budget; sustained authenticated health resets that budget.
The protocol uses POST with JSON on /read, /preview, /apply, /receipt, and
/output, and on /act, /connector, /client and /client/stream for the add-ons that
declare actions, a connector or client routes (see
Paired clients: inference and add-ons). Read and preview accept the existing contract envelope. Apply wraps it
with a revision; output wraps it with a handle; receipt accepts an operation ID.
These transport wrappers are defined in the runtime package because the original
contract specifies Go methods but not their HTTP request DTOs. No contract method
or authority semantics changed. Receipt lookup is an internal recovery operation,
not a public authority-free endpoint. The host must authorize access before calling
the runtime client; model arguments cannot supply trusted authority.
The client rejects redirects, nonliteral/nonloopback endpoints, stale generations,
wrong method scopes, expired authority, oversized responses, and excess concurrent
requests. Streams have byte and time limits and propagate cancellation. Stop rejects
new admission and withdraws registration before bounded draining. Termination uses
the retained OS process handle, never a reconstructed numeric PID. An old stopped
instance cannot terminate a newer generation. The addon slot stays reserved during
drain and restart startup, including while the next process is not yet ready.
Stop success means all slot launch workers and processes have finished; cancellation
or cleanup timeout returns an error, retains the reservation until confirmed
cleanup, and never authorizes an overlapping generation. A failed durable cleanup
fences further launches. Stop callers wait at most two shutdown intervals; startup
callers wait at most readiness plus two shutdown intervals.
Supervisor.Current(ctx, addonID, generation) and Manager.Runtime(ctx, addonID)
explicitly obtain the current ready incarnation under lifecycle locks. A client
previously returned by Start or lookup stays bound to its original incarnation and
rejects calls after withdrawal. No stale mutation is transparently replayed on a
replacement; callers must use the existing operation/receipt recovery protocol.
Default shutdown is 10 seconds;
readiness is 30 seconds, restart delays range from 250 milliseconds to 30 seconds,
and the restart budget is five attempts. Runtime startup failure leaves durable
enabled intent intact for explicit reconciliation; it does not claim healthy service.
Shutdown withdraws admission and starts cleanup for all managed addons before
waiting for any child. Cleanup errors are combined; a timeout does not release
the process ledger or owner fence. Retry shutdown to join outstanding cleanup.
A completed lifecycle journal receipt records durable desired state, not proof
that runtime synchronization succeeded. Replaying the same authorized operation
ID retries synchronization against current desired state and returns cleanup or
startup errors until synchronization succeeds. It does not repeat package
publication or restore an older operation’s desired state.
If lifecycle publication fails and the manager closes its runtime, that manager
requires recovery. Status, lifecycle submission, and reconciliation cannot report
success using retained instance handles. Repair the storage fault, successfully
close the manager, and create a new owner manager and supervisor to reconcile the
durable journal. The same process identity checks as above still apply;
ambiguous pending launches require operator recovery rather than an unsafe kill.
Look up the action tools, the host operations an add-on can call, the user settings, the provider slots and the model search sources. This page is part of the Add-on contract reference.
Action tools
A tool of kind action does what a person asked a chat to do, at once, as that
person, and in that person’s own space. It is not confirmed in the browser and
it is not a proposal. The sandbox add-on, which runs a command, and the office
add-on, which edits a file the user owns, use it. An action tool is not for
data of a shared resource: a change that others see is a write, schema or
create tool, which the OpenAI-compatible route leaves as a proposal for a
person to confirm.
Declaration. The tool is in capabilities.tools with a definition of kind
action, and the manifest sets capabilities.actions to true. The host
refuses a manifest that declares an action tool without it. An action tool
names no resource: if its schema has a resourceId, the host ignores the
value the model gives and sets it to the ID of the conversation.
Who may call it. Only the chats consumer (studio-chats-addons in the
consumer table of Tables). Every other consumer neither lists the
tool nor runs it: the old chat route, the direct API, agents and scripts.
The call.POST /act with an envelope whose action and scope are act.
The actor is the user of the chat. The answer is a Result. The call may run
up to ActTimeout (30 minutes), is never retried by the host, and an add-on
that dies during it gives the caller outcome_unknown. The request carries the
chat’s conversation ID in resourceId. The host sets it from the chat, the
model cannot name it, and an add-on uses it only to keep state for that chat,
never as authority.
Undo. What a tool does to the user’s files is a change in the history of
their workspace, and it can be undone there.
Runs with nobody present. A trigger or an agent job calls the tools of an
add-on under the action policy of unattended runs. The kind of the tool
decides the class: read always runs, and every other kind is refused unless
the run holds act.addons (or act.addons:<add-on id>). A tool that the host
gates with a permission, because the add-on holds a credential, also needs
act.spend. Declare read only for a tool that changes nothing. See
Action policy of unattended runs.
Host operations
Required and optional operation admission
A verified manifest can request exact operation names with
capabilities.hostOperations.required and .optional. These are requests,
not grants. The owner compares them with the host operation vocabulary
and the immutable host policy selected at startup. A manifest without
requests keeps its configured behavior.
Coverage uses the broker’s literal, nonempty prefix rule. For example,
workspace. covers the requested name workspace.materialize;
workspace.materialize.narrow. does not. Registry membership is an exact-name
check: a grant cannot make workspace.future a supported operation. Requests
are exact names, not prefixes, patterns, or authority for selecting providers.
The owner verifies and stages a new install or upgrade before admission.
Missing required requests refuse publication, before installed records,
migrations, runtime withdrawal, or process creation. A refused upgrade retains
the old receipt, digest, generation, and running incarnation; it needs no
rollback. Automatic upgrades suppress further attempts for the same failed
candidate until a different candidate appears or the owner restarts. They never
acquire grants or prompt for approval.
After an operator removes required grants and restarts, the package remains
installed with its enabled intent. Its effective runtime is unavailable
(failed in Apps), and the owner admits no launch, tool, resource, connector,
or page access. It does not offer installation as a repair. Restore the host
policy to make it available again. The policy file and flags are read at startup,
and a change of them needs a restart. Grants and deny rules that an administrator
sets in the UI apply live: a revoke or a deny stops an add-on that loses a
required operation, and a grant or a lifted deny starts one that was refused,
without a restart. Subsequent manager SetHostOps calls do not replace the
startup decision.
Missing optional requests permit a degraded start. Existing admin Apps details
and lifecycle operation results include bounded required, optional, granted,
and missing name lists with counts. Here “granted” counts only supported
requested names covered by host policy, not every grant the addon holds.
Ordinary Apps readers receive the generic failed observation without policy
paths, grant details, or missing operation names. Split deployments carry the
owner’s decision; a frontend cannot supply grants.
Admission does not authorize an individual call. The broker still requires a
registered handler and rechecks the live incarnation, operation scope, actor
features/admin status, workspace/chat access, and connector binding. Handlers
are wired as host services start; admission uses the host’s startup operation
vocabulary rather than treating not-yet-wired handlers as unknown operations.
A host operation is how an add-on process asks the host to do something the
add-on cannot do itself, such as starting a job of the engine. It is contract
surface that third-party add-ons cannot use unless the host setting names them.
An add-on that serves paired clients can also ask client.list for the clients
that may reach it (see Paired clients). When a client call serves a client with a folder grant, client.workspace.list, .read and .write give it text files of the owner (same page).
The rules:
The host lists every operation in its code. No add-on gets an operation that
is not listed, and an operation that is not registered is refused. The
default is refuse.
The host setting --addon-host-ops (LOCALAI_ADDON_HOST_OPS) names the
add-ons that get the channel and the operation prefixes each may call, as a
comma list of addon-id=op-prefix. The generic binary grants nothing when
unconfigured. An explicitly empty value names nobody, including in Docker.
An administrator can instead select a file with --addon-host-policy; see
Administrator host operation policy
for precedence and explicit-empty behavior.
This is a host setting, not a manifest field and not a model argument.
An add-on that the setting names finds two optional fields in its startup
object: hostEndpoint, a loopback address of the form
http://127.0.0.1:<port>, and hostCredential, a secret of its own that is
never the credential of the host-to-add-on channel. Both belong to one
incarnation and end with it. An add-on that is not named gets neither field.
The protocol version stays 1, and an add-on that ignores the fields works as
before.
A call is POST with the header X-Addon-Host-Credential and a JSON object
{"operationId", "op", "arguments"}. operationId is the ID of a request
the host is serving for that add-on at that moment. The host looks up the
envelope it issued for that request. A call with no live request, with an
expired authority or with a scope below the scope of the operation is
refused, except as System operations and
inbound operations say. An apply operation needs an apply request; a read operation
runs under a read, preview or apply request. One act operation,
workspace.import, also runs under the apply of a write tool that declares
chatFiles, when a chat proposed the change, and only into that chat’s
folder (see Workspace operations).
A System operation never runs under such an apply: it needs a person on an
add-on page, and LocalAI refuses to register an operation that is both.
The operation runs as the actor of that envelope, never as a user named in
the arguments. The host refuses an argument with a name of identity or
authority (for example userId, scope or approved).
The host checks the feature of the operation for that actor, as the route
middleware does for the same request. In local-owner mode the actor is the
local owner and holds every feature.
A body larger than the payload limit is refused. An operation that is marked
idempotent runs once for one operation ID; a repeat gets the first result.
A process that does not run the add-on manager offers no endpoint, so the
operation fails closed.
The answer is {"result": ...} or {"error": {"code", "message"}}. The error
codes are no_live_operation, scope, feature, unknown_op, bad_request,
too_large, not_found, conflict, unavailable and not_committed (only
for registry credentials and the
instance operations).
The channel itself ships with no operation. Each operation is added by its own
change and documented with it.
Inbound operations
One class of operation has no user behind it: a message that comes from outside,
such as a Telegram message pushed by an add-on. Its scope is inbound. The rules
above change in these ways, and only for operations the host registers with that
scope (today connector.inbound):
No live request is needed. The authority is the credential of the add-on’s live
incarnation, which only that process holds and which ends with it. A missing,
wrong or old credential is refused with no_live_operation (401), and so is the
credential of another add-on, because each add-on has its own listener.
The call has no actor and no feature check. The operation must find its
authority in the host’s own records. For connector.inbound that is the stored
binding: it must name the calling add-on and be switched on, or the call is
refused with scope (403), also when the binding does not exist. The owner and
the agent come from the binding. An argument that names a user, an actor or an
owner is refused with bad_request before the operation runs.
The add-on ID is the one the host built the listener for, never a value of the
call. The host setting must still name the operation prefix for the add-on
(telegram=connector. in the stock Docker policy).
Every other operation keeps all its checks. An operation cannot become inbound by
a field of the request: the scope is part of its registration.
Delegated operations
Some add-ons act for a person when nobody uses them: a nightly report that
asks for approval, a watcher that summarizes what it found. Six operations
let them do that for the person who chose to allow it. Their scope is
delegated.
Operation
Risk word
Does
delegation.get
read
returns the ID of the caller’s delegation for this add-on (empty when there is none), the connection by kind and name, the model, and the agent by name with the number of tools allowed. Needs a live request.
connector.notify
network
sends a message, with up to four actions, to the notification chat of the delegated connection
connector.actions
read
returns the answers to the actions of the add-on’s messages until the add-on acknowledges them
model.chat
runs jobs
runs one chat completion with the delegated model, as the person, with tools and structured output
agent.run
runs jobs
starts a run of the delegated saved agent, as the person, with the tools the person allowed
agent.result
read
reads the state and the final reply of a run that the delegation started
The delegation. The authority of a call is a record that the person makes
in their own browser session: in the details of the add-on, under
Your choices for this add-on, or with the routes below. It names one of
the person’s connections, one model, one of the person’s saved agents with
the tools its runs may call, or any of them. The add-on never names the
person, the connection or the owner. It names the delegation by an opaque ID
(dlg_ and 20 characters), which it learns with delegation.get while the
person uses it, and stores for later.
With a live request of a person (a page or a tool call), the add-on may
leave out delegation: the host uses the caller’s. An ID that is not the
caller’s is refused.
With no live request the add-on must give the ID. The operationId is
any ID under which the host holds no request; a call of a paired client or
of a leased job counts as a background call too. At most 4 background calls
of one add-on run at once; a further one is refused with conflict.
Each call checks again: the grant of the operation, that the delegation
exists and was made for this add-on, and for connector.notify that its
owner is an active account that still holds the connectors feature and
that the delegated connection still belongs to that owner. model.chat
leaves the account checks to the chat route (below). connector.actions
names no delegation: it returns only the answers to this add-on’s own
messages. An unknown
ID, the ID of another add-on or of another person, and a connection that
changed hands are all refused with scope (403) and the same words, so an
add-on cannot probe what exists.
Revoke. The person clears the choice (Stop, or
DELETE /api/addons/{id}/delegation): the ID stops working at the next
call, and a new choice gets a new ID. The administrator revokes the
operation on the Host access page, as for every operation.
Uninstall and deleted accounts. An uninstall deletes the delegations of
the add-on and the answers it did not acknowledge, with its grants. Runs
that are going end as usual and stay in the agent’s run history. If they
cannot be deleted, the uninstall fails and the add-on stays installed. A
package installed later under the same ID starts with none. Deleting an
account deletes its delegations and the actions of the messages sent to it.
An argument that names an owner, a user or an add-on is refused with
bad_request before the operation runs. There is no argument for the
connection, and model, when given, must equal the delegated model.
connector.notify takes text (1 to 4000 characters, line breaks and
tabs allowed, no other control character), actions (at most 4, each
{id, label}: id of 1 to 32 letters, digits, ., _ or -, labels that
differ as reply words) and expiresInSeconds (60 to 604800, default 86400). It
answers {delegation, notification, queued, buttons}. queued is true when the
connection was at its limit and the message waits. buttons says whether the
platform shows the actions as buttons; otherwise the host adds one line with
what to reply: each label followed by a code of four characters that the host
makes for this message, such as Publish K7Q2. When the message cannot be
sent, also later from the queue, the host deletes its actions, so nothing can
answer them. One delegation sends at most 30 messages an hour; the
outbox limit of the connection applies on top. A connection that is off, has
no notification chat, or was never chosen is refused with conflict and a
message that says so.
connector.actions takes waitSeconds (0 to 20, the call waits that long
for a first answer), limit (1 to 50, default 20) and ack (at most 50
notification IDs). Each answer is
{notification, action, delegation, binding: {id, kind, name}, sender: {id, name, username}, via, at}, where action is the add-on’s own ID
of the action and via is button or reply. A read changes nothing: every
call returns the answers that the add-on has not acknowledged, oldest first.
When the add-on has done the work for an answer, it gives the notification ID
in ack on its next call. The host marks those answers read before it looks
for answers, so they are not returned again. An ID of another add-on, or of a
message with no answer, is skipped. Because a crash between the work and the
acknowledgement returns the answer again, the work must be safe to repeat. An
answer that is never acknowledged is deleted a week after it was given.
How an answer gets there: the host gives each action a button ID of its own,
never the add-on’s ID. On a platform with buttons only a tap counts, and any
text is a message to the agent. On a platform without buttons the answer is a
label with the code of its message (publish k7q2 also works); a label alone
is a message to the agent. A tap or a reply is taken only from a sender that
the connection already accepts, only in the chat that got the message, and
only before it expires. The first answer consumes the message, also when two
frontends receive it. The host tells the sender “Got it:
model.chat takes messages (1 to 256, roles system, user,
assistant, tool), and optionally tools (at most 64, of type function),
tool_choice, response_format (text, json_object or json_schema),
max_tokens (at most 32768), temperature, top_p, stop and seed, in the
shapes of the OpenAI chat completion API. It answers
{delegation, model, message, finish_reason, usage} with the first choice.
The call goes through the chat route of the host as the person: their
feature, model list, quota and usage log apply. It is a plain model call: the
host runs no tool for it. The MCP servers of the model (also with mcp.auto),
MCP prompts and resources, the assistant tools and the tools of add-ons stay
off, whatever the request says. The tools of the request go to the model,
and a tool call comes back to the add-on to run. An image, audio or video part
must be a data: URL: the host fetches no address for an add-on, and any
other URL is bad_request. The host reads the parts as the chat route does,
and refuses a media key (content, type, image_url, audio_url,
video_url, url) that is not written in lowercase. A refusal of the route comes back as:
The route answered
The add-on gets
400 or 422
bad_request with the route’s words
401 or 403 (an account that is off, a model the person may no longer use)
scope
429 (a spent quota or rate limit)
conflict that says so
the model is loading
conflict that says to try again later
5xx
conflict with a fixed sentence; the details go only to the host log
No model chosen is conflict. Streaming is not offered.
agent.run runs the saved agent that the person chose, with no live
request. The run is an unattended run of the person, as a trigger run or an
agent job: it uses the agent’s own model, instructions, skills, tools and MCP
servers, as in chat, and an edit of the agent applies to the next run. It
shows in the agent’s run history, where the person can read and stop it, and
its model calls count against the person’s usage and quota.
It takes delegation, input (text), data (a JSON object), post and
waitSeconds (0 to 20). input or data is required, and together they
are at most 8000 bytes. The agent gets them in a marked block that says they
are data from the add-on, not instructions from the person, as for the
payload of an event that starts a trigger.
It answers {delegation, run, agent, status, reply, reason}. status is
running, done, failed or stopped; reply is the last reply of the
agent in the run’s own turn; reason says why a run stopped. The run is a
chat that the person can open and go on with: what the agent answers to the
person later is not part of the result, and once the person wrote, the run
reads as ended. The call waits up to waitSeconds
for the end. A longer run is read with agent.result, which takes
delegation, run and waitSeconds and gives the same answer. A run of
another delegation, or a chat that is not such a run, is scope.
Tools. The person sees the agent’s tools when they choose the agent,
and ticks the ones its runs may call. A tool that may write, send or spend
(any tool that is not known to only read) is marked and starts unticked.
Only the ticked tools are offered to the model, and each one checks the
delegation again when it is called, so a tool that the person takes back
does not run, also in a run that is going. A tool that the agent gains later
is off until the person ticks it. Each ticked tool is kept with who serves it
(the model’s MCP servers and their configuration, an MCP connector, an
add-on or the host) and a digest of its name, description, schema and
whether it only reads. A tool
whose source or definition changed since, such as another server that now
serves the same name, is off until the person confirms the choice again. A tool the agent
itself does not have cannot be ticked. Sub-agents, loops and the tool
search are never offered in these runs; the tools the search would load are
listed one by one instead. The act policy of unattended runs still applies
on top: an allowed tool that spends, sends or changes something also needs
the agent’s act grant, as for an agent job. The grants are those the agent
held when the person chose, at most: a grant that the agent gains later is
not held in these runs until the person confirms again. The model calls of
a run run no server tool of their own: the MCP servers of a model with
mcp.auto are not contacted, so only the ticked tools run. A run cannot change the
delegation, the grants, the triggers or the agent.
Post. With post: true the host sends the final reply of a run that is
done to the notification chat of the delegated connection. The call is
refused with conflict when there is no such connection or it cannot carry
a message. The host reads the delegation again when the reply is ready, so
a delegation that was taken back or changed gets no message. The reply
counts against the 30 messages an hour of connector.notify and is cut to
4000 characters.
Limits. One delegation starts at most 20 runs an hour and has at most 2
running at once; a further start is conflict. The runs at once are counted
from the record of the runs, so a run keeps its place until it has ended,
also across a restart; when they cannot be counted, the start is
conflict. A run that a restart interrupts is not resumed: it ends. A run
whose start did not finish (the process ended before the first message)
frees its place after a minute. A run is stopped at the run
limit of triggers (the runtime setting chats_trigger_run_limit, 15
minutes by default) and
its model steps are bounded as in chat.
Refusals. No agent chosen, an agent that was deleted or is no longer
the person’s own, and a process that runs no chats are conflict with a
sentence that says which. An owner that no longer holds the agents
feature is scope.
Not offered. An add-on cannot give the run tools of its own: the tools
of a run are the agent’s, and the tools of add-ons come from installed
manifests only. An add-on that needs a tool call back uses model.chat.
Distributed mode. The operations are registered where add-ons run, like
connector.inbound. The delegations and the actions live in the account
database that every frontend and the add-on owner share (without accounts,
one file under the data path for the one local owner). A tap is handled by the
frontend that receives it and is read by the add-on owner through the shared
record, so no frontend-to-owner route is needed. The message goes through the
connector manager that the owner keeps. On a dedicated add-on owner, which
runs no models, model.chat is refused with conflict. The rate window of
connector.notify is kept in memory on the process that runs the add-on: a
restart starts it again.
agent.run behaves as a trigger run: the process that handles the call
creates the run, and a chat worker takes the turns, so any frontend can read
it with agent.result. On a dedicated add-on owner, which runs no chats, it
is refused with conflict. The 20 runs an hour are counted in memory on the
process that runs the add-on, like the rate window of connector.notify; the
2 at once are counted from the shared record of the runs.
Routes for the person.
Route
Does
GET /api/addons/{id}/delegation
what the caller delegated: {asks, delegation, binding, model, bindings, agent, agentTools, toolsChanged, reconfirm, agents, toolChoices, toolActs, agentGone}, where asks are the delegated operations the manifest asks for, bindings the caller’s connections that can carry a message, agents the caller’s own saved agents and toolChoices the tools of one agent (?agent=ID, else the delegated agent), each {name, writes, hash}, with toolActs the act grants of that agent. hash is an opaque digest of the tool as offered. agentTools are the allowed tools that are still the same, toolsChanged those whose source or definition changed, and reconfirm is true when a tool changed or the agent gained an act grant: saving the choice again confirms it
PUT /api/addons/{id}/delegation
set {binding, model, agent, agentTools, agentToolHashes, agentActs}; each may be empty, all empty clear it. The write replaces the whole delegation. agentToolHashes gives the hash of each tool in agentTools and agentActs the toolActs that the person saw; when the agent changed since, the write is refused with 409 and the type choice_changed, and nothing is stored
DELETE /api/addons/{id}/delegation
take everything back
A change needs the person’s own browser session (X-LocalAI-Confirm set to the
add-on ID), as for user settings. The connection must be the
caller’s own, the model one the caller may use, the agent one of the caller’s
own saved agents (not one shared with them) and each tool one that the agent
has; an add-on that asks for none
of the operations is 404. No MCP tool maps to these routes. The apps list
gives delegable, the delegated operations that the manifest asks for.
The reference add-on addons/internal/hostopsdemo uses all six operations,
and tests/addons/delegatedflow runs it end to end.
Background call. The operationId is any ID, of at most 256 characters,
under which the host holds no request. The grant of the running package is
the whole authorization. The call has no actor, chat or resource. Without a
grant the answer is unknown_op.
Call during a request. The request must come from an add-on page in the
browser of an administrator, and the feature of a user is not asked. An API
key, a chat, a model’s tool call, an automation or other unattended run, a
paired client and a background job are refused. A request that has expired is
refused with no_live_operation; it does not become a background call.
What this does not limit. The add-on chooses the ID it sends. An add-on
that holds the grant can make the background call at any time, also while it
serves a user who is not an administrator, and also after a request ended.
Grant such an operation only to an add-on that you trust with it. The add-on
must check who its user is before it calls.
Rules for add-ons. Do not make a System call from inside an action that a
model started: the host refuses it under that request, and a background call
would pass around the refusal.
Rules for the host. A System operation does not return secrets or the
data of a person, and it writes its audit entry also when the actor is empty.
Sign-in off. Every request is the local owner, who is the administrator.
With sign-in on and local-owner mode, the host cannot name the account, so
calls during a request are refused. Background calls still work.
One node only. In distributed mode, or with separate add-on owner and
frontend roles, a granted call is refused with conflict and a message that
says so.
Background limit. At most 4 background calls of one add-on that change
something run at once. A further one is refused with conflict.
Registry credentials
An add-on can store the user name and password of a registry, so that this
server downloads from it without a restart.
Operation
Arguments
Result
credentials.set
host, username, password
host, present
credentials.delete
host
host, present
credentials.status
none
hosts: host, present, changedAt
No result holds a user name or a password. All three are System operations. A
repeated call runs again, and LocalAI keeps no argument or result of a call.
Each change is written to the host audit with the add-on and the host, before it
is made (requested), and again with how it ended (done, refused or
failed).
Hosts. A host is a host or host:port name, without scheme, path,
wildcard or user. A call can set a credential only for an allowed host.
Another host is refused with not allowed.
When the policy file grants
credentials.set and the add-on has a preinstall entry with credentialHosts,
those are the allowed hosts. They apply only to the package that matches the
library and signer of the entry.
Otherwise they are the hosts that the manifest lists in
capabilities.credentialHosts and that an administrator approved in the
install or upgrade review. The approval belongs to the signer, or to the digest
of an unsigned file. A package of another signer gets nothing.
A new version that asks for one more host waits for a review.
Turning on credentials.set on the Host access page approves no host. Approve
the hosts in an install or upgrade review. For an add-on that is installed
already, there are three ways to get them:
Wait for the next version that lists the hosts. It is held for a review on
the Add-ons page, also when it comes from an automatic upgrade. Approve it
there.
Uninstall the add-on and keep its data, then install it again. Leave
credentials.set ticked in the install dialog, which shows the hosts.
In a deployment, grant credentials.set in the policy file and list the
hosts as credentialHosts in the preinstall entry of the add-on.
During an upgrade. The new version starts before the upgrade commits, and the
same process keeps running after it. Until the commit it can change no
credential, and the rules of the running version stay as they are.
credentials.set and credentials.delete answer not_committed (HTTP 409) for
a host the new version will be allowed, and not allowed for any other host.
credentials.status works, and shows which hosts hold a credential for the new
version.
Do not treat not_committed as a startup failure. An add-on that stops on it
makes the upgrade fail. Report ready, and retry with a pause until the call
succeeds.
When the upgrade changes the package key (another signer, or another digest for
an unsigned file), the commit removes the old rules. Set them again: use
credentials.status to see which hosts have none.
Token servers. The user name and password of a rule are sent over https
to its host and to the other allowed hosts of the add-on only. List the token
server of a registry among them, or its pulls fail with an error that names that
host. A host needs no credential of its own to be listed.
A set that arrives after the add-on was uninstalled or disabled, or lost the
host, is refused with not allowed.
Use. LocalAI stores the rules in addon-credentials.yaml in the data folder,
with mode 0600. A rule is chosen for https:// requests to that exact host. A docker login of
the operator for a registry wins over it. A rule of a registry that is reached
over plain HTTP is never used there, and its present is false. See
Private registries.
A host that another add-on holds is refused with conflict.
When a rule goes away.
Uninstalling the add-on, disabling it, or replacing it with a package of
another signer or digest (for an unsigned file) deletes its rules. Set
them again afterwards.
Revoking the grant, a deny rule, locking UI grants or removing the host from the
preinstall entry stops LocalAI from using the rule. The rule stays in the
file until it is deleted.
In distributed mode, or with separate owner and frontend roles, these operations
are refused and no managed credentials are loaded.
Instance operations
These System operations let an add-on set up the machine it runs on. No result
holds a secret or the data of a person. An unknown argument is refused with
bad_request.
autoUpgradeBackends, autoUpgradeAddons (one or both)
as get
system.info gives no host name, network address, user name, path,
environment value or serial number. capability is the name that selects the
backend builds for this machine. A figure that cannot be read is 0.
Names. An install takes the name of a gallery entry, as name or
gallery@name, and nothing else. A URL, a path, a scheme such as oci: or an
extra argument is refused with bad_request. A name that the configured
galleries do not list is not_found.
Switches of the deployment. The installs follow them and answer conflict
with a message that says which:
LOCALAI_DISABLE_GALLERY_ENDPOINT: no model operation but the status works.
LOCALAI_DISABLE_BACKEND_INSTALL: a model whose backend is not installed is
not installed, as through the HTTP API.
For backends, LOCALAI_DISABLE_BACKEND_INSTALL refuses install and upgrade,
and LOCALAI_DISABLE_GALLERY_ENDPOINT refuses list, install and upgrade.
Nothing is replaced. An install writes new things only. It answers
conflict when it would write over what the administrator has:
models.install, when the model is installed, when a .yaml or .yml
file, a gallery file (which holds the hold flag) or a loaded model config has
its name, or when an operation on it is queued or running. This includes an
HTTP API install that asks for that name, in any case of letters. An install
by URL that gives no name is not seen before it writes. To get a newer
version of an installed model, use the model upgrade of LocalAI.
backends.install, when a backend or a directory of that name exists, when
an external backend has the name, or when an upgrade run is active. A meta
backend is also refused when the backend that it would install exists. A
broken install is for the administrator to repair.
backends.upgrade, when the backend was not installed from a gallery: one
placed by hand, installed from a library or from a URI, or a system backend.
It takes the installed name. gallery@name is refused with conflict.
backends.list gives the backends that can run on this machine and the
installed ones. available is set when an upgrade exists. An upgrade runs as
an upgrade run
where the server has them, so one that starts while another run is active is
refused with conflict.
Jobs. An install or upgrade returns at once. Poll the status: state is queued,
running, done, failed or cancelled. An add-on reads only the jobs it
started; any other ID is not_found, also after a restart of LocalAI. The
same call repeated while its job runs gives the same jobId. At most 4 jobs
of one add-on can be unfinished. The text of error has paths, URLs and
addresses removed. An upgrade whose outcome LocalAI no longer knows, for
example after a restart, is failed. Read backends.list to see the result.
Update settings.set changes these two switches and no other setting. If
one cannot be written, neither changes. The
change applies at the next automatic pass and stays after a restart.
The backend switch is the auto_upgrade_backends runtime setting, kept in
runtime_settings.json. It is locked when
LOCALAI_AUTO_UPGRADE_BACKENDS=true (or the flag) is set, because the
deployment wins over the file at start, and when
LOCALAI_DISABLE_RUNTIME_SETTINGS is set. A locked switch is refused with
conflict, and then no switch changes. LOCALAI_AUTO_UPGRADE_BACKENDS=false
does not lock it: it is the default.
The add-on switch is the policy of the add-on owner.
LOCALAI_AUTO_UPGRADE_ADDONS gives only its first value, so it locks nothing.
Audit. Each change is written to the host audit with the add-on and the
name or the new values, before it is made (requested) and again with how it ended (done,
refused or failed). For an install, done means that the job is queued.
During an upgrade. The candidate of an upgrade can call the operations that
only read. An operation that changes something answers not_committed (HTTP
409) until the upgrade commits. Retry it with a pause.
Branding
An add-on can set how the server looks. Its branding is a layer over the bundled
look and under the administrator’s own
branding settings. The
sign-in page shows it, so everybody who can reach the server sees it.
Operation
Arguments
Result
branding.set
name, tagline, accentLight, accentDark, assets
present
branding.clear
none
present
Every argument of branding.set is optional, but one must be given. A call
replaces the whole layer: what it does not name is not set any more.
name: at most 64 characters. tagline: at most 160. Both are plain text on
one line. Control characters, invisible format characters (the bidirectional
overrides and the zero width space among them) and line separators are
refused. The zero width joiner and non-joiner are accepted.
accentLight, accentDark: #rrggbb, for the light and the dark theme. The
UI darkens (light) or lightens (dark) a colour until text keeps a contrast of
4.5:1 with it.
assets: logo, logo_horizontal and favicon, each as
{"mediaType": "image/png", "data": "<base64>"}. The types are PNG, JPEG,
WebP, ICO and SVG. The content must be of the declared type. An image is at
most 5 MiB after decoding. The host chooses the file names.
The request of branding.set can be larger than that of other operations,
to hold three such images. Only an add-on that holds the grant can send such
a request, and the host handles one at a time. Others get HTTP 413.
An SVG is served with a sandbox Content-Security-Policy, so scripts in it do
not run.
Precedence. For each field and image on its own: the administrator’s value,
then the layer, then the bundled one. There is no administrator setting for the
accent colours. GET /api/branding answers the result, with accent_light and
accent_dark.
One holder. One add-on holds the branding at a time. Of the installed,
enabled add-ons that hold the grant, it is the first in the preinstall file. An
add-on that the file does not list comes after the listed ones, in the order of
the add-on IDs. branding.set of another add-on is refused with conflict.
When an add-on that comes first gets the grant, the layer of the other one is
no longer shown.
During an upgrade. Until the commit, both operations answer not_committed
(HTTP 409) and change nothing. Retry with a pause.
When the layer goes away. Uninstalling the add-on, disabling it, revoking
the grant, a deny rule, or replacing it with a package of another signer or
digest (for an unsigned file) deletes the layer. Set it again afterwards.
For an unsigned file, every new version is another digest.
A layer is only hidden, and its file kept, while the grant does not apply for
another reason: the grants document cannot be read, UI grants are locked, or
the package no longer matches the preinstall entry.
LocalAI keeps the layer in branding/addon/layer.json under the dynamic
configuration folder. If the file is damaged, LocalAI starts, logs a warning and
shows no layer. The next branding.set replaces the file. Each change is written
to the host audit with the names of the fields, never their values. In
distributed mode, or with separate owner and frontend roles, the operations are
refused.
Setup page
An add-on can have one page that sets up the server, such as a page that asks for
a key. Declare it as ui.setup in the manifest (feature level 18) and request
the operations.
Operation
Arguments
Result
setup.complete
none
pending: false
setup.reopen
none
pending: true
The setup is pending from the install on. Call setup.complete when the page has
done its work, and setup.reopen to ask for it again, for example when a key
stops working.
What administrators see. While the setup is pending, an administrator who
opens the home page is sent to the setup page. Nobody else is, and no other page
redirects. Create the first account as usual; the redirect applies after that.
The setup page also opens after an administrator approves an install or an
upgrade of your add-on in the UI, as soon as the add-on holds the page and runs.
No key is needed for this. The UI waits for that for 2 minutes, and only while
the administrator stays on the page where they approved: another page, a reload
or typing on that page ends the wait, and an open dialog delays the move. The
home page then redirects as described above.
The page is opened once for each browser session of a tab, whichever of the two
ways opens it. A person who goes back to the home page, reloads it, or follows
a page of yours that sends them there before setup.complete, is not sent
again: the home page says that the setup is not finished and offers to
continue.
Skip for now, above the setup page and in that notice, stops both until the
browser session of the tab ends.
If the add-on is turned off, or its process does not run, the home page stays
as usual and says that the setup cannot open. LocalAI stays usable.
An add-on that never calls setup.complete therefore cannot keep anybody out.
The API is not affected.
One holder. One add-on holds the setup page at a time. Of the installed
add-ons that declare ui.setup and hold setup.complete, it is the first in
the preinstall file. An add-on that the file does not list comes after the listed
ones, by the time a person approved its operations, then by add-on ID. An add-on
that is turned off is passed over while another one is on. A call of an add-on
that does not hold the page is refused with conflict. setup.reopen alone
does not give the page, because such an add-on could never finish it.
State. LocalAI keeps it over restarts in addon-setup.json in the data
folder, bound to the package that called setup.complete. It is pending again
after an uninstall, after a revoke or a deny rule, and when a package of another
signer, or another unsigned file, replaces the add-on. Each new version of an
unsigned file is another package. An upgrade of a signed package keeps it, and
turning the add-on off and on keeps it. While the grants cannot be read, nothing
is shown and nothing is deleted.
Who can see it.GET /api/addons/apps answers administrators with
setup: {addonId, path, pending, available} when an add-on holds the page. Other
callers get no setup field.
During an upgrade. Until the commit, both operations answer not_committed
(HTTP 409). Retry with a pause. Each change is written to the host audit. In
distributed mode, or with separate owner and frontend roles, the operations are
refused and there is no setup page.
Events
An add-on that keeps the owner’s own data (a calendar, a task list, a table)
can tell the owner’s watches when something in it is added, changed or
removed. It does two things: it declares its event types in the manifest, and
it calls events.emit from the tool that made the change.
Declare the events.capabilities.events lists the types, and needs
featureLevel: 12:
"events":[{"type":"calendar.event.created","lifecycle":"created","key":"event.id","anchor":{"time":"event.next","zone":"event.zone","allDay":"event.allDay","moves":["event.start","event.end"],"following":"event.following"},"title":"event.title","link":"calendar?event={key}","label":{"en":"An event is added","it":"Si aggiunge un evento"}}]
Field
Meaning
type
The name of the event. It starts with the add-on ID and a dot.
lifecycle
created, updated or deleted: what happened to the thing.
key
A dot path to the ID of the thing in the payload. The host makes the key <add-on ID>:<id>, and keeps one reminder per key per watch.
anchor
Optional. time is a dot path to an RFC 3339 time of the thing (for a repeating thing, the next occurrence). zone is a path to its IANA zone, allDay a path to a boolean. moves lists the other paths that change when the thing moves (its end, its local start), so the host tells a move from any other change. following is an optional path to a list of RFC 3339 times: the starts of the occurrences after time, for a thing that repeats (the host reads at most 64). Once the time of the current occurrence has passed, the host moves the reminder to the next one by itself, with no model run, so the series goes on even when one reminder’s task fails. Send the list again with each event of the thing. A thing with no time can still get reminders at a set time or after a delay.
title
A dot path to a short title that the owner reads.
link
Optional. A route of the add-on’s page that opens the thing; {key} stands for the ID.
label
The name of the event on the watch form, plain text or one entry per language.
The host reads only these paths. It never reads another field of the payload,
so an add-on can send what it likes for the agent, and the host code stays the
same for every source. The parser refuses an empty or malformed path, an unknown
lifecycle, a type of another add-on and a type declared twice.
Emit. Ask for the operation in the manifest
("hostOperations": {"optional": ["events.emit"]}) and call it with the
operation ID of the live call that made the change:
payload is a JSON object of at most 256 KiB. dedupe_key is optional: the
same key is handled once. Without it the host uses a hash of the type and the
payload.
The type must be one that the add-on’s current package declares, and the
payload must hold the key path. Otherwise the call is refused with
bad_request.
The add-on cannot say who made the change. The host reads it from the live
call: the owner (the add-on’s page or the owner’s own chat), a run of a
trigger or watch, or a paired client. A watch uses it to stay quiet about the
owner’s own changes and to never wake on a change it made itself.
The payload goes to an agent as data from outside, between markers, never as
instructions. It cannot widen what the run may do.
An event reaches only the triggers and watches of the user whose data
changed. A server with triggers off drops it.
A failed emit must not fail the change itself: report it in the log and
answer the tool as usual.
The operation runs under any live call, a page tool of the read class included,
and a call of a paired client may make it too.
Typed events (feature level 19)
With featureLevel: 19 a declaration also says what its payload holds, so
that an automation can start from the event, filter on its fields and pass
them to a step with no code in the host for the add-on. The host finds every
start, field, label and setup choice in the manifest, and lists them in
GET /api/chats/automations/catalog.
{"type":"mail.message.received","lifecycle":"occurred","label":{"en":"A mail arrives","it":"Arriva una mail"},"icon":"mail","fieldsVersion":1,"fields":[{"path":"message.subject","type":"text","label":"Subject","description":"The subject line.","example":"Invoice 42"},{"path":"message.from","type":"record","label":"From","example":{"name":"Sam","address":"sam@example.com"},"fields":[{"path":"name","type":"text","label":"Name"},{"path":"address","type":"text","label":"Address"}]},{"path":"message.to","type":"list","items":"record","label":"To","fields":[{"path":"address","type":"text","label":"Address"}]},{"path":"message.has_attachment","type":"yesno","label":"Has attachments","example":false}],"setup":[{"name":"account","type":"connection","label":"Account"},{"name":"folder","type":"choice","label":"Folder","from":"describe"}],"detect":"watch","minIntervalSeconds":60}
Field
Meaning
lifecycle
Also occurred: the event is not about the life of a thing (a message arrives, a job ends). Such an event has no key and no title unless it wants them. It can start an automation, but a watch cannot take it: a watch keeps reminders for things.
fields
The typed values of the payload. path is a dot path; under a record it is relative to the record. type is text, number, yesno, time (RFC 3339, or a date alone), list (with items) or record (with fields). A list of records has fields for each record. Records nest at most 3 deep, and a declaration has at most 64 fields. label and description are plain text or one entry per language. example must have the declared type.
fieldsVersion
Required with fields. Inside one version, fields are only added. A removal, a rename or a type change raises it.
dynamicFields
true when the person defines more fields in the add-on (the columns of a table). The host asks for them with events.describe.
setup
What a start of the event must choose, at most 8 items. type is connection (one of the person’s connections; the add-on needs a connector kind or credentials), choice (from choices, or from events.describe when from is describe) or text, or resource (one of the add-on’s resources that the person may use; the host lists them and refuses any other, so the add-on needs capabilities.resources). optional allows an empty value. path (a dot path into the payload) makes the host send a start only the events whose text at that path is the chosen value; an empty choice takes every event. resource and path need featureLevel 19.
detect
emit (the default): the add-on reports its own changes with events.emit. watch: the change happens outside LocalAI, and the host polls the add-on with events.poll.
minIntervalSeconds
For watch only: the shortest time between two polls, at most 86400. The host has its own floor.
icon
The name of an icon of the host’s UI kit, such as mail.
hint
One English sentence for the model that handles an item of the event, such as what a good task for it is. The host adds it to the prompt of a watch run.
A declaration without fields stays valid. The host then derives text fields
from key and title, a time from the anchor, and so on.
The host checks every payload.events.emit, and every polled event, is
checked against the declared fields. A declared field that is present and not
null must have its declared type, and an event about a thing must hold its key.
Otherwise the call is refused with bad_request and a message that names the
path, never the value. Paths that are not declared pass unchecked.
The /events route. An add-on that declares a watched event or one that
describes serves the route /events. Like /connector, it is the host’s own
call, with no user and no envelope: the incarnation credential is its
authority. The body is {op, type, binding, setup, cursor, credential, resources, language}. credential and resources come from the connection that
binding names. The host does not know which setup value is a resource, so the
add-on must refuse a value outside resources.
events.describe answers {fields, choices}: the dynamic fields (they must
not repeat a declared path) and the values of each setup choice that takes
them from describe, by setup name.
events.poll answers {events: [{payload, dedupe_key}], cursor, retry_after}.
The cursor is the add-on’s own text, at most 1 KiB. The first poll of a start
has no cursor: the add-on answers with its current cursor and no events, so
that switching a start on never replays old changes. An unchanged source
answers with the same cursor. A poll returns at most 50 events, oldest first;
with more, it returns the oldest ones and the cursor after the last of them.
dedupe_key is required and stable for one change. retry_after asks the
host to wait, in seconds. reset: true, with no events, says that the
source lost its place and goes on from the new cursor. The host tells the
person.
The host polls only for an add-on that has the grant of events.emit, so a
watched add-on asks for it in hostOperations, also when it calls nothing.
Where the web app asks. The wizard, the editor and the import dialog of
automations render each setup item from its declaration: a connection lists
the person’s connections, a choice lists its choices or the answer of
events.describe (asked after the connection is chosen), and a text is typed.
A watched event needs its required items before it can be saved.
Clusters. One frontend, the leader of the triggers, polls. It must run the
add-ons itself: a leader that does not (such as --addons-role frontend) polls
nothing and says nothing. A zero-retention workflow run keeps its step outputs
in the leader’s memory only. The cap of 200 polled events an hour and the
describe cache are per frontend.
SDK. The Go package pkg/addons/sdk/events has an Emitter, which checks
a payload against the manifest before it sends events.emit, and a Watcher,
which serves /events and applies the poll rules above. EncodeCursor and
DecodeCursor make an opaque cursor.
Conformance. Run pkg/addons/eventconformance from the add-on’s tests. It
checks that every declaration has fields with examples and descriptions, that
the sample built from the examples validates, that every label has the
languages the add-on ships, that emitted payloads match, that the first poll
returns no events, that an unchanged source keeps its cursor, that dedupe keys
are stable, and that describe answers within the contract.
What a tool does, and subscriptions (feature level 21)
With featureLevel: 21 a tool definition can say what a call does, so that an
automation asks a person only when it must:
For a tool that acts (any kind but read): at least one of sends (it sends a message or shares data outside LocalAI), deletes (it removes or overwrites data) and changes (it adds or changes data and neither sends nor deletes), and optionally reads_outside. For a read tool: reads_outside (what it returns can hold text that other people wrote, such as mail or invitations) or reads_own (only what the owner keeps in the add-on).
idempotent
For a tool that acts: a call made again with the same idempotency key acts once. The host may then retry a step whose outcome it does not know.
output
The fields of the JSON object a call returns, in the format of the fields of an event. An automation step offers them to the next steps.
A tool that acts and declares no effects counts as one that can send or
delete: an unattended run asks a person before each call of it. A tool that
declares effects without sends and deletes needs no approval. A read
tool without effects counts as one that reads outside content, and the
automation editor warns when an agent that can send also reads such content.
Idempotency key. The host puts idempotencyKey in the request of a call
that has one: the same text on every attempt of one automation step, and the
ID of the approval for a call a person approved. The host sends it only to an
add-on that declares featureLevel: 21 or higher.
Subscriptions. An add-on can react to the events of other add-ons. It
lists their types in capabilities.subscribes, needs service: true, and
asks for the host operation events.subscribe (“React to events”) in
hostOperations:
When an add-on reports an event of such a type with events.emit, the host
calls the /events route of every enabled subscriber that holds the grant,
with {op: "events.deliver", type, event}. event has id, type, source
(the add-on that reported it), owner, occurred, payload, reply_to (the
chat of the change, when there is one), trace and hops. The answer is
empty, or {retry_after}. The host delivers after the automations took the
event: when events.emit answers with an error, no subscriber got it.
An add-on never subscribes to its own types and never gets its own events.
The delivery is at least once: an error or a timeout (30 seconds) makes the
host try again three times, after 1 second, 10 seconds and 1 minute. Use
id to drop a repeat. A refusal of the add-on (400, 422, 403) and an
add-on that cannot take the event end the attempts at once. The attempts run
on the frontend that took the event, and a shutdown or a restart drops the
attempts still to come.
An event of an incognito request that may keep no content (zero retention)
is not delivered, and it starts no automation and changes no reminder. The
host takes the level from its record of the call that the add-on serves, not
from the callback. In a cluster the signed forwarded request carries it.
hops counts the reactions before this event in a chain that starts at
trace. The host delivers no event past 8 hops.
operation_id is the operation of this attempt. While the add-on handles
the delivery it may call events.emit under it, and nothing else. An event
it reports there is one hop further in the chain, and the automations count
it as a change of an agent, not of the owner. An event that a step of an
automation makes an add-on report is one hop further than the run, and a run
that such an event starts carries its chain. A change made in the chat of a
trigger run is one hop further than that run in the same way. An automation is not started
past 8 hops.
The host delivers at most 60 events of one owner to one subscriber in a
minute, and drops the rest with a warning in the log. This bound also holds
when an add-on reports an event outside the delivery that caused it, where
the host cannot count the hops. Each frontend counts its own deliveries.
The SDK Watcher serves deliveries with OnDeliver.
How the pieces fit
The owner process holds everything about host grants. A frontend stores nothing and enforces nothing, and it forwards the host access routes to the owner.
Files. The owner writes host-grants.json and the audit file host-grants-audit.jsonl in its add-on state directory, next to host-settings.json. A missing document is the first start: it is created at the first write. A document that cannot be read does not stop the owner, but then no add-on can call any host operation, because the deny rules inside it are unknown. The startup log says so. The audit file records who changed what, never a policy path or a secret.
The check on each call. The broker asks one Authority for every operation. It combines the floor (policy file and flags, read once at startup), the deny rules of the file, the flags and the UI, and the grants of the UI document. A deny always wins. A UI grant counts only for the package it was made for, and only after the install or upgrade that created it completed. A revoke or a deny applies to the next call, with no restart. A call that already runs finishes.
At install and upgrade. The routes under /api/addons/host-grants stage the package, and the owner grants only what the administrator approved, the verified manifest declares and the host registers. An upgrade adds its operations next to the old ones. If the upgrade does not complete, only the added operations are removed, and the running version keeps what it had.
Startup log. The owner logs where the floor came from (flag, environment or file), how many add-ons, prefixes and deny rules it holds, how many add-ons and operations the UI document holds, the blanket mode and whether UI grants are locked.
User settings
An add-on can declare choices that each person makes for it, such as how it behaves
for them. The add-on names the key and the values it understands in its manifest.
The host keeps the person’s answer, checks every write against the declaration and
reads the answer for its own rules. The add-on does not store it and is not called.
A key is lowercase letters, digits and dashes, at most 40, and starts with a letter.
A setting has 2 to 8 values of the same form, and a default that is one of them. An
add-on declares at most 8 settings besides the approval settings of its tools. The
approval settings have no cap of their own: there is one for each
approvalOverridable tool, so the cap on tools bounds them. A person who has not
chosen has the default. The
manifest fixes the allowed values and nothing else: the words on the page and the
help text are the add-on’s own.
A setting can also carry a role, when the host reads the answer for one of its own
rules. The host defines the values and the default of each role, and the manifest is
refused when it differs, so an add-on cannot make a host rule more permissive than the
host’s own default. The only role today is memory.save-mode, with the values ask,
auto and never and the default ask. One add-on declares a role at most once.
Route
Does
GET /api/addons/{id}/user-settings
the settings of the add-on for the caller, each with its values, default and the value in force
PUT /api/addons/{id}/user-settings
set one: {"key": "...", "value": "..."}
Rules:
A write needs the person’s own browser session: a same-origin fetch with the
X-LocalAI-Confirm header set to the add-on ID. An API key, a bearer token, an MCP
session or a tool call is refused with 403 not_human_surface. No MCP tool maps to
these routes, so a model cannot change a setting that limits what it may do.
An unknown add-on, or one the caller cannot see, is 404. A key that the manifest
does not declare, or a value it does not allow, is 400 and nothing is stored. A
stored value that a newer manifest no longer allows reads as the default.
Authority: per person. The answers live in the account database that every frontend
shares, so a save through one frontend is read through another. Without accounts
they are one file under the data path for the one local owner. The store never falls
back to a local copy when the database is down: the routes answer 503, and a host
rule that reads a setting uses the default. A write replaces one key and has the same
result when repeated, so a retry after an uncertain write is safe; the last write
wins.
A page reaches its settings only through sdk.userSettings, which is bound to the
add-on. sdk.core.fetch still refuses /api/addons.
A setting is a person’s choice. It never widens what a connector chat or an
unattended run may do; a host rule that reads one says so (see
How a memory note is saved).
Provider slots
A provider slot is a job the host does itself and lets an add-on do in its place. The
host owns the slot, its gates and a built-in provider. An add-on says in its manifest
that it can serve the slot, and each person picks one provider: the built-in one, an
add-on that declares the slot, or Off. Memory (the notes the assistant reads and saves)
is the first slot.
The list of slots is data in the host (pkg/addons/contract/provider-slots.json) and it
is closed. An add-on cannot invent a slot: a new slot comes with a host release, with
one descriptor entry and its built-in provider. A descriptor gives the slot an ID, a
version, a title and a description, the choice a person has (the default, whether Off
is allowed and what Off means), the built-in provider, the roles a provider can
fill, which declarations the slot activates, the facts a provider may declare about
itself, and the ids of the host rules that apply to every provider.
Declare a slot in a manifest
An add-on declares at most four slots under capabilities.provides. The manifest stays
at api 2: provides is an optional key.
slot is a slot of the host. An unknown slot refuses the manifest.
slotVersion is the version of the slot’s contract that the add-on was written for.
The host accepts the range from the slot’s minVersion to its current version.
roles map a role of the slot to tools of capabilities.tools, as one name or a
list. The host checks each tool against the role: it must be declared with a
definition, have an allowed kind, not be page-only, not shadow a built-in tool, and
serve one role only. A role takes at most the number of tools its descriptor allows.
A role the descriptor marks required must be present. A provider never brings an
action tool through a role.
properties are typed facts the descriptor asks for, such as remote (a boolean)
and undo (host, provider or none). undo: "provider" needs
capabilities.undo. The interface shows them to the person who picks the provider.
The title and the description in the list of providers are the add-on’s ui.title
and ui.description.
An add-on with no roles is valid. A provider that only ships index files and skills
declares the slot and its contextFiles and skillDefinitions, and needs no tool.
What a pick changes
A declaration does nothing until a person picks the add-on. While another provider
serves, the add-on’s context files, its skills and the tools of its roles are not
offered in the chats of that person. Its other tools are not touched. When the person
picks it, those contributions count, and the built-in provider stops serving: one
provider serves a slot at a time. The host keeps every gate for any provider, so an
add-on cannot loosen a save rule, a grant or Off. The contextFiles of a provider must
lie in the scopes that the slot allows.
When the provider fails
If the add-on a person picked stops, is disabled, is removed or cannot be listed, the
slot is off for that person, with the reason provider_unavailable, and the person
sees which add-on it is. It does not fall back to the built-in provider: a person who
chose an external provider must not have their data written somewhere else without
being asked. The choice stays stored, so the add-on serves again when it runs, and the
person can pick the built-in provider at any time. A store that cannot be read, or an
add-on list that cannot be read, also turns the slot off for that call.
What the host does itself with a provider
The model reaches the tools of the read and write roles as ordinary tools. The host
calls the other roles itself, and it keeps every gate while it does.
Role
When the host calls it
What the host does with the answer
context
At the start of each turn of a chat that reads the notes
Puts the text in front of the message, wrapped as data, for this turn only
export
When the person downloads their notes
Writes the answer as a zip file
forget
When the person asks the provider to forget notes
Reports the result, or the change that waits for a confirmation
write
When the model calls the tool
Applies the save level of the person first (see below)
Context. The host calls the tool with the facts its schema declares, and no others:
query (the message of the person, cut at 1 KiB), scopes (the scopes the chat may
read), budgetBytes, origin (studio or connector) and the opaque references
userRef, agentRef and conversationRef. A provider never gets a name, an instruction
or a platform ID. The tool answers {"text": "..."} or a JSON string. The call has a
time limit of 3 seconds, and the text is cut at 6 KiB. The host puts the text in front of
the message inside the markers <<<provider-data and provider-data>>> with a header that
says it is data and not instructions. A marker or a line that looks like a system note is
defused inside the text. The text is not part of the system prompt, so a text that
changes with each message does not restart the chat engine. A chat that has memory off,
a private chat and an agent with no notes make no call at all.
Export and forget. The export tool takes no argument and answers
{"files": [{"path": "a/notes.md", "content": "..."}]}; any other JSON is kept as one
file, export.json. A path must be relative and is made safe by the host. The forget
tool is a write tool, so it names a resource like every write tool. The host offers the
facts group (user, agent or channel), key and resourceId to the tools that
declare them. A provider with no export or no forget role has none: the page says so,
and the person uses the service itself. The built-in provider has no forget; its notes
are files that the person deletes in Files. GET /api/chats/memory/export and
DELETE /api/chats/memory route to the provider that serves.
Save path. A write through a provider follows the same rules as a note of the
built-in provider. The level of the person is the strictest of their setting, the rule of
the saved agent and the messaging row. Never takes the write tools away. A saved agent
needs the memory.write grant, and a sender in a messaging chat needs the capability.
Only Save it and tell me applies a write at once, and only for a note of up to 4 KiB
that does not look like a secret, within 5 writes in a turn, and from a provider that is
local or declares undo as host or provider. Every other write is stored as a
proposal and waits for the person; the model is told so and does not say it was saved.
When the provider fails. The chat never fails because a provider does. A context call
that times out or fails leaves the turn without notes, and the model hears one line
saying so. After 3 failures in a row the host stops calling the provider for one minute (a
circuit breaker), then tries one call. The slot shows a plain notice in health while it
waits. The breaker is per server process: each frontend learns on its own.
Audit. Every call of the host to a provider writes one log line,
studio: provider call, with the slot, the role, the add-on, the tool, the person, the
chat, the outcome (ok, truncated, failed, timeout, bad_result or cool_down),
the time and the size. Every write adds studio: provider write with the level and
whether it was held. No line has a note or any text of the provider.
A provider that sends notes away. A provider that declares remote: true must also
declare capabilities.network, so the person and the host see the network access before
anything is sent. A manifest that does not is refused.
The retired Memory add-on
The notes are built in, and the add-on memory that used to read them is an alias of the
built-in provider. Its package is retired: it is no longer in the library or built by the
package workflow, so it is not offered for a new install. A copy that is still installed keeps working: the host does not list it
as a provider, a choice that names it means the built-in provider, and its index files
and skills are ignored so the notes do not load twice. Nothing is deleted. A new
provider must use another ID.
Write a provider
Start from pkg/addons/providerconformance/sample: a manifest that declares every
role, and a small service behind it. The sample keeps the notes in a service outside
this machine, so it declares remote: true and the network.
Give the tools the shapes above. A tool of the context role needs no resource. Do not
declare a property that the contract reserves, such as scope.
Run the conformance test from a Go test of your add-on:
It checks the manifest against the descriptor, then calls the role tools the way the host
does: the context within its byte budget and with an empty message, the export with safe
paths, the read and forget tools, and a tool that does not exist. A provider that passes
it works with the time limit, the size cap and the wrapping of the host.
Who can see a source
The sources are registered once for the whole server, and each person sees the ones their add-on visibility allows. One person who cannot see an add-on never removes its source for another person: a source is unregistered only when nobody sees it any more. The panel and the search use the list of the person who asks.
The network access of a source is the add-on’s own. An add-on that makes HTTP calls from its own process, as the Web add-on does, declares no network capability: the network capability and the egress.check operation are for add-ons that run commands behind the host’s proxy, such as Sandbox.
Routes
Route
Does
GET /api/chats/providers
every slot with its providers and the choice in force
GET /api/chats/providers/{slot}
one slot; 404 for an unknown slot
PUT /api/chats/providers/{slot}
pick a provider: {"provider": "builtin" | "off" | "<add-on id>"}; 400 for a provider the slot does not list, 409 for an add-on that cannot serve now
GET /api/chats/memory/export
the notes as a zip file; the export of the provider when an add-on serves
DELETE /api/chats/memory
ask the provider that serves to forget notes (scope, key, resource); 404 when it has none
resolution.active says what serves: builtin, an add-on ID or off. health is present
while the host leaves a failing provider alone, with a plain notice. The choice is
kept per person with the account, so every frontend of a cluster reads the same answer.
It is a person’s choice and needs no add-on call. The settings page draws the list from
this answer, and Settings then Memory is the first place that uses it.
Test a provider add-on
Test a provider with a fake add-on: declare the slot, serve a context file, list the
add-on through the broker interface of the tests, then check that the add-on’s files
reach the prompt only after the person picks it, that the built-in notes do not load
at the same time, and that a stopped or removed add-on turns the slot off instead of
falling back. core/services/studio/providerslots_internal_test.go is the reference, and
core/services/studio/providercalls_internal_test.go covers the host’s own calls.
pkg/addons/contract/providerslots_test.go covers the manifest rules.
Model search sources
The slot model-search lets an add-on add a source to the model search panel (the
Explore tab of the Models page) and to the search tool of the assistant. The add-on gives
data and typed filters only. It ships no UI, markup, script or style: the host draws the
rows and the controls, so a source from an add-on looks like the built-in one. A result
must install through a scheme that the host already handles. An add-on cannot add a
download scheme.
This slot has a set selection (selection.mode: "set" in provider-slots.json; the
other slots are pick-one). A person can have any number of sources on. The built-in source is
Hugging Face (huggingface). Every source the person can see is on by default, built in or
from an add-on, running or not: the host stores only the sources the person turned off, so a
source from a newly installed add-on is searched with no action. All enabled sources are
searched at the same time and the answers are merged. An empty set means no source is
searched: the slot has no Off value.
Declare a source
An add-on declares the slot in capabilities.provides (role search, one tool of kind
read) and describes its source in capabilities.modelSearch. A manifest that uses
modelSearch must declare featureLevel: 9.
The provider ID. Results, the stored choice and the providers parameter use it. It never changes once published. builtin and off are not allowed. Two add-ons that declare the same ID: the second is refused when it registers, and the host writes an audit line.
source.title
The name shown on the chip and on each row.
source.icon
An icon name of the host. An unknown name draws none.
source.listsLatest
The source answers with no search text when the sort is latest.
source.hasVariants
Opening a result of this source is likely to list several quantizations. The host sets has_variants on each row from this property, never from the row.
source.p2p
The models come by torrent. The panel puts the small p2p tag on the chip.
sorts
At most 5 of downloads, likes, updated, trending, latest.
filters
At most 8. Each has id, type, label, optional help. Types: enum (values, at most 32, and a default that is one of them), bool, range (min, max, step, unit) and text (maxLength, at most 200). The IDs q, limit and sort are reserved.
i18n.<language>.modelSearch
Translates the source title and, by filter ID, the label, help and the labels of enum values. English stays the fallback.
filters holds only the filters of this source, typed. A filter that declares a default and that the request leaves out is sent with that default, so the value the panel shows and the value the add-on gets are the same. The values are: a string for an enum or a text,
a boolean, a number for a range. The tool answers with {"results": [...]}. A row has the
fields id, title, uri, magnet, url, size_bytes, downloads, likes,
seeders, tags, pipeline_tag, license, gated and last_modified. The host checks
every row (search-result-validation):
uri must start with a scheme that the importer accepts: huggingface://,
pirateface://, magnet: or https://. A row that fails is dropped.
id is at most 200 bytes, title 300, url and magnet 2048, and a row has at most
32 tags of at most 64 bytes. A row over a cap is dropped.
At most MaxLimit (50) rows are read.
The host sets provider to the source ID, whatever the row says. It computes
installed, installed_name, backend and has_variants itself and discards the
values of the add-on.
Dropped rows are counted in the dropped field of the status of the source. An error, a
timeout (15 seconds) or an answer that is not valid JSON gives a failed status for that
source only. Text from a source is untrusted when it reaches the assistant: the search_models tool puts the rows and the failure texts of add-on sources in one field, untrusted_sources, fenced as untrusted text, and keeps them out of the plain fields.
Routes
Route
Does
GET /api/models/search
Searches the enabled set of the caller. providers=a,b limits the sources. filters.<source>.<id>=value sets a filter of one source; an unknown filter or a value that does not fit its type gives a 400 that names the filter. The answer has results, providers (each with title, ok, count, dropped) and sources (title, icon, sorts and the filter schema of each source).
GET /api/models/search/sources
The sources that are installed, and the enabled set of the caller: every visible source minus the ones the caller turned off. missing is always empty and stays for older clients.
PUT /api/models/search/sources
{"enabled": ["huggingface", "<source id>"]}. The host stores the visible sources that are not in the list as the ones turned off. An ID that is off and has no installed add-on stays off, so installing the add-on again keeps the choice.
The enabled list has at most as many IDs as the visible sources plus the stored off IDs plus the built-in source, and never more than 64; a longer list gives a 400. The list of sources turned off is kept per person with the other per-person add-on choices (key provider-model-search-off), so every
frontend of a cluster reads the same answer. Changing it needs no restart. The first version of the feature stored the enabled set under provider-model-search; that key is no longer read.
Test a source
pkg/modelsearch has a fake broker that stands in for the add-ons. Use it to test the
fan-out, the row checks and the filter checks. pkg/addons/contract/modelsearch_test.go
covers the manifest rules.
Look up the contract of connector add-ons, the change proposals that a chat makes and the context files. This page is part of the Add-on contract reference.
Connector add-ons
A connector add-on carries the messages of a messaging platform between the platform
and the chats. The Telegram, Slack and Discord add-ons are
first-party connector add-ons. The host keeps what is the same for every platform (the
bindings, the sealed bot token, the allowlist, the sender log, one chat for each sender
or thread, the turn and its notifications), so an add-on holds only the transport and
never stores a token. The first-party add-ons share their Go route
(addons/internal/connector) and their binding page (addons/internal/connector-ui).
The manifest declares the capability. It needs no tool and no service flag:
"capabilities":{"connector":{"kinds":[{"id":"telegram","title":"Telegram","description":"Talk to one of your saved agents from a Telegram bot.","senderHint":"A chat ID, a user ID or an @username","delivery":"pull","page":"bots","drafts":true,"previewMs":400}]},"ui":{"...":"the page that adds and edits the bindings"}}
Field
Meaning and bounds
kinds
1 to 4 kinds. A kind is what a binding stores in kind, so it names the platform.
kinds[].id
A lower-case identifier, unique in the manifest. A binding names the add-on too, so another add-on cannot take over the bindings of a kind.
kinds[].title, description, senderHint
Plain text for people, with the bounds of the UI texts.
kinds[].setup
Optional, feature level 4. What the person needs before a binding of this kind works, as a short phrase that completes the sentence “Needs …”, such as a bot token from @BotFather. See Setup text.
kinds[].delivery
pull: the host asks for updates (long polling). push: the add-on calls the host operation connector.inbound.
kinds[].page
Optional. The add-on page that adds and edits bindings; it must be a declared page. The Connections page links to it. A kind that logs in with OAuth also makes its connections on this page, with the host’s login (see OAuth 2.0 credentials).
kinds[].agentOptional
Optional, manifest api 2. true lets a binding of the kind have no agent. Such a binding is credentials only: it holds the token, the resource list and the write mode, and the host never delivers a message to it, polls for it, answers from it or authorizes a sender on it. The host refuses an empty agent together with listening, accepting senders, an allowlist, a notification chat, talk-back channels, permissions, pairing or trigger approval. Without the key every binding of the kind needs an agent.
kinds[].toolOnly
Optional, feature level 5. true marks a kind whose bindings only serve tools: one binding is used by many agents, each through its own set of connections. It implies agentOptional. A binding of the kind never has an agent, never listens and never accepts senders: the host clears the agent on every save and read, and refuses enabled and acceptAny. The connector list returns used_by, the number of the person’s saved agents that hold the binding, and the kinds list returns tool_only. A manifest that uses it must declare featureLevel: 5.
kinds[].wildcardResources
Optional. true lets a binding of the kind list owner/* (every resource of one owner) or * (every resource the credential reaches) in its resources. The host matches them before the add-on is called, without regard to case and on whole names; a star anywhere else is refused, * must be the only entry, and saving * needs the confirmation confirm_any_resource = allow any resource. Without the key every entry is an exact name.
kinds[].tokenGuards
Optional list of {prefix, option, allow}. The host refuses a credential that starts with prefix unless the binding set the kind option option to allow, and asks for confirm_wider_token = accept wider token when the option is turned on. It is checked when the token is saved and again each time it is used. option and allow must exist in the kind’s options. At most 4.
toolDefinitions[].enumerates
Optional, on a read tool of an add-on with credentials. The tool lists what the credential reaches, names no resource, and runs only for a binding whose list is * (the kind needs wildcardResources). The request carries the resource key *.
kinds[].drafts
Optional. true when the add-on serves the op draft. The host then shows the live answer of a direct conversation as a draft instead of a working message.
kinds[].previewMs
Optional. The shortest time between two previews (edits or drafts) of one binding, 250 to 10000 ms. Without it the host waits one second.
kinds[].history
Optional, manifest api 2. {"thread": true, "maxMessages": N}: the add-on serves the op history for threads, and returns at most maxMessages (1 to 200; without it the host asks for 30). A kind without it is never asked, so it keeps the behaviour of a platform that cannot give old messages.
kinds[].options
Optional, manifest api 2, at most 4. A choice that each binding of the kind makes: {"id", "title", "description", "values": [{"id", "title"}], "default"} with 2 to 8 values and a default among them. The host shows the choice on the binding page, checks the owner’s value against the declaration, stores it, and sends the value in effect to the add-on in options of every poll. What the option means is the add-on’s own rule.
kinds[].files
Optional. The files the kind can receive and send, with a limit for each. Needs manifest api 2. See File abilities and limits.
kinds[].roles
Optional, manifest api 2, at most 8. A role the kind can give to a sender: {"id", "title", "description"}, with an id in the same form as a kind id. The add-on owns the membership (for example, the admins of a workspace) and sends the role IDs of the sender in roles of each message, at most 8. The host drops a role the kind does not declare, and all roles for a kind that declares none. The owner of a binding maps each role to capabilities in the host.
kinds[].permissions
Optional, manifest api 2, at most 16. The capabilities the kind can grant to a role, from the host’s closed list: proposals.confirm, memory.write, files.upload, triggers.propose, triggers.run, talkback.channels, loops.wait and the sensitive triggers.change, talkback.new_channel, profile.write, skills.write, pages.write, dashboard.write, knowledge.write, loops.start. An unknown name is refused. A sensitive name may be listed, but it is never granted to a role: only a sender that the owner paired can use it. loops.wait and loops.start may be listed too, but they belong to the binding alone and are never granted to a role.
Outbound: the connector route. The host calls POST /connector on the add-on
with the same bearer credential and incarnation header as every other route and a body
{"op", "kind", "token", ...}. The ops are poll (offset, timeoutSeconds up to
25), send (chat, thread, text, and optionally messageId), edit (chat,
messageId, text), typing (chat, thread, and optionally messageId),
send_file (chat, thread, transfer: the handle of the file, see
Moving a file by handle), me (who the bot
is, for the token check on save and the Test button), media (media: one
reference of a message’s media, and a transfer handle; the answer is
{"received": {"name", "mime"}}), delete (chat, messageId: remove a message of
the bot) and, for a kind that declares drafts, draft (chat, thread, draftId,
text).
One message per answer. A send with messageId replaces that message (the
preview) with the first part of the text. The shared route tries the edit again after
each wait the platform asks for (up to 3 tries, none over 30 s). If the edit still
cannot be made, it sends the part as a new message and then deletes the preview with the
same op as delete, so a preview with a cursor never stays beside the answer. A
platform that cannot delete leaves it. The host never sends the reasoning of the model
in a preview.
Options. A poll carries options, a map from each declared option id to the
value in effect (the owner’s choice, or the default). The host sends it with every
poll, so a change reaches the add-on within one poll. The shared route gives it to the
platform with connector.OptionsFrom(ctx). The Slack add-on uses it for followThreads
(own, any or never): the add-on decides which messages are mention, so the host
only forwards what the add-on marks as addressed to the bot.
The op history. For a kind that declares history, the host calls
{"op": "history", "chat", "thread", "limit", "before"} when a message in a thread
makes a new chat, at most once for that chat. limit is the most messages to return
(never more than maxMessages); before is the ID of the message the host handles
now, which is not returned. The answer is {"messages": [...], "truncated": bool}, oldest
first, the newest limit messages of the thread. A message is {"messageId", "senderId", "senderName", "senderUsername", "text", "ts", "own", "media", "mediaNames"}: own marks a message of the bot, media is the number of files and
mediaNames at most 8 names; the bytes of a file are never part of a history.
truncated says that older messages exist. The text is what people wrote: the host
treats it as untrusted, flattens it, bounds it (30 messages and 8 KiB by default),
and gives it to the first turn only. A failure or a rate_limited answer is
logged and the turn goes on without the context; an add-on does not wait out a rate
limit in this op. The add-on should read only the thread it is asked for. Core knows no
platform: Slack’s conversations.replies is the add-on’s own business. The shared route
serves the op for a platform that implements connector.HistoryReader.
A send with a messageId replaces that message of the bot (the host’s working
message) with the first part of the text and sends the rest as new messages. When
the message cannot be edited (it was deleted, or is too old), the first part goes
as a new message too. The shared route (addons/internal/connector) does this for
every platform.
The text of a send is the answer, in Markdown. The add-on converts it to the
markup of its platform and cuts it; the shared route lets a platform send each part
in its markup and fall back to plain text by itself (Telegram does). The text of
an edit or a draft is a preview: it goes as plain text.
A draft shows text as a draft: a message that the bot is still writing, which
the platform replaces when the answer is sent. draftId is not zero, and the host
keeps one for the drafts of one answer. When the platform refuses it, the host
sends a working message instead.
An edit and a draft are not retried after a wait: a rate_limited answer comes
back at once, and the host skips that preview. A send and a send_file wait
once, as before.
A typing with a messageId says that the host already shows a working message
with that ID. A platform without a typing indicator (Slack) then posts nothing.
send_file carries a transfer whose name is
contract.SafeFileName of itself (no path, no control characters, at most 128
bytes). The route refuses any other file, a call without a handle, and a platform
that cannot send files.
The answer names the message (Telegram) or the file (Slack) in messageId. The token is the
unsealed bot token of one binding. It is passed on each call and the add-on must not
write it anywhere. The answer is {"updates", "nextOffset", "messageId", "botId", "botUsername", "received"} or
{"error": {"code", "retryAfter"}} with a code of unauthorized, conflict,
rate_limited, too_large or failed. The host maps unauthorized to switching the binding off,
repeated conflict to the same, and rate_limited to a wait. too_large is the
answer of a media whose file is larger than the bound of the handle or than the platform lets a bot
download; the host tells the sender that the file is too large. A runtime that
implements contract.ConnectorRuntime has the route; others get a 404. The add-on
cuts a long text to the limit of its platform.
Message buttons
A message of the host can carry up to four actions{id, label} on a send.
A kind that sets "actions": true (feature level 12) shows them as buttons under
the last part of the message, and reports a tap as an update with action set to
the ID of the button and no text. The add-on answers the tap on its platform so the
button stops waiting. A kind without actions never gets them: the host adds one
line to the text with the words to reply instead, and answers those words in the
chat that got the message. Telegram shows the buttons as one row of inline buttons.
The host uses them today for reminders (snooze, later, skip, got it) and answers a
tap with no model turn. A tap on a button the host does not know gets a short
answer and goes no further.
An add-on can send a message with actions too, through
connector.notify.
Its buttons carry IDs of the host, not of the add-on. The host takes a tap on
one of them, or on a platform without buttons a reply of the label and the
code of the message, answers the sender with no model turn, and keeps the
answer for the add-on that sent the message, which reads it with
connector.actions. A connector add-on needs nothing new for this: it shows and
reports the buttons as for the host’s own.
File abilities and limits
The bytes of a file never travel inside the connector envelope: they move by a
handle (see Moving a file by handle). A kind declares
what its platform can move, and the host decides how large a file may be, from the
number and the layer that sets it:
A kind that declares no files moves no files: the host does not ask it for
one and tells a sender who attaches a file that the platform takes none. Both
directions are optional, but files needs at least one. maxBytes is 1 to 1 TiB.
types is up to 32 distinct media types such as application/pdf or image/*;
it says what the kind moves. The host refuses an inbound file whose type the add-on
states and the list does not allow, and does not send an outbound file whose type
(from its extension) is not in the list. The
host also never sends a file whose first bytes are an HTML page. The host uses a declared size as an upper bound that the
owner can lower. It does not prove that a transfer works.
The limit in effect for one direction of one binding is the smallest of three layers:
Layer
Set by
Named in the text to people as
Owner
The owner of the bot, in the Files section of the binding. It can only lower the limit of the kind.
“limit set for this bot”
Add-on
The kind, with files.receive.maxBytes or files.send.maxBytes.
“limit of” the kind’s title
Host
The owner policy key connector_files_ceiling_bytes; zero means the default, 100 MB (100 MiB).
“limit of the platform”
When a layer ties, the text names the one
a person can change first (owner, add-on, host). One function in core
(EffectiveFileLimit) decides this for every kind, so a connector never carries a size
of its own, and the sentences that the sender and the model read are built from its
result. An add-on that gets a file it cannot read answers too_large; the sender then
reads the limit in effect.
Moving a file by handle
The add-on moves file bytes by a handle, in both directions, with no more than one
chunk in memory. The add-on needs the host operation prefix connector. in its host policy, as it does
for connector.inbound.
The host adds transfer to the request of the op media or send_file, and no bytes:
Inbound (media). The add-on downloads the file and streams it with
connector.file.put{"handle", "offset", "data", "final"}, at most 256 KiB of data
per call; it answers {"received": {"name", "mime"}}. An offset that is
not the number of bytes the host has gets {"received": n} and nothing is written, so
the add-on resumes there. The host stops at maxBytes (HTTP 413, code too_large).
The host overwrites the size and the SHA-256 of received with its own record, so
the add-on cannot choose them. It refuses an empty file.
Outbound (send_file). The add-on reads the file with connector.file.get{"handle", "offset", "length"} (length at most 256 KiB) and gets {"data", "eof"}.
It streams the chunks into the platform upload, so it needs no path and no token
beyond the one the host passes with the call.
A handle is random. It is bound to the add-on of the call, so another add-on gets the
same answer as for an unknown handle. It lives as long as the connector call, which
may run up to 15 minutes, and ends with it: a file that is not finished is dropped with
its partial bytes. It also ends after two minutes with no call. Where the add-on runs
(the owner), the bytes go to the blob store of the workspace and are read from it, so
in a cluster the frontend and the add-on node share objects and need no shared disk.
Outbound, the frontend checks the access of the chat to the file before it makes the
handle and gives the owner the hash and size of that content only. Do not use a
connector.file.* call outside a connector call. An add-on that declares no files
is never sent a handle.
The SDK of the first-party add-ons (addons/internal/connector) has Put and Get;
a platform implements StreamReader and StreamSender and keeps only its own HTTP
calls. The limits come from the platforms’ own documents: see the table in
File limits.
Inbound. A pull add-on answers poll with normalized messages (cursor, chat,
thread, direct, mention, messageId, replyTo, senderId, senderName,
senderUsername, chatName, link, text, unsupported, media, mediaKinds, skip) and
the next offset. chatName (the channel or group name) and link (an https address of the message or
its thread) are optional and are only shown to the owner in the header of the chat.
mediaKinds names the kind of each entry of media at the same index (photo, voice,
audio, video_note, document); the host reads it before it fetches a file, so a binding
that takes only some kinds (inbound_media) never fetches the others. An add-on that leaves
it out hands over files of an unknown kind, which only a binding that takes every kind reads.
messageId is the platform’s ID of the message and replyTo the message it answers;
the thread conversation mode uses them. Core keeps the offset with the binding, passes it
to the next poll and stores the offset the answer names, so a new leader continues
where the old one stopped. A push add-on calls the host operation connector.inbound
with {"bindingId", ...message}; it is an inbound operation.
Both paths end in one function of the host, so the allowlist, the sender log and the
rate limit are the same.
A message is answered when it is direct (a private chat) or a mention (it
addresses the bot in a group, such as a Slack mention or a reply in a thread the bot
follows); any other message is logged and ignored. Which chat a message belongs to
depends on the conversation mode of the binding (see
How the bot answers); by default a
message with a thread belongs to a chat of that thread, shared by the people who
write in it, and any other message belongs to a chat of its sender. When a message has media (at most 8
references), the host reads each file with the op media before it makes the chat,
and attaches it to the chat, as an upload of the chat page would. The host makes the
name of each file safe again (contract.SafeFileName), and the chat saves it in its
own folder. An audio file (by its extension: .ogg, .oga, .opus, .mp3, .m4a,
.wav, .flac, …) is a voice message: the host transcribes it with the
transcription model of the instance and the transcript, under
[Voice message, transcribed], is the text of the turn; the recording is not kept.
With no transcription model, or when the transcription fails, the sender gets one
sentence and no turn starts. unsupported marks a message with no text and no file
that the add-on hands over.
The turn runs as the owner of the binding, with the tools of the binding’s saved agent.
Where it runs. Core calls the route and registers the host operation on the process
that owns the add-ons. The binding loops run there, under the leader lock in a cluster.
A frontend that does not own the add-ons runs no loop.
Existing bindings. A binding of kind telegram that names no add-on (made before
connectors became add-ons) belongs to the add-on telegram. While that add-on does not
run, the binding is listed as not running with the reason “install the Telegram add-on”.
Change proposals from chats
A model can ask to change what lasts: a note in the person’s memory, or the
profile of a saved agent. The host stores the request as a change proposal and
writes nothing until the owner confirms. The mechanism belongs to the host and
knows no chat platform, so every surface that runs a model uses it the same
way: a Studio chat, the chats of any connector add-on and a chat started from an
add-on page. An add-on needs no code and no manifest field for it.
How it works for an add-on author:
The model calls the built-in tool propose_change (kind, scope, target,
content, summary) in the tool group changes. A connector add-on carries the
chat like any other: the tool result tells the model that nothing is saved
yet, and the model says so in the platform.
The proposal records its source as {kind, id, chat, thread}. kind is the
origin of the chat (empty for a chat a person watches, connector for a
messaging app), id is the binding, chat is the host chat. These names
come from the host, never from the platform.
The owner confirms in Studio. The host then writes the file as the owner in
one workspace change set, so Files history and revert_change can undo it.
revert_change {id?} undoes an applied change at once, because it only
restores the earlier text. Without an id it undoes the last applied change of
the same agent. A file edited since cannot be reverted.
The record is contract.ChangeProposal in pkg/addons/contract and is
versioned (v: 1). Readers ignore fields they do not know. The kinds are
memory, profile, skill, page and dashboard; this host offers all five.
A memory change writes under
Memory/ (Memory/<file>.md for scope user, Memory/agents/<agent>/ for
agent, Memory/channels/<binding>-<hash>/ for channel). A profile writes
LocalAI/agents/<agent>/profile.md and is at most 4 KiB. Other contents are at
most 16 KiB. A target that is not a plain lower-case file name is refused, so a
proposal cannot leave Memory/.
A memory change with scope project writes Projects/<folder>/memory/<file>.md
for the project of the chat. A person who has write access to a project that
another person shares can also propose a note for it. This widens the record
with two optional fields, and a reader that does not know them ignores them:
proposer: the person who made the proposal, when it is not the owner. The
owner is still the person whose home the note is written to and the only
one who can confirm, edit, dismiss or revert it. The host never sends an
account here: the owner reads a display name. The field is empty for a note
from the owner’s own chat.
project_node: the identity of the shared project folder, which the host
checks again when the owner confirms.
The model names the shared project with the project argument of
propose_change: the reference of a shared project that the chat has pulled,
exactly as the tool description lists it. It cannot name a project the chat did
not pull, a project of its own, or an ID. A project that is shared read-only is
refused. The host checks the share again when the owner confirms. If the
project is no longer shared for editing, or it is archived, deleted or moved,
the proposal is settled as stale, the owner is told, and nothing is written.
The host keeps a read-only view of the proposals a person made for other
people’s projects, with their status and never the owner. Today it is a service
call only: an endpoint and a screen for it come later. The owner sees a display
name for the proposer and nothing of the proposer’s chat, agent or messaging
sender. The owner’s “revert last” skips a grantee note that the owner confirmed: the
owner undoes it by its ID. A note for another person’s project is never saved at once, whatever
the save setting of either person. The save setting and the memory choice of the
proposing chat decide whether it may propose; the settings of the owner do
not.
The other three kinds follow the same flow:
skill: the content is a full SKILL.md (name and description in the
frontmatter; the name must equal the target). Scope user writes
.skills/<name>/SKILL.md, scope agent writes
LocalAI/agents/<agent>/skills/<name>/SKILL.md; no other layer is offered.
A skill with locked: true in its frontmatter cannot be changed by a
proposal, and a locked personal skill cannot be replaced by an agent skill of
the same name. The check runs again when the owner confirms.
page: the target is the page name (lower-case letters, digits and dashes)
and the files are an object of paths to text, with an index.html. The paths
must stay inside the page folder, at most 32 files, all text, page.json
checked like the Pages screen reads it, 256 KiB in total. The owner’s
confirmation writes pages/<name>/ as one change set, so one undo removes it.
dashboard: the content is the full LocalAI/home.json, validated against the
same schema as the Home settings. A file that breaks the schema is refused
when proposed and when edited at confirmation.
Limits and safety:
Rule
Value
A proposal waits
5 minutes, then it expires
Pending proposals of one person
10 (for notes proposed for other people’s projects, counted on the person who proposes)
Pending proposals of other people for one shared project
10
Proposals of one agent (or of plain chats) in an hour
5
Target changed after the proposal
the confirmation is refused (409)
Run started by a trigger, a job or a page, and sub-agents
never offered the tools
Chat that runs a saved agent
refused until the owner grants the kind (see below)
A saved agent proposes a kind only when its builtins list holds the grant of
that kind: memory.write, profile.write, skills.write, pages.write,
dashboard.write or knowledge.write. The tool exists in a chat when the agent holds the grant, the
user may still use it and the chat did not switch the changes group off; its
schema lists only the kinds the chat holds. A plain chat holds what its user
may use. A run that started by itself never holds a grant. GET /api/chats/agents/builtin-grants lists every grant with its title, description
and sensitive flag. A host can add a proposals.Gate on top: it is asked with
the action (propose or revert), the agent, the kind, the scope and the
source, after the grant check.
How a memory note is saved
By default every memory note is a proposal that the person confirms. The person
can change this for memory notes only, in the Memory tab of the account settings,
where the server keeps the choice as its own setting. A person who chose on the page of an
add-on that declares a user setting with the role memory.save-mode (the
old Short memory add-on declared one, with the key save-mode) keeps that choice until they
choose in the account settings. The host finds the setting by its
role, so core code names no add-on:
Value
What happens
ask (default)
The model proposes the note and the person confirms it, as above.
auto
A note from the person’s own Studio chat is saved at once. The chat shows “Saved to memory” with an Undo, and no confirmation card.
never
The model cannot propose a memory note: propose_change does not list the memory kind, and the tool is not offered at all to a chat that holds no other kind. A call that still comes gets a plain refusal.
An automatic note goes through the whole proposal path: the grant, the gate, the
target and size checks, the hourly limit and the audit. It is then confirmed as
the person, so it is one change set that revert_change and the Undo of the card
restore. The record has auto: true, and the audit lines of the write say it was
automatic. The safety rules are the host’s, not the add-on’s:
Only a chat of the signed-in person can save without asking. A chat that a
connector started always asks, whatever the setting says, because the sender of
a message is not always the person. A trigger or a job never has the tool.
never is the narrow side, so it applies in every chat, connectors included.
A saved agent cannot widen the choice. Its grants decide whether it may propose a
kind; the person’s setting decides how a memory note is applied. An agent with its
own memory.write grant still asks when the person said ask.
A turn saves at most 5 notes without asking, a note over 4 KiB is not saved
without asking, and a note that looks like it holds a secret (a private key
block, a token, password: ...) is not either. Such a note becomes a normal
proposal that waits for the person, and the model is told so.
Only the memory kind reads the setting. A profile, skill, page or dashboard
change always asks.
If the setting cannot be read, the host asks. A failure never turns into auto. So
does a missing declaration: without an add-on that declares the role, an old stored
answer is ignored. An add-on that is not running does not count as auto. When
several add-ons declare the role, the strictest answer wins (never, then ask,
then auto), and a person who has not chosen on one of them counts as ask.
The hourly limit of 5 proposals per agent also counts automatic notes.
Every step is audited (propose, refuse, confirm, dismiss, expire, stale,
revert) with the source and a SHA-256 of the text, never the text.
REST, under the chats feature:
Route
Does
GET /api/chats/changes?status=
list your proposals
GET /api/chats/changes/{id}
read one
POST /api/chats/changes/{id}/confirm
write it; a JSON body {"content": "..."} writes the owner’s own text in place of the proposed one, with the same size limit
POST /api/chats/changes/{id}/dismiss
answer no
POST /api/chats/changes/{id}/undo
restore the file
GET /api/chats/changes/audit
read the audit
Studio draws every proposal the same way, for any kind and any source. In a chat
the tool line of propose_change carries a card {kind: "change_proposal", id}
and the thread shows it under the message: the kind, the file and the scope, the
source (a chat, or a connector with its binding), the time left, and a line diff
against the file as it is now. The owner can Confirm, Edit then confirm (the text
the owner writes is saved in place of the model’s) or Dismiss. After a
confirmation the card is a receipt with Undo. A proposal that waited a day shows
as expired, and one whose file changed since shows as stale; both offer to ask
the assistant again, and nothing was written. A write that fails leaves the
proposal waiting and says why. A kind the card has no wording for is shown by its
name. The changes that wait are also counted on the inbox button of the chat
header, and the Proposals page (/app/chats/proposals) lists them with the same
card.
In a cluster the proposals and the audit live in the shared database (the auth
database), so any frontend can confirm what another one stored. The limits are
checked in the same transaction as the insert. A race between two frontends can
let a limit be passed by the number of frontends that insert at the same moment,
never more. Without a database they live in a file under the data path, or in
memory when there is no data path.
Context files
A context file is a short index in the user’s home folder that the host puts in the
prompt of a chat, so the model knows what the user has saved without a tool call. The
details of each topic stay in files next to the index and the model reads them on demand
with the context_read tool. The mechanism belongs to the host, not to one app: a plain
chat in Studio, a chat that a Slack binding started and a chat that a Telegram binding
started all go through the same loader. An add-on does not add code to the host; it
declares a source.
Declare a source
A source has four fields:
Field
Meaning
id
A name, unique among the sources of the host.
scope
user (every chat of the user), project (the chats of one project), agent (the chats of one saved agent) or channel (the chats that one connector binding started).
path
The index file, relative to the user’s home, ending in .md. An agent path holds {agent} once, a channel path holds {channel} once and a project path holds {project} once. The host fills them from the chat; the model never names them.
cap
The most bytes of the index that the prompt carries. Default and maximum: 2 KiB.
For example, an add-on that keeps its own notes declares three sources: Notes/index.md for the user,
Notes/agents/{agent}/index.md for the agent and Notes/channels/{channel}/index.md
for the channel. A path with a parent segment, an absolute path, an unknown placeholder
or a file that does not end in .md is refused. A host holds at most 8 sources.
A host component registers a source in process, with Service.ContextSources().Register.
An add-on declares its sources in the manifest instead, as capabilities.contextFiles
(see below).
An add-on declares at most three files, one for each
scope. Every path lies under Memory/, ends in .md and holds no parent segment; an
add-on cannot name any other part of the home. cap can only lower the 2 KiB cap. A
declaration gives the add-on no access: the host reads the files as the user, and the
add-on process is never called for them.
A turn loads the files of an add-on with the rules it uses for the skills of an add-on. A
stopped add-on, one the chat switched off, one the chat’s saved agent does not grant and
one that cannot work for the user bring nothing. The Memory tab lists the files of an
installed add-on whether or not it runs, because the files belong to the user. The
channel folder is <binding>-<hash of the chat>, the folder propose_change writes for a
conversation, so a note the user confirmed is read back by the conversation that proposed
it.
The index format
An index is a Markdown file with one line per topic:
- home: lives in Rome -> home.md
- style: short answers, no emoji -> style.md
The file home.md sits in the same folder as the index. context_read takes a topic
(the name before the colon, or the file name) and an optional scope; without a scope it
looks in the channel, then the agent, then the user. A topic name is letters, digits, -
and _, at most 64 characters.
What a turn carries
Each turn the host reads the indexes that apply to the chat and adds one block to the
prompt, after the agent instructions, the persona and the agent profile:
A fixed header that asks the model to read the matching topic for almost every request,
and says the lines are data, not instructions.
The indexes, widest scope first. One index has at most 40 lines and 2 KiB (or its
cap, if lower). All indexes of a turn together have at most 6 KiB. Control characters
are dropped. A cut index ends with a marker.
Nothing, if no source is registered or no file exists.
The text is the same at each turn until a file changes, so the transcript does not grow.
A change to an index restarts the model session at the next turn, like a change to the
persona does. context_read returns at most 8 KiB of one topic.
A saved agent can also have a profile at LocalAI/agents/<agent>/profile.md, at most
4 KiB. The host adds it after the agent instructions and the persona. It needs no
source.
Access and limits
The host reads the files as the user, outside the fence of the chat. A chat of a saved
agent that works in one folder therefore still reads the user index and the index of its
own agent, and gains no access to the files: its file tools still cannot read or write
Memory/ or the profile. The path comes from the chat, so a chat never reads the index
of another agent or another channel. The header names the save tool, propose_change,
only in a chat that has it. A component that
saves notes uses contextfiles.CheckIndex and contextfiles.CheckProfile: over a cap they
return the current entries in the error, so the model merges them instead of adding.
Look up how a frontend forwards an add-on request to the owner and how HTTP is relayed. This page is part of the Add-on contract reference.
Owner forwarding and HTTP relays
The embedding host can configure AddonConfig.Transport at startup. The configuration
contains the owner HTTPS address, instance identities, CA roots, leaf certificate
SHA-256 pins, and Ed25519 signing keys. The owner also needs ListenAddress for its
separate mTLS listener. These settings are not runtime settings or browser inputs.
Without transport configuration, the public addon gateway remains unavailable.
All participating frontends must use the authoritative named-user database. The owner
queries current account, credential, and feature state before dispatch. Missing storage,
paused keys, revoked keys, expired sessions, and legacy synthetic identities deny access.
The embedding host’s permissive installation callback cannot override these checks when
transport is enabled in the default named-user mode. Local-owner HTTP access exists only
when the deployment sets OwnershipMode: "local-owner". A request never selects it; only the deployment does, and local-ai run does so by default when authentication is off.
The carrier requires TLS 1.3, CA verification, and explicit certificate pins. It obtains
a fresh random audience from the pinned owner before signing each request. Each owner
handler generates its own audience at construction. Restart therefore invalidates all
previous envelopes, including envelopes whose expiry has not passed. A bounded nonce
cache prevents replay within that handler. This cache is a documented per-owner exception;
it does not require shared storage because no other process can use that audience.
The signed payload binds the peer, actor, credential reference, operation ID, request
body, audience, nonce, and expiry. When a chat made the call, it also binds the chat
(chat: the user’s principal and the chat ID), so the owner runs the add-on’s
workspace operations with that chat’s access (see
Workspace operations). A changed, added or removed chat fails
the signature check. A request that no chat made has no chat field and signs as
before. An owner that does not know the field refuses a forwarded call that a chat made,
so upgrade the owner before the frontends. The carrier never forwards browser authorization,
cookies, or actor headers. It has no proxy discovery, redirects, affinity, fan-out,
owner election, or failover. An absent owner returns unavailable.
Two more optional capability fields describe the UI-only resource management (see
UI-only resource management).
Field
Meaning and bounds
capabilities.undo
Boolean. The add-on keeps a change set for the writes a chat makes at once and answers the host’s undo calls (see Undoing a change a chat made). It changes no tool and offers nothing to a model.
capabilities.adminTools
At most 4 tool names that only the host’s own UI-only endpoints may run. An admin tool is never in tools, never has a tool definition, is never offered to a model and is refused by every model, proposal and typed-read path: the declared-tool rule of those paths reads tools only.
capabilities.connector
Optional. 1 to 4 kinds of messaging binding the add-on serves, each with an id, a title, a delivery (pull or push) and optional texts and a page. See Connector add-ons.
capabilities.client
Optional, feature level 7. 1 to 32 routes that a paired client may call, each with an id, a method, a path and optional stream, maxBodyBytes and timeoutSeconds. The last segment of a path may be {name...} (feature level 8): it matches one or more segments and the add-on must validate the joined value itself. Needs capabilities.service. See Paired clients: inference and add-ons.
featureLevel
Optional positive integer, default 1. The feature level the add-on needs from the host. See Feature level.
setup
Optional, feature level 4. What the person needs before the add-on works, as a short phrase such as an access token. A string or a map of language tag to string, like ui.title. For an add-on that has no connector kind; a kind has its own kinds[].setup. See Setup text.
capabilities.resources
Maps the management operations to tools: create (a declared tool of kind create), rename (a declared tool of kind schema), inspect (a declared tool of kind read whose result is an object with a name and a revision), delete (the one admin tool) and a plain-text singular noun. Every field is optional. An admin tool must be the delete of the mapping, and a mapping must name tools that exist with the kind it needs. A mapping with create or delete must also declare the read tool resource-exists in tools, because the host settles interrupted creations and deletions only on its explicit answer. list asks the host for a listing tool; see Resource listing.
A tool definition names the resource it works on with a required resourceId
argument, with two exceptions. A create tool has no resourceId: the host
reserves the resource. A read tool may leave resourceId out when it answers
about the person who calls it and not about a resource, for example a list of
that person’s own items. The host runs such a read without a resource, binds the
envelope to the calling user, and the add-on must scope its answer to that user.
The host operation the add-on calls must scope by the actor of the envelope; the
add-on never takes a user from the arguments.
A write or schema tool, and a read tool that offers resourceId, must
require it.
A tool definition with "uiOnly": true is for the add-on’s own page. It must be a
read tool without resourceId. The host runs it for the page like any such read,
but never offers it to a model, a chat, an agent or a trigger, and a model that
names it gets the unknown-tool answer. The Sandbox uses it for set-backend and
confirm-host: they change a setting, and the add-on asks the host whether the
caller is an administrator before it acts.
Deferred tools
A tool definition with "deferred": true is offered to a chat through the
tool search:
the chat sends tool_search, tool_describe and tool_call and the model finds
the tool by words, reads its schema and calls it, instead of getting its schema on
every turn. Use it for the tools of a large add-on that a chat seldom needs. Keep
the three to five tools that a chat uses most loaded (leave deferred out), so
the model can call them at once.
A manifest that sets deferred on any tool must declare featureLevel: 11. A host of an older level refuses the add-on cleanly with “needs a newer LocalAI” (the add-on is not installed or upgraded). A library entry can say the same with requires.featureLevel: 11.
The field changes the prompt of a chat only. The tool keeps its name
(addon__<id>__<tool>), its kind, its role check, its approval and its
proposals: tool_call runs the tool the chat would have offered, so the chat’s
switch of the add-on and the ceiling of an agent apply. A tool of an add-on that is
off, not installed or not running for the chat is not listed and not callable.
The add-on page, MCP clients, agents and triggers list tools in their own way and
are not affected.
The setting chats_tool_search decides whether a chat defers. off: never, every
tool is typed. on: always. auto (default): when the schemas of the deferred tools
of the chat’s add-ons reach a tenth of the context window. The LocalAI groups are decided
apart, on their own schemas, so installing or stopping an add-on never moves them. The
answer does not change from turn to turn. An add-on that declares no deferred tool
changes nothing. The three bridge tools appear when either source is deferred.
The text of a deferred tool competes with the LocalAI tools in the same tool_search;
when two tools score the same, a LocalAI tool comes first. Name and describe the tool
with the words a person would use.
A deferred tool still counts toward the add-on tool cap of a chat: deferring changes
what the model is sent, not how many tools a chat may have.
A uiOnly tool cannot be deferred (no model is offered it), and a tool that
shadows a built-in tool cannot either (it must keep that name). The host refuses
the manifest with an error.
Add-ons that keep the owner’s own data
An add-on that keeps the data of one person and needs no credential and no resource list (the
Calendar and Contacts add-ons) sets capabilities.ownerData to true and
featureLevel to 3. Its tools name no resource: the add-on keys the data on the user in the
authority of the call, never on an argument. Reads run at once for every sender a messaging
bot lets in. A tool of another kind than read is held to tools.write in a messaging chat,
like the writes of a credentialed add-on: the owner and the senders paired with the bot hold
it without a tick on the bot, and every other sender (a listed person who is not paired, a
channel, a bot that accepts anyone) can read but not change. To let everyone the bot lets in
change the data, tick Let people who are not verified change things with add-on tools
(tools.write) in the permissions of that bot. The tick covers every sender, including listed
people and, for a bot that accepts anyone, any sender, and it applies to these add-ons only:
for other add-ons tools.write still stops short of a sender who is only let in. A trigger or a job runs the writes
only under the act.addons grant of the action policy, as for any action tool.
Resource listing for agents
An add-on whose resources a person may want to hand out one by one can opt in to
per-agent resources:
agentScoped, nounPlural and i18n.<language>.resources need featureLevel 2
(see Feature level). agentScoped also needs a list mapping,
else the manifest is refused.
The host names the resources in the agent form with noun and nounPlural, or
their translation for the language of the page. noun is the singular fallback
when there is no plural. Main-app texts name no add-on and no noun.
The add-on is not told about the agent. The host checks the list of the agent
before it forwards a call that names a resource, and filters the listing and the
selection of a chat. See
Resources of an agent.
A tool that writes in such an add-on needs tools.write in a messaging chat.
A confirmation the owner can relax
A write tool with "approval": "always" always waits for a person. This holds with or
without a credential: an add-on that declares none gets a stored proposal with the hold
approval_always, and the host applies it only when the owner confirms it in the browser.
A model, an API key, a trigger, a job or a sub-agent only proposes; it never runs the
write. The proposal expires like any other proposal, and the approval card shows it.
Only an add-on with a credential can relax the confirmation (see below). A tool can also
declare "approvalOverridable": true, so that the owner can choose not to be asked for
that one tool. It is the only way to relax approval, and it needs three things:
The add-on declares a credential. The choice belongs to the person who owns the
connection.
The manifest declares the user settingapproval-<tool> with the
values ask and skip, the default ask and no role. A manifest with another
default, other values or no setting is refused at install.
The owner sets it to skip on the add-on’s page. The write needs the owner’s own
browser session, like every user setting, so no model, API key or tool call can do it.
The host then runs the tool without a card only when the connection’s write mode is
propose or auto (never off) and the call comes from one of two places:
a chat that the owner has open themselves, or
a messaging chat in which every sender of the turn is paired with the bot.
A sender who is only on the allowlist, a sender let in because the bot accepts anyone, a
role, a trigger, an agent job, a page, a sub-agent, and any call with no chat still get a
proposal that waits for a person. The setting is read again when the call is applied, so
switching it back stops a call that was stored a moment earlier. A tool that is not
marked approvalOverridable is never relaxed, whatever the setting holds. In a cluster
the decision for a messaging chat needs the grant of the turn, which lives on the
frontend that runs it; a call without it asks.
The write mode auto, which the add-on pages call Allow all, lifts the same ceiling
for these tools: with a connection on auto, a tool marked approvalOverridable runs
without a card whatever its approval-<tool> setting says, because the person chose to let
the agent act without asking for the whole connection. A tool with "approval": "always"
that is not approvalOverridable still waits for a person in every write mode. Use that
for an action that must never run unasked. The mail, Gmail, Google Drive and PiKVM add-ons declare none.
Every call that runs without a card is logged with the add-on, the tool, the connection,
the user and the outcome (applied, rejected, unknown or not_run), and never the
arguments. The same line is added to the connection’s latest decisions. The connection’s
access view and its access preview (approvals in the answer of
GET /api/chats/connectors/{id}/access and of the preview route) list each relaxable tool
with its setting and who it runs for without asking now.
A write the connection’s mode decides
A write tool that declares no approval follows the write mode of its connection:
off refuses it, propose holds it for a person to confirm in a card, and auto
applies it at once. The add-on pages name the three modes Read only, Asks you first
and Allow all (some older pages say Runs at once or Acts without asking). The
mail, Gmail, Google Drive and PiKVM add-ons offer all three. Declare "approval": "always"
only for a tool that must wait for a person even in Allow all; it also keeps the tool
waiting in propose, so an add-on that wants the connection to decide leaves it out.
Before the mail, Gmail and Google Drive add-ons offered Allow all, their write tools
declared "approval": "always", so a connection that an API call had set to auto still
waited for a person. Those tools no longer declare it, and such a connection now applies
the change at once. The mode belongs to the person, who sets it on the add-on page with
their own session; a model cannot change it, and a new connection made on the page starts
on propose. The SSH add-on works this way: its run tool declares no approval and
no approvalOverridable, so the connection is the one place where the person chooses
between confirming each command and running it at once. The card of a held command shows the
host and the exact command (see SSH).
The host limits a write call to the apply timeout (60 seconds), so a write tool that runs a
command must stay below it.
What happened to a tool call
Every call of an add-on tool from a chat writes one line to the host log when it ends,
whatever the ending:
chat is the origin of the chat: studio for the web UI, or connector, trigger,
job or page.
sender says who the call is for: owner in the web UI; paired, listed, role,
channel, anyone or mixed for a messaging turn (how the sender was let in);
trigger or job for an unattended run.
outcome is ok, held (a write that waits for a person), denied (a rule stopped it
before the service was called) or error. A write that waited in a messaging chat
later gets one more event in Latest decisions: confirmed, cancelled or
expired (see Confirming a held write in the chat).
reason is a stable code: a code of the permission chain (sender_needs_pairing,
connection_permission_off), write_mode_off, write_mode_propose or
approval_always for a write that waits (waiting_in_chat when the bot asked in the
chat), chat_confirmed, chat_cancelled or hold_expired for its end, resource_not_allowed or
resource_not_in_agent_list, select_connection, act_read_only, or
upstream_<status> when the service behind the add-on refused the call.
status is the HTTP status that service answered, when the add-on says so.
The line holds names and codes. It never holds the arguments, the result, a token or the
text of a note. An identical line is written once in 30 seconds; the next one says
repeated=<n> for the ones it held back.
The same event is kept in memory, at most 20 for each connection and each bot, and the
connection page shows it under Latest decisions with the tool, the outcome, the reason
in the language of the page and the time. GET /api/chats/connectors/{id}/access returns
them as tool_outcomes. They reset when the server restarts.
Confirming a held write in the chat
A write tool waits for a person when the write mode of its connection is ask first.
In the web UI the owner confirms it on the Add-ons page, or right from the web chat that
made the call: the card of the held change has a Review and confirm button that opens
the host approval of that proposal (see Changes that wait in a web
chat). In a messaging chat the host
now asks in the chat itself, when the bot has proposals.confirm enabled and at least one
sender is paired with it.
What is written. The host writes one message in the chat and thread of the request:
the title of the tool in plain words, the resource, and the facts the tool definition
lists, then how to answer: yes or no, or confirm CODE or cancel CODE when
several wait. It never writes the words of the model, a token or a raw JSON dump, and
every fact is cut to 120 characters. A tool definition lists its facts with two optional
fields: title (at most 60 characters) and summaryFields (at most 6 keys of the
sample that the preview returns). A key that is not listed is never repeated in a chat.
Who may answer. Only a sender who is paired with the bot and holds
proposals.confirm. A sender on the allowlist who is not paired, a member of a listed
channel, and anyone on a bot that accepts anyone get one sentence and nothing runs. The
person who asked and the person who answers can differ; the audit line names both. The
owner can still confirm or cancel it in the web UI.
What runs. The call stored with the proposal, bound to its digest, exactly as
proposed. A code works once. The answer must come from the chat and thread where it was
asked. The result goes back as one short message: a link or number the tool returned
when it is safe to show (an https address without credentials), or the plain reason it
failed, such as a refusal of the service behind the add-on.
Limits. At most 5 writes wait in the chats of one bot, at most 10 are asked in an
hour, and a proposal expires after 5 minutes. The records survive a restart. Above a
limit the write waits for the owner in the web UI and the model is told so.
Not in the chat. A tool that declares approval: "always" still waits for a person
at the web UI, whatever a chat says.
The model. The result of the tool says the write waits for confirmation in the chat,
with the code, so the model does not say it was done. The web chat shows status lines
for waiting, confirmed, cancelled, expired and failed.
When the service behind an add-on refuses a call (a token without the permission, a name
that does not exist, a value it does not accept), the add-on tells the host the status and
one fixed sentence that names the fix. The model gets code: upstream_refused, the
upstream status and that sentence as message, and tells the person plainly instead of
reporting an outage. An add-on does this by returning protocol.Upstream(status, hint, err) from its runtime (the 400 answer carries the X-Addon-Upstream-Status and
X-Addon-Upstream-Hint headers; a host that does not read them behaves as before). The
sentence must hold no token and no text the service sent back.
A write that waits for a person (the write mode of the connection is propose, or the
tool always asks) says so in one sentence. In the web UI the user confirms or cancels it
on the Add-ons page. In a messaging chat the model tells the sender that the change waits
for the owner, who confirms it in the web UI: a chat turn never confirms a change.
Tools that replace a built-in tool
A chat has a few built-in tools that an add-on may replace: bash,
web_search and web_fetch (contract.ReplaceableTools). The file tools are
not on the list: they are the one file toolset of every chat. A tool
definition replaces one with "shadows": "<name>":
Checked at install. The name must be on the list, a page-only tool
cannot shadow, and one manifest shadows a name once. The tool must also look
like the built-in it replaces, so the model calls it the same way and the
user keeps the consent split of the built-in name:
Name
Kind
Must declare (and may require only)
bash
action
command (string)
web_search
read
query (string)
web_fetch
read
url (string)
Extra optional properties are allowed, and a shadowing tool names no
resourceId. The tool adapter checks all of this again when it lists the
tools: a tool that fails keeps its add-on name and replaces nothing.
In a chat. When the add-on is installed, running and on for the chat, the
model sees one tool under the built-in’s name, served by the add-on, and the
built-in one is hidden. The call still goes to the add-on under its own name
(addon__<id>__<tool>), with the same checks and audit. An add-on that is
off for the chat, stopped, not granted by the chat’s agent or unavailable
offers nothing, so the built-in tool serves again. The chat’s Tools menu
says so in one line (“Sandbox replaces bash but cannot serve this chat now
…: the built-in bash serves”, or that the chat has no such tool when the
built-in is off too), from fallbacks of GET /api/chats/{id}/tools. A
tool without shadows keeps its add-on name.
Qualified identities. The shared tool adapter formats and parses
addon__<id>__<tool>. Both components must match
[a-z][a-z0-9-]{0,63}. Model-callable names cannot exceed 64 characters.
Execution-status binding rejects plain names, malformed names, and names
whose add-on ID differs from the selected provider. The real adapter already
supplies canonical names; this check also guards the binding boundary.
Studio’s unavailable stand-ins use the same component grammar but do not
apply the model-callable total length limit. A long stand-in identifies an
unavailable add-on; it does not make that name callable through the adapter.
Who served it. A call the add-on served carries the card tool_provider
with the add-on’s ID, so the chat shows the provider on the tool line.
Several add-ons. Only one add-on serves a name. An administrator picks it
in Settings, Tools (runtime setting chats_tool_providers, a map from the
tool to the add-on ID; the same map holds the choices for the built-in skills
an add-on replaces, see Skills); with no choice, the add-on
installed first serves (ties go by add-on ID, and an add-on installed before
the host kept the time sorts last). A chosen add-on that is installed but
cannot serve the chat (stopped, off for the chat, not granted by its agent)
gives the built-in tool, not another add-on; a choice of an add-on that is
not installed is ignored. With no choice, the oldest add-on that is running
serves. Settings > Tools lists every installed add-on that replaces a name,
running or not, oldest install first, with the install time of each, marks
a stopped one (stopped) and the default as Default: installed first,
and says “The add-on that replaces this tool is not running: the built-in
tool serves” when none serves (stopped and note in
GET /api/chats/admin/tools). The
library entry and the installed view list the names an add-on replaces in
shadows, and the install dialog warns when an installed add-on already
replaces one: “This add-on replaces the built-in bash. Another add-on
(Sandbox) already does. Only one can be active; you choose which in
Settings > Tools. Until you choose, the one installed first serves.” The
install is still allowed.
Install time. The owner records when an add-on was first installed
(installedAt, RFC 3339 in UTC) in its lifecycle journal, next to the other
install facts. An upgrade keeps it; removing the add-on and installing it
again sets a new one. GET /api/addons/apps and the installed view of an
administrator carry it, and More details shows it. An add-on installed
before the host kept the time has none. Distributed state: shared. The
time lives in the owner’s journal, the one durable record of the install, and
the frontends read it from the owner, so every frontend picks the same
default. A choice in chats_tool_providers always wins over it.
Other consumers. The OpenAI-compatible API, MCP and agents keep the
add-on name; only chats act on shadows.
Public API
POST /api/addons/dispatch accepts a contract request. Supported lifecycle actions
are install, enable, disable, and uninstall. operation-status is read-only.
POST /api/addons/relay accepts {request, kind, handle}. Kinds are status,
progress, json, file, and asset. Handles are not filesystem paths. For file
the handle is the identifier of a private file result (see
Private file results), never an addon output handle.
Both routes require named authentication and the addons feature. Lifecycle
dispatch additionally requires current administration rights. Cookie requests require
same-origin fetch metadata; header-authenticated clients use their validated keys.
POST /api/addons/proposals, GET /api/addons/proposals/{id},
POST /api/addons/proposals/{id}/confirm, .../cancel, .../reconcile and
.../resolve store, read, apply, withdraw and resolve data or schema proposals. See
Proposals and confirmation.
GET /api/addons/resources/{resourceId}/proposals?state=unresolved lists, for the owner
role of the resource only, the proposals on it whose outcome is unresolved, whoever
proposed them. See Unknown outcomes and recovery.
GET /api/addons/artifacts/{id} and GET /api/addons/artifacts/{id}/download read
the state of, and download, a private file result of the caller. See
Private file results.
GET /api/addons/apps, GET /api/addons/apps/{id}/icon?generation=N,
GET /api/addons/apps/{id}/glyph?generation=N,
POST /api/addons/apps/{id}/start and .../stop list and control the addons as
apps. See Apps.
GET/POST /api/addons/resources, .../resources/{resourceId}/grants,
.../grants/{userId}, .../users, .../rename, .../delete, .../changes/{changeId}/undo, .../operations/{operationId}
and /api/addons/conversations/{conversationId}/selection/{addonId} list, create,
share, rename and delete a person’s resources and keep the resource a conversation
works on. They are UI-only. See UI-only resource management.
Every failure response has the body {"error":{"type","message"}}. A denial or
unavailability has typeaddon_error and a code. An outcome_unknown response is
status 503 and also carries the original operationId. Keep that operationId after
an outcome_unknown response. Query
operation-status; do not create another mutation. The carrier never retries mutations.
Manager.OperationStatus binds the lookup to the user who started the operation and to
the current administrator. A later browser session or another key of the same user reads
it. Another user, or an unknown ID, gets status 404 with typeoperation_not_found,
which is not a refusal of the role.
It does not submit, repair, start processes, or write the journal. completed describes
durable lifecycle publication, not runtime health. runtimeState: not-observed makes
that distinction explicit. Ambiguous legacy actor bindings deny lookup.
Progress is coarse lifecycle-state SSE, not byte counts or percentage completion.
The stream sends an initial snapshot, changed snapshots, and a heartbeat snapshot.
It polls no faster than 250 milliseconds and rechecks authority on each poll.
It closes on a completed or failed operation. A lifecycle writer can delay observation;
disconnecting still cancels the waiting lookup. Install-byte progress requires later integration.
RelayLimits has finite startup defaults: 60 seconds, 16 concurrent streams, 64 MiB
for files, 8 MiB for assets, and 1 MiB for progress. Heartbeats default to five seconds.
Overrides cannot remove these bounds. Streams cancel on disconnect and reject excess bytes.
The receiving frontend applies the budget of the relay kind: file uses the file
limit, asset the asset limit, progress and status the progress limit, and json
at most 2 MiB. An unknown kind is denied on the frontend before the owner is contacted.
Only content type, attachment disposition, cache policy, and nosniff headers cross the carrier.
Browsers never receive an addon process address.
A denial that the owner makes before it writes the first response byte (an invalid kind,
missing admission or resolver, a refused resource, or a revoked credential) is returned
as a typed owner status: 403 for a denial and 503 for unavailability. The receiving
frontend decodes it, so every frontend reports the same error for the same decision.
Only an authorization, policy or request rejection is 403. A runtime that is not
installed, enabled or serving, an owner that is busy or in recovery, an output that ends
before its first byte, and any unclassified owner error are 503, never a denial. A
503 does not prove that nothing ran: the owner can fail after it recorded or applied a
mutation. A frontend therefore reports a mutation that gets a 503, or a transport
failure, as outcome_unknown with the original operationId, and never as plain
unavailability. The owner’s own frontend reports it the same way as every other
frontend. When an error carries both a denial and an unavailable cause, 503 wins.
After the first byte the status cannot change; the owner then aborts the stream and the
frontend reports the stream as failed, never as a clean end.
Resource integration remains closed by default
Admission.Admit encloses the complete private-output stream lifetime. A host-owned
resolver maps resource references and opaque output handles to trusted records. A missing
admission provider or resolver denies access, including access by installation administrators.
The owner installs the policy described below as both providers at bootstrap; a frontend
that forwards to the owner, or a host without the policy, keeps denying. File results are
held by the private artifact store described in Private file results;
without it a read that returns a file output is denied whole and a file relay is denied.
Principals, roles and grants
core/services/addons/policy is the owner-local authority for resource access. Its store
is a private directory (policy/ below the addon root, file mode 0600, one holder at a
time) that is separate from replaceable packages, so it can be backed up and restored on
its own. A resource is an opaque host-issued ID bound to the trusted addon identity and
an immutable owner user ID; the addon, the model and a request never supply either.
Role
May
Viewer
read, and download private outputs
Editor
everything a Viewer may, and mutate rows
Owner
everything an Editor may, and change schema, share and delete
Grants cover whole resources, never tables or rows. Installation administration confers
no access to user data: the policy has no administrator role. Only the owner grants or
revokes, the owner role cannot be granted, and an action that is not classified is a
mutation that needs the owner. A missing resource and a resource the caller may not touch
return the same denial.
Named-user mode uses the immutable user ID and rejects anonymous and legacy synthetic
principals (such as the legacy shared API key). Explicit local-owner mode disables
sharing and warns that every unauthenticated caller shares one authority: any local-owner
caller owns every resource. A populated store opened in the other mode is refused.
policy.MigrateMode changes it only while the host is stopped (the store lock must be
free), after it wrote a backup, and shared data can never return to local-owner mode.
Account and credential status are checked again at each admission. A storage outage
of the account database is 503, while a missing, disabled or unauthorized account is
403, from every frontend. Only a definite denial (an error that wraps the shared
forbidden sentinel) is 403. Any other error from the account or creation check, and a
cancelled check, is unclassified and fails closed as 503; it is never reported as a
refusal of a valid user. The policy keeps no
current-user state: the actor is an argument of every call, so shared MCP sessions carry
none. Writes to one resource run one at a time; reads run concurrently. A revocation (or
lowering a role) is durable first, then invalidates the user’s pending proposals through
the ProposalInvalidator seam, cancels the user’s admitted work and returns only when
that work ended. If it does not end within the drain bound the call reports 503
(ErrDrainPending): the revocation is already effective for new work but is not
acknowledged. The owed drain is stored with the change itself, together with the
resource’s authority epoch at the lowering. Every admission carries the epoch it was
admitted under. Repeating the same SetGrant or Revoke after a failed attempt (or after
a restart) invalidates proposals again and waits only for the user’s work admitted before
that lowering; it is acknowledged only after both finished, and the mark is then cleared.
Work admitted after the grant became durable again is neither cancelled nor waited on by
the retry. A later lowering starts a new epoch and covers it. Disabling or uninstalling an addon keeps its resources and grants; purge is
a separate, explicit operation that is not available to tools.
A new resource needs explicit creation authority. At bootstrap that authority requires a
current account check and an addon that is installed, enabled and not changing on the
owner; an absent addon is denied and a manager that cannot answer is 503. Register
records the resource pending and inaccessible before the addon creates anything; Commit
activates it, and Reconcile resolves registrations left by a crash. The owner runs
Reconcile at startup before it serves. It asks the add-on whether the backing exists:
yes activates the record, no drops it. Reconcile is fail-soft per record. When the
answer cannot be established (the add-on is disabled, failed to start or does not
answer), that record stays pending and hidden, is never dropped or committed, keeps its
pending quota, and the pass goes on with the other records. Startup never aborts for this,
and the owner logs a warning with the settled and kept counts. A background loop re-runs
Reconcile every 30 seconds while any record is pending, so a record is settled once its
add-on is enabled and ready. The loop stops when the owner closes and waits for a running
pass. Pending reservations of a disabled add-on therefore stay pending until the add-on is
enabled again. A database with no record is never reachable.
Registrations are bounded. Per owner user at most 8 pending and 256 total resources, and
at most 4096 in the store (Options.MaxPendingPerUser, MaxResourcesPerUser,
MaxResources; zero selects these finite defaults). A request over a limit is denied
with 403 (ErrQuota); abandoning or reconciling away a registration frees its slot.
The store file is validated on open: an unknown role, a grant to the owner, a second JSON
document after the first, or an unknown field refuses the store, which is never reset.
Leftover .policy-* temporary files from a crash are removed on open. If a change was
renamed into place but the directory synchronization failed, the in-memory state follows
the file (a revocation is not undone) and the store accepts no further writes, reporting
503, until the host restarts.
Explicit local-owner mode
Set --addons-ownership-mode=local-owner (or AddonConfig.OwnershipMode in an embedding
host) to select this mode. local-ai run also selects it by default when authentication
is off and you set no mode. Nothing else selects it: a missing credential, an absent
account database or an unknown value never does, and an unknown value fails startup.
If you turn authentication on later, set the mode to named-user and move the data
with policy.MigrateMode while stopped; the store refuses the other mode. The owner logs a warning at startup that unauthenticated
callers share one authority and that any caller that can reach the port can confirm
addon proposals.
Every caller that passes the addon route chain acts as one synthetic principal,
local-owner, with a fixed credential local-owner. Named-user mode rejects that ID,
so it cannot collide with a real user.
That principal owns every resource and sharing is disabled: SetGrant and Revoke
are denied.
With the authentication feature disabled (no account database) there is no caller
identity at all: any client that can reach the HTTP port shares the authority, including
lifecycle administration. Use this only on a trusted loopback or private network.
With an account database, the route chain still authenticates callers and applies the
addons feature gate, and lifecycle changes still need an administrator; only data
ownership collapses to the single local owner.
The store records the mode. Opening a populated store in the other mode is refused;
use policy.MigrateMode while stopped. Shared data cannot return to this mode.
Moving between the modes
The mode is a property of the stored data, so it is changed with the host stopped and
never by changing the configuration alone:
Stop the owner. The migration needs the store lock, which a running owner holds.
Make a backup of the policy store. The migration writes one itself and refuses to
continue when it cannot.
Name the mapping of identities. From local-owner to named users, every resource
needs the account that takes it ({"local-owner": "<account id>"}; there is no
wildcard and no default, and the target must be a current account). From named
users to local-owner, a store that holds named-user data is refused, because
that data would lose its separation.
Start the owner in the new mode. A store opened in the wrong mode is refused at
startup, so a configuration mistake never silently changes who owns data.
A backup made in one mode restores into the other mode only with the same explicit
mapping (see Data recovery).
Resource reads obtain the current ready runtime incarnation and check the exact generation.
Private output copying rechecks credentials and stays inside admission until completion
or cancellation. Immutable assets use installed package receipts, declared entry/CSS paths,
and a contained filesystem root; an account that holds the addons feature may read the
declared files of an enabled add-on it may see (see The asset route).
Mutation MCP tools remain deliberately unavailable. The later MCP integration defines
safe listing/status tools for proposals; prompt text cannot authorize mutation and no tool
confirms a proposal. For that reason /api/addons/dispatch, /api/addons/relay and the
proposal routes are deliberately not mapped in the LocalAI Assistant tool catalog
(core/services/localaitools) yet. The route map test only
requires an entry for each registered tool, so no test is weakened. The routes are described
in the generated Swagger document under the Addons tag.
Run sh scripts/addons/verify.sh policy for the policy suite.
Look up proposals and confirmation, the management of resources from the UI and private file results. This page is part of the Add-on contract reference.
Proposals and confirmation
Every data or schema mutation that comes from an API client, an MCP session or the
OpenAI-compatible chat route is a stored proposal first. A proposal is applied only
by an explicit confirmation of that stored operation from the person’s own browser
session. The chats on the server, their agents and their triggers are the exception
described under Lifecycle: there the add-on switch is the consent.
Sharing and database deletion are never proposals and never tools.
Declared tools
The owner checks every request that names a tool against the manifest of the installed
current generation before anything reaches the add-on. The tool name is the top-level
tool key of the request arguments. The rule is the same for a read, a proposal
(write or schema), the confirmation of a stored proposal and the opening of an
output, on the owner’s own frontend and on every forwarding frontend:
No tool key: the request names no tool, and the rule has nothing to check.
An exact tool key: the value must be a string that equals one entry of
capabilities.tools byte for byte. A name of another add-on, a case, Unicode or
white-space variant, an empty value and a value that is not a string are denied.
A key that equals tool only after case folding or trimming white space (Tool,
TOOL, tool) is denied, because an add-on decoder may read it as the tool.
A repeated key is denied at any depth of arguments. Keys are compared after JSON
unescaping, white-space trimming and Unicode case folding, so "tool" and
"\u0074ool" collide, and so do "tool" and "TOOL". A runtime that keeps the
first value would otherwise run another tool than the one that was checked.
arguments must be exactly one JSON object. An array, a scalar, null, trailing
data after the object, invalid JSON and nesting deeper than 64 levels are denied.
This rule runs in the declared-tool check itself, so it holds for reads,
proposals, confirmations and output opening whatever validation ran earlier.
A denial is the standard 403, and the add-on is not contacted. A proposal is denied
before the preview and nothing is stored. A stored proposal is checked again at
confirmation, so a tool that an update withdrew is never applied.
Only a real answer is a denial: the tool is not declared, or the generation is stale
or not installed. When the declarations cannot be read, the request is unavailable
(503) and nothing runs: the manager is closed or not the owner, the journal is
uncertain or runtime recovery is required, the request context is done, or the
source fails for any other reason. An unclassified failure is unavailable, never
success and never a policy denial. The owner and every forwarding frontend give the
same status. The owner reads declarations from its in-memory journal, cached for
each generation.
Lifecycle
Tools reach a model through the same proposals: a chat that sets
metadata.addon_tools can call the tools of enabled addons, and a change a
tool proposes waits as a pending proposal. The chats on the server (/api/chats),
their agents and their triggers are the one exception: turning an add-on on for
a chat or an agent is the consent, so a change tool is applied at once as the
chat’s user. The chats adapter stores the proposal and confirms it in the same
call with the credential of a chat turn, so the same admission, revision
and receipt rules hold, a failed call leaves no pending proposal, and no API
key, MCP session or browser request can use that credential. The result says
what was applied and whether it can be undone: Tables, Fine-tuning and
Quantization keep a change set for the changes they can roll back, and the result
carries undoable, the changeId and a one-line undo. See
Undoing a change a chat made. GET /api/addons/proposals?state=pending
lists the caller’s own pending proposals (newest first, at most 32). See
Tables for the tool names, the
approval card and the inventory of tool consumers.
POST /api/addons/proposals takes a typed write or schema request. When the
arguments name a tool, the owner derives the action from the kind the manifest gives
that tool (write tools are data writes, schema tools are schema changes) and
refuses a request whose action disagrees, a read or create tool, and a tool the
manifest does not define. The owner
resolves the resource, requires write authority (schema needs the owner role), asks the
addon for a preview and stores a proposal with:
the canonical arguments, the addon generation, the resource and the proposing user;
the schema and data revisions the preview saw;
the exact number of effects and a bounded sample of them (the addon’s preview summary,
using count and sample when it has them);
a digest of everything above (it also covers the operation ID, the proposing user and
the action; the owner recomputes it from the stored record before it applies, so a record
that was changed at rest is refused and never runs), and an expiry (the shorter of the addon’s preview expiry
and the proposal expiry limit, five minutes by default).
Nothing is applied by this call. The request’s operationId becomes the proposal ID, so
every later step, including a lost reply, is resolved by the same ID. Repeating the same
request returns the same proposal. Reusing an ID with other arguments, another actor or
another resource is a denial.
A proposal is in exactly one state:
State
Meaning
pending
Waiting for a human decision.
cancelled
Withdrawn by its actor, or invalidated when the user’s authority on the resource was lowered or revoked.
expired
Not confirmed in time. The owner records it when the clock runs out, on the next proposal, on start and on recovery, whether or not anyone read it.
executing
Confirmed and handed to the addon. Durable before the addon sees the call.
applied
Committed. The receipt is stored with the proposal.
rejected
Refused by the addon (for example, the revision moved) or found stale (the addon generation changed).
outcome-unknown
The apply may or may not have run. A receipt lookup, or the resource owner’s explicit acknowledgement, resolves it.
abandoned-unknown
The resource owner stopped waiting for an unresolved outcome. It no longer blocks writes and is never applied again; a later receipt lookup is still recorded.
Bounds. A user holds at most 32 live proposals (pending ones that have not expired, and
unresolved ones) and at most 16 MiB of stored canonical arguments across them; the store
holds at most 1024 proposals and 64 MiB of arguments. The user’s own bound is checked
first, so one user can exhaust only their own share. A limit reached is a typed quota
denial (HTTP 403) that names which bound it was. To make room for a new proposal the owner
drops settled proposals only (cancelled, expired, applied, rejected), the proposer’s own
first and then the oldest; a live proposal of another user is never dropped. Settled
proposals are also dropped after a retention window of 24 hours by default
(BrokerOptions.Retention), so a repeated request inside the window still gets its stored
answer. Retention cannot be switched off.
Every transition is written atomically and fsynced by the owner before it is reported. The
store lives beside the policy store and follows the same rules: one process holds it, a
corrupt file is refused and never reset, and a restart recovers it.
Creating a resource
A request with action: "create" and no resourceId proposes the creation of a new
resource, such as a Tables database. Nothing exists yet, so the owner works in this order:
It checks the creation authority of the caller and that the named tool is declared.
It reserves a pending resource for the proposer. A reservation is invisible to everyone,
the proposer included, counts against the pending limit of the user and is bound to the
proposer. The proposal records its ID as resourceId.
It asks the addon for a preview with the reserved ID. The preview only validates the
request and creates nothing. What the human sees (count 1 and the requested name) is
built by the owner and not taken from the addon.
Confirming runs the creation under the creation authority of the proposer, which is checked
again, and not under a role on a resource. The addon operation ID is create- and the
reserved ID, so a repeat is one operation. A committed receipt makes the proposer the
private owner of the resource. Cancelling, expiry and a rejected receipt drop the
reservation; the resource was never visible.
An uncertain apply keeps the reservation pending and the proposal outcome-unknown. A
receipt lookup settles both. The proposer can also stop waiting (resolve): the
reservation is dropped only when the addon’s resource-exists tool confirms that the
database does not exist, and it stays pending when the addon says it exists or cannot
answer. At start the owner settles reservations of unknown or executing proposals by asking
the addon, and keeps those of proposals that are still pending. A reconciliation never drops
the reservation of a creation that is running in this process.
Confirm
POST /api/addons/proposals/{id}/confirm with {"digest": "..."} submits exactly the
stored parameters under resource admission, once. The runtime validates the revision in
the same transaction as the write, so a data change after the preview is a rejected
proposal and not a silent overwrite. Confirming again returns the stored receipt and
applies nothing.
The route is reachable only from a host confirmation surface:
The credential must be a browser session cookie of the user who proposed. A named API
key, a bearer token, a legacy key or an MCP session can propose and read, and can never
confirm, whatever its role.
The request must be a same-origin fetch (Sec-Fetch-Site: same-origin,
Sec-Fetch-Dest: empty, Sec-Fetch-Modecors or same-origin).
The X-LocalAI-Confirm header must equal the proposal ID, and the body must carry the
digest of what was displayed.
A request that carries a tool, agent or MCP execution marker (Mcp-Session-Id,
X-LocalAI-Tool-Call, X-LocalAI-Agent, X-LocalAI-Execution-Context) is refused.
In local-owner mode there is no session; rules 2 to 4 apply, and any API credential on the
request is refused. The owner repeats the credential check, so a frontend cannot confirm
for a key credential either.
Limit of the confirmation boundary in local-owner mode. Without accounts there is no
identity to bind a confirmation to. The only boundary is the set of browser headers
above, and a script that sets them can confirm: any caller that can reach the HTTP port
shares the authority to propose and to confirm, and that includes the proposals
it made itself. This is inherent to local-owner mode, where unauthenticated callers
share one authority, and it is accepted and not changed. The owner logs a warning at
startup that says so. Use local-owner mode only on a trusted loopback or private
network, and use named-user mode wherever a confirmation must come from a particular
person. Plain text, a boolean in arguments, or a model saying “yes”
are only data and never approve. Clients without a confirmation UI can propose and read;
they never auto-apply. No MCP tool maps to confirm: the MCP exposure of proposals (list
and status only) is a later task and must keep that rule.
Unknown outcomes and recovery
Every proposal call is idempotent by the proposal ID: a proposal is a single-use state
machine, and repeating a call with the same ID returns the stored state and never starts
a second operation. The owner therefore answers an outage by what it knows about the
proposal, and every frontend reports the same answer for the same owner state:
Response
Meaning
What to do
503proposal_unavailable with operationId
The owner could not serve this call, and this call sent nothing to the addon. The proposal is in the state the owner recorded, which can be any state: pending, or already settled by an earlier call.
Read the proposal with GET, then repeat the same call with the same ID.
503outcome_unknown with operationId
The request to the addon may have reached it (executing or outcome-unknown). A request that never left the owner (no free slot, a withdrawn add-on, an invalid envelope, a connection that was never written to) returns the proposal to pending and is proposal_unavailable. An add-on’s 409 conflict ends the proposal as rejected.
Do not confirm again as a new operation. Reconcile, wait for the automatic lookups, or resolve.
Which type a route can emit does not depend on who proposed the operation. A proposal,
a confirmation and a cancellation by the proposer can be either type. A resolution is
always proposal_unavailable, because resolving never applies anything and the resolver
is the resource owner, who is not always the proposer. A confirmation that the addon
committed answers 200 with the applied proposal; the owner does not read the record
back through a second account check that could fail after the apply.
A reply lost between a forwarding frontend and the owner for a confirmation is reported
as outcome_unknown, because the frontend cannot know whether the owner started it.
The lifecycle dispatch rule is unchanged: any uncertain lifecycle mutation is an unknown
outcome with its original operation ID.
If the reply to a confirmation is lost, or the owner restarts while a proposal is
executing, the proposal is outcome-unknown and the response is outcome_unknown with
the original operationId. The mutation is never submitted again under any ID.
POST /api/addons/proposals/{id}/reconcile looks the operation’s receipt up on the addon
and records a committed or rejected result. It is read-only toward the addon and can be
repeated. An addon that has no receipt for the operation stays outcome-unknown: a
missing receipt does not prove the call never ran. While an outcome is unresolved, every
other write or schema proposal on the same resource is denied; a pending proposal
shows blocked: true; reads continue. A write denied for this reason is 403. For
the owner role of the resource only, the body is type outcome_blocked and carries
blockedBy, the operation ID to resolve. Any other user gets the plain denial and never
learns another user’s operation ID, also not in a proposal view. On start the owner settles proposals left
executing by a crash the same way and never applies them.
Recovery has three steps and none of them submits the operation again:
Automatic lookups. The owner repeats the receipt lookup for each unresolved
proposal with exponential backoff (from the BackoffInitial limit up to
BackoffMax). They run for a finite window: the apply timeout plus five minutes,
counted from the moment the apply was handed to the addon. A final receipt settles the
proposal and lifts the block. After the window, only an explicit lookup remains.
Explicit lookup.reconcile, by the proposer, at any time.
Owner resolution. The owner role first finds what to resolve:
GET /api/addons/resources/{resourceId}/proposals?state=unresolved lists every
unresolved or abandoned proposal on the resource, whoever proposed it, with its ID,
state, proposing user, action, exact effect count and bounded effect sample, expiry,
digest and age in seconds, oldest first. It never returns the proposed arguments or a
credential. Only the owner role of that resource may call it, from the same
confirmation surface as resolve with X-LocalAI-Confirm equal to the resource ID;
editors, installation administrators and API keys are denied, and no MCP tool maps
to it. Then POST /api/addons/proposals/{id}/resolve with
{"digest": "...", "reason": "..."} (the digest from the list, required and checked
by the owner itself, not only by the HTTP route) lets the owner role of the resource
stop waiting. It is accepted only from the same confirmation surface as confirm (the
owner’s own browser session, a same-origin fetch, X-LocalAI-Confirm equal to the
proposal ID, no tool or agent marker). The proposer’s role is not enough, an
installation administrator without an owner role on the resource has no access, and
no API key or MCP tool can call it. A final receipt found at that moment settles the
proposal instead. Otherwise the proposal becomes abandoned-unknown and records who
acknowledged it (resolution.actorId), when and the reason (up to 512 characters).
Writes on the resource are accepted again.
An abandoned operation keeps its original operation ID. The owner keeps looking its
receipt up in the background for a day and on every reconcile; if the addon reports
that it ran, the proposal becomes applied with that receipt (or rejected), and the
resolution stays on the record, so a late success is recorded and never hidden. An
abandoned record is kept for 30 days and is not dropped to make room.
Data consistency. Resolving is the owner asserting that the outcome is not worth waiting
for; it does not prove the change did not run. If it did run, it stays in the data. Later
proposals preview the current revision, and the runtime refuses an apply whose revision
moved, so a change prepared against the state before the unknown one is rejected and not
applied on a stale view. Check the data before you resolve when that matters.
Revocation races
Lowering or removing a user’s grant cancels that user’s pending proposals on the resource
before the change is acknowledged, and stops their admitted confirmations. A confirmation
that already reached the addon becomes outcome-unknown and is resolved by receipt.
Other frontends reach the proposal state only through the owner’s gateway, signed and
actor-bound like every other forwarded call.
Run sh scripts/addons/verify.sh proposals for the proposal suites.
UI-only resource management
A person manages their own resources, for example Tables databases, from the host’s own
pages. The routes below are the whole surface. They are never tools: no model tool, no
MCP tool, no proposal and no typed dispatch reaches any of them, and sharing and deletion
have no tool definition anywhere. The routes live in the addons feature group with the
usual browser protections (CSRF, same-origin cookie requests), and they are registered in
the route-feature registry.
Route
Who
What
GET /api/addons/resources?addonId=
any caller with the feature (keys too)
The resources of the add-on the caller owns or that were shared with the caller, with the caller’s own role, the display name, the owner’s display name for a shared one and, for the owner role only, how many people it is shared with and the revision. At most 100. The names are read at most half of the add-on’s concurrency budget at a time, so a page that reads while it lists is not refused.
POST /api/addons/resources
the person’s own session
Create a resource through the add-on’s create tool. Caller becomes the owner; the resource is private.
GET /api/addons/resources/{resourceId}/grants
owner role, own session
Who it is shared with: immutable account ID, display name, role.
PUT /api/addons/resources/{resourceId}/grants/{userId}
owner role, own session
Give a named user viewer or editor on the whole resource.
“Own session” means the same rules as a confirmation: a browser session cookie, a
same-origin fetch, X-LocalAI-Confirm equal to the resource ID (the operation ID for a
creation) and no tool, agent or MCP marker. An API key, a bearer token and a legacy key are
refused, whatever their role. In local-owner mode the rules are the same without a session.
The grants, the picker and the receipt lookup are owner-role reads of other people’s data and
use the same surface.
Every call goes to the owner through the carrier, so a frontend that holds no addon state
gives the owner’s own answer. The state is the owner’s alone and is single-runner by design:
the policy store with its deleting records, the proposals and the selection store
(selections/ below the addon root) are never read or written by a frontend, and a
frontend that cannot reach the owner reports a mutation as outcome_unknown with the
original operation ID. The owner checks the caller’s role itself, with the same denial
for an unknown resource and for one that is not the caller’s. Installation administration is
not data access: an administrator lists and changes what they own and nothing else.
Creating, renaming and deleting
These are the person’s own explicit actions, so they need no approval card, but they follow
every other rule of a mutation.
Create. The owner reserves a pending resource, runs the add-on’s create tool through
the same preview, apply and receipt steps as a chat creation, and activates it. The
resource ID is derived from the person and the operationId, so repeating the call
returns the same resource and a repeat with other arguments is refused. The arguments are
validated against the tool definition of the manifest exactly as a model’s call is, and a
crash is settled at the next start like any pending reservation. The per-person limits
apply (quota_reached).
Rename. The call runs under the resource’s admission, behind an unresolved outcome
(outcome_blocked for the owner role), against the generation and the revision the owner
listed (stale, nothing changed). The add-on’s receipt for the operation is the record:
repeating an operationId replays it, and two people that chose the same ID never share one.
Delete. The order is durable at every step:
the resource becomes deleting: inaccessible to everyone, no new admission and no grant
change, and admitted work is cancelled and waited for (bounded);
with no work left, the owner checks the revision it listed and the confirmation: the
request must carry confirm, equal to the display name exactly. A failure returns the
resource to use;
the deletion is marked confirmed, pending proposals of every user on the resource are
cancelled, and the add-on is asked to delete under one operation identifier;
only after the add-on confirmed, the record and every grant are removed.
A crash leaves a deleting record. At the next start an unconfirmed one is returned to
use, and a confirmed one is finished; a reconcile loop retries one that cannot be finished
while the add-on is down. The resource stays inaccessible meanwhile. Deleting never
uninstalls the add-on and never touches other resources. An outcome that cannot be
established is outcome_unknown with the original operationId: repeat the same call, or
look the receipt up; nothing is submitted under a new operation.
Before it calls the delete tool, the owner asks the add-on’s resource-exists tool whether
the backing is still there. Only that explicit answer of the declared tool can say “gone”,
and then the record is removed without the delete tool. An add-on that is not installed,
does not declare the tool or cannot answer never counts as “gone”: the deletion stays
deleting, is reported as outcome_unknown and is retried by the reconcile loop, so the
data is never left behind a removed record. This applies to the request, to a repeat of it
and to the recovery at start.
The delete tool is declared in capabilities.adminTools. The owner is its only caller, from
the delete endpoint and its own crash recovery, under the host action delete, which no
model tool, proposal or typed request can carry. The add-on refuses the tool under any other
action.
Changing data and schema from the UI
POST /api/addons/resources/{resourceId}/apply is how a person’s own page changes rows or
the schema, for example the Tables page. The body is {operationId, generation, revision, tool, arguments}. It is not a proposal: nothing is stored for later and no card is shown,
because the request in the person’s own tab is the intent. It keeps every rule of a
mutation:
Tool.tool must be declared in capabilities.tools with a definition of kind write
or schema. Reads, creations, the add-on’s mapped rename, create and delete tools, admin
tools and undeclared names are 400. The arguments are the tool’s own, without the
resource (the path names it) and without tool; they are validated against the
definition exactly as a model’s call is, so an identity, role or approval field or an
unknown field never reaches the add-on.
Role. A write tool needs at least the editor role; a schema tool needs the owner
role. A viewer, an editor changing the schema, a person with no grant and an installation
administrator get the answer of an unknown resource.
Admission and revision. The change is admitted per resource, waits behind an unresolved
outcome, and is checked against the generation and the revision the caller read (409 stale, nothing changed). The add-on’s receipt is the record: repeating an operationId
with the same request returns the same result and never applies twice; the same ID with
another request is refused as 409 operation_conflict before the add-on is called, with
nothing applied (never outcome_unknown). The host binds each operation ID to a request
hash (requestHash: SHA-256 of the resource, the tool and the canonical arguments, per
user), returns it with the result, and keeps it for a bounded number of recent
operations. An add-on that refuses the reuse with 409 on /apply gets the same
answer.
Result. The answer carries the new revision and the receipt’s result (for Tables,
the count and the changed row ids). An outcome that cannot be established is 503 outcome_unknown with the original operationId; look it up with kind=apply and never
submit a new operation. The lookup answers state plus the tool and requestHash the
ID was used for. Pass requestHash=<hash of your request> to ask about your own request:
a hash that differs from the recorded one is 409 operation_conflict, and a hash the
host does not hold (for example after a restart) is state: unknown, which is safe to
answer by repeating the same request. A client that compares requestHash before it
believes committed never mistakes another change for its own.
Undoing a change a chat made
A write, schema or create tool called from a chat, an agent or a trigger is applied at once
(there is no card), so undo is the safety net. An add-on that declares capabilities.undo
keeps a change set for the changes it can roll back, in its own storage, and says so in the
receipt of the change: the receipt payload has an undo object, {"id", "available", "summary", "reason"}. The host copies it into the tool result as undoable, changeId,
undo (what an undo does, one line) and reason (why nothing was kept), and the chat shows an
Undo button on the entry. The model is told that the person can undo it and that it cannot.
POST /api/addons/resources/{resourceId}/changes/{changeId}/undo takes {operationId, generation}. The change ID is the one the tool result named. It runs under these rules:
Humans only. It accepts only the person’s own browser session, with the rules of
every UI-only mutation: a same-origin fetch, X-LocalAI-Confirm equal to the resource ID,
and no API key, bearer token, tool, agent or MCP marker. This is deliberate. It is never a
tool and no MCP tool maps to it, so a model cannot undo its own work or anyone else’s
without the person.
Role. The role of the undo is the role of the change, which the add-on reports:
write changes need the editor role, schema changes and creations the owner role. Other
callers get the answer of an unknown resource.
Stale. The undo is applied against the revision the add-on has just reported. If the
resource moved on after the change, the answer is 409 with type stale and a message that
says what changed; nothing is overwritten.
Typed refusals.not_found (404: never kept, too large to keep, or dropped),
expired (410: past the 7 days of retention), already_undone (409), cannot_undo
(409: for example the job it started has finished) and stale (409). The type of the
error is the code. outcome_unknown and outcome_blocked behave as for every mutation.
Idempotent. The same operationId with the same change is one undo and returns the same
result; after outcome_unknown look the receipt up with kind=undo.
Result.{resourceId, changeId, operationId, revision, summary, deleted}. deleted is
true when the change was the creation of a resource: the host deletes it with its own delete,
and only while the add-on says nothing touched it since.
For an add-on author: declare "undo": true in capabilities, add the key undo to the
receipt payload of every change, and answer two calls that are never in capabilities.tools,
so no model can name them. The read tool changes-get takes {change} and answers
{id, class, state, summary, detail, current, deletes} with classwrite or schema and
stateavailable, stale, expired, undone, cannot or not_found. The apply with the
action undo and the tool changes-undo takes {change} and the revision current, and
answers a committed receipt, or a rejected receipt whose payload is {"error": code, "message"}. The add-on checks the action and the scope itself. Tables, Fine-tuning and
Quantization implement it; Fine-tuning and Quantization undo only the start of a job, by
stopping it while it runs.
In a cluster the undo travels the same carrier as every resource call: a frontend forwards it
to the owner, which calls the add-on, and the typed refusal crosses the carrier as the same
typed error. The change sets are state of the add-on, in its own storage on the owner (for
Tables inside each database file), so they are covered by the add-on’s backups, restores and
purges and need no extra shared state on the frontends; the carrier and the owner keep none.
An SDK-based page does not call the route itself. sdk.resources.apply (see
the SDK) sends it for the add-on and generation the SDK is
bound to.
Sharing
Grants are whole-resource and viewer or editor; the owner role cannot be granted.
Named-user mode only: local-owner mode answers 409 with type sharing_disabled, and
anonymous and legacy principals are never grantees. The grantee is named by the immutable
account ID that the picker returned, and must be an active named account that holds the
addons feature. The picker finds such accounts by a prefix of the display name or of the
address (2 to 64 characters, at most 20 results) and returns only an ID and a display name,
never an address; the caller and the owner are left out, and the wildcard characters of a
query mean themselves. Lowering or removing a grant cancels the user’s pending proposals and
stops their admitted work before the call is acknowledged; a drain that does not finish in
the bound is 503 and the change is already effective for new work.
The resource of a conversation
The selection is a convenience for chat, not an authority. The owner stores an opaque
resource ID keyed by the authenticated user, the conversation ID and the add-on, in its own
bounded store: at most 256 entries per user (the least recently used is replaced), 8192 in
total, expiring after 90 days without use. It is not process-global, not shared between
people or conversations, not part of the chat history and not sent to the model.
PUT requires at least the viewer role on the resource now.
A tool call of a chat request that names no resourceId uses the conversation’s selection.
The conversation ID comes from the authenticated request (the X-LocalAI-Conversation-Id
header the chat sends), never from the model’s arguments, and the owner authorizes the
reference for the caller on every call. A reference that was revoked, whose resource was
deleted, that was edited in the store or that belongs to another person gets the denial of
an unknown resource: the result of kind error with code resource_unreachable, from the
owner and from every frontend. The reference stays and works again if the grant does.
With no selection the tool call returns a result of kind error and code
select_resource: no operation runs and the model is told to ask the person to choose.
A refusal the model can act on is a result of kind error, never a raw error string.
The codes are invalid_request (the add-on refused the call; a message carries its
reason when it gave one, such as a missing training engine: the first line of the add-on’s
answer, printable ASCII only, at most 200 bytes), not_permitted (the
person lacks a permission), resource_unreachable (no such resource, or no access; a read
and a change are denied the same way, and the result does not tell a missing resource from
one the person may not use) and
not_running (the add-on is starting or stopped; nothing was sent). Each note says that
nothing changed and not to repeat the call. A preview that finds a conflict, such as a
table that exists, is an invalid_request, not an outage. The tools of the fine-tuning and
quantization add-ons are not offered at all to a person without those permissions.
An explicit resourceId in the arguments is the person’s own word and is used as before.
Errors
Status
error.type
Meaning
400
invalid_request
A missing or wrong confirmation, an operation the add-on does not support, arguments or a name it refuses, a malformed identifier.
403
addon_error
Not the person’s own session, or the feature or role is denied: one answer for all of them.
403
not_permitted
The add-on checked a host permission of the person, such as fine-tuning, and it is not granted. Nothing changed.
403
resource_unreachable
The resource does not exist or the person has no access to it: one answer for both, for a read and for a change.
403
package_unverified
An install failed because the package does not match its library entry or is not a valid add-on package. Nothing was installed.
An install or upgrade failed at the step the type names. Nothing was installed. The server log has the detail.
403
quota_reached
The per-person resource limits.
403
outcome_blocked
Another operation on the resource has an unresolved outcome (blockedBy is shown to the owner role only).
404
not_selected
No resource is selected, or the reference is no longer usable.
409
stale
The generation or the revision the caller saw is out of date; nothing changed.
409
sharing_disabled
Local-owner mode has no named users to share with.
503
outcome_unknown
A mutation may have run. operationId is the original; repeat the same call.
503
addon_error
The owner or the add-on cannot answer.
A request that the add-on itself refuses as invalid (an unknown table, an unknown field, a
value its schema rejects) is 400 with error.typeinvalid_request on every route that
reaches the add-on: the typed apply, a read through dispatch or relay, a proposal and its
confirmation, an artifact open, and the chat tool result (kind error, code
invalid_request). The owner’s own frontend and every forwarding frontend give the same
answer. The add-on answers HTTP 400 or 422 and the runtime client types that answer as a
refusal; any other non-success stays an outage (503). A refusal is deterministic and
nothing was applied: it is never outcome_unknown, the same call is refused again, and the
caller corrects the request instead of repeating it. An operation ID whose preview or
apply was refused is not consumed: the host forgets its binding and the add-on removes the
pending line it wrote for it, so the corrected request may reuse the same ID. A refused
proposal is not stored. A confirmation the add-on refused ends the proposal as rejected.
A selection call has no operation: a lost answer is plain unavailability and the call is
safe to repeat.
Private file results
An addon read can return file outputs, such as a CSV export. A file result is a private,
temporary artifact of the user who asked for it. It is not a shared file: the model,
media, upload and agent file routes and the frontend code artifacts never see these
bytes, and the existing file APIs are unchanged.
What the host does with an output
The owner never returns the addon’s output handle to a client. When a read result has
file outputs, the owner reserves one artifact for each (all of them, or none) and
replaces the handle in the result with the artifact ID: an opaque, random,
host-generated identifier. An addon handle, URL or path is never an identifier and
never names a file. The handle must be a valid ID of the contract; a URL or path in its
place is refused and nothing is read.
The artifact records the requesting principal, the source resources (the request’s
resource, as the policy recorded it), the addon and its generation, the operation, the
sanitized name, the media type, the declared size and the expiry. The addon handle is
kept only in memory while the copy runs; only a digest of it, with the principal and
the operation, is stored so that a repeated request finds the same artifact.
A bounded background worker copies the bytes from the registered runtime endpoint of
the addon (and from nowhere else) into a private staged area under artifacts/ in the
addon root: directories 0700, files 0600. The worker streams with one 32 KiB buffer
and never holds the whole file. It stops at the declared size: a stream that is
short, long by one byte, cancelled or failing is never published, its partial bytes are
removed and the artifact is recorded as failed with a fixed reason. The bytes are
published only by an atomic rename after the stream ended cleanly.
The copy runs under an output admission of every source resource, so a revocation
cancels it and waits for it, like any other admitted work. At completion the owner
checks again that the account is current and that the principal can read every source
resource, that the addon is installed, enabled and at the same generation, and that the
artifact is not expired. Only then is it recorded as complete (metadata is written
atomically with fsync, validated on load and never reset).
Another user’s artifact, an unknown ID, an expired one and a malformed one are the same
403, so identifiers cannot be probed. Read access to the source resource does not give
access to another user’s artifact, and sharing a database never shares its exports.
Routes
GET /api/addons/artifacts/{id} returns the artifact view: state (transferring,
complete, failed, cancelled), sanitized name, media type, size, sources, addon,
generation and expiry. It is the status lookup of the background transfer. It is
read-only, actor-bound and never shows a path or an addon handle.
GET /api/addons/artifacts/{id}/download streams a complete artifact. The receiving
frontend relays it from the owner through the file relay, so a download works from
every frontend and no frontend holds the bytes. It needs the session or key of the
requesting principal and the addons feature. Before the first byte and while streaming
the owner checks the account and read access to all source resources again; a revocation
cancels the stream. A failure after the first byte aborts the connection, so a truncated
file never looks complete (the response carries the exact Content-Length).
No MCP tool maps to these routes in this release. A tool that returns a file result is
added with the Tables export; it will return the artifact reference, not a URL.
Response safety
Every download is an attachment (RFC 6266, with an ASCII filename and a UTF-8
filename*) with a sanitized name, X-Content-Type-Options: nosniff,
Cache-Control: private, no-store, a Content-Security-Policy that sandboxes the
response and Content-Length. The name loses path elements, control characters,
bidirectional overrides and invisible characters, shell and file system metacharacters and
leading or trailing dots, is prefixed when it is a reserved device name and is at most 100
characters. The media type is one of text/csv, text/plain, application/json,
application/x-ndjson, application/zip, application/pdf, image/png, image/jpeg or
application/octet-stream; everything else (HTML, SVG, XML, JavaScript) is served as
application/octet-stream, and parameters are dropped. A browser request with a session
cookie must be a same-origin fetch or navigation like the other addon routes.
Spreadsheet formula handling of a CSV is the addon’s concern; the host only delivers the
bytes as a download.
Limits
All limits are finite and validated at startup; a partial or unbounded override is
refused.
Limit
Default
One artifact
64 MiB (at most the relay file bound; a file result larger than the configured relay file bound is refused whole at ingest, so nothing is staged that cannot be downloaded)
Declared bytes of one user / of all users
1 GiB / 4 GiB
Artifact records of one user / of all users
100 / 1000
Concurrent transfers (all / one user)
4 / 2
Concurrent downloads
16
Lifetime from creation
1 hour
One transfer
5 minutes
Quotas are enforced under one lock when the artifact is reserved, so concurrent requests
cannot exceed them; a refusal reserves nothing. A quota refusal is 403, a busy store is
503. A repeated request (same principal, operation and output) returns the same
artifact and uses no more quota.
Lifecycle
Expiry. A sweep (every minute) removes artifacts at their expiry, transfers that no
worker owns, artifacts of an uninstalled addon and files that no record names; opening
the store also settles interrupted transfers and removes unreferenced files. An
expired artifact is never served, even if the sweep did not run yet or the expiry falls
while a download is being admitted or streamed. A download that meets a sweep which
removes the artifact at that moment gets the same 403 as any expired or unknown
identifier, never a corruption error. The sweep removes the bytes only of records it
really changed: a transfer that completes while the sweep runs keeps its bytes.
Storage errors. Only bytes that are definitely missing, not a regular file or of
another size than recorded mark the artifact failed and remove the bytes (503). A
transient storage error (for example too many open files or an I/O error) is 503
and leaves the bytes and the record as they are, so a later download can succeed.
Disable. A disabled addon denies downloads and accepts no new file result. The
complete bytes are kept until their normal expiry. Enabling it again serves an artifact
only while it is unexpired and only to a principal that can still read every source
resource.
Uninstall. An uninstalled addon denies downloads at once and its artifacts are
removed by the next sweep (they are not kept until expiry, because nothing can answer for
them). An addon update to another generation does not serve the older build’s files.
Restart. Complete artifacts survive a restart. A transfer that was running is
recorded as failed and its partial bytes are removed.
Close. Closing the owner cancels running transfers and streams, waits for them and
writes nothing afterwards.
Run sh scripts/addons/verify.sh artifacts for the artifact suites.
Look up the Apps, the pages of an add-on and the extension points of the UI. This page is part of the Add-on contract reference.
Apps
Enabled addons behave like apps: a list of what is available, with an icon, a title,
a state and, when the addon has a page to open, an Open action.
Who sees what
GET /api/addons/apps needs named authentication and the addons feature. The
owner builds the answer from its own journal, so every frontend gives the same
answer:
A caller sees every addon that is installed and desired-enabled. Version one has
no per-addon access list; the data an addon holds stays under its own per-resource
ACLs, which every call checks again. The apps a caller sees are the addons the same
caller could call. Hiding an entry is never the control.
An administrator also sees installed addons that are disabled (state stopped,
enabled: false), so that a stopped addon can be started. The owner decides who is
an administrator from its own current account check, never from the request. If that
check cannot answer, the caller gets the reader’s view.
A headless addon is listed with its state and tools and has no mainPage, icon
or title beyond its identifier.
Each entry has id, name (the same as id), title, description (the
default-language text; titles and descriptions carry every language when the
manifest localizes them), icon, version, generation, enabled, state,
mainPage, hasUI, launchMode, tools (at most 32 names; the manifest has no tool
descriptions) and toolCount. Administrators also get admin with canStart,
canStop and managementUrl. Nothing of the package location, its source or the
addon’s own endpoint is returned.
state is an observation of the process, separate from enabled:
State
Meaning
running
The process is alive and admitting calls.
starting
A launch is between exec and readiness, at first start or restart.
failed
The process is not serving and no launch is under way. The supervisor restarts it after its backoff while its budget lasts, so failed can be followed by starting; when the budget is spent it stays failed until an administrator stops and starts the addon.
stopped
The addon is disabled, or no process of this generation is held.
An app can also carry update: "update-pending". It is a separate observation from
state and is present only when the owner’s cached update check says an update is
available for exactly the installed package. The list answers from that cache: it never
evaluates a check and never reaches a library, so an add-on nobody checked, one whose
check failed and one that is up to date have no update field. See
Update detection and upgrade.
mainPage is /app/addons/{id}/{page} and is present only for an enabled addon whose
manifest declares a ui.mainPage that is one of its pages. icon is
/api/addons/apps/{id}/icon?generation=N. The route is served by the host from the
verified package, relayed from the owner, with X-Content-Type-Options: nosniff and
Cache-Control: private, no-store. It is never an addon process port and never a URL
the manifest names. A stale generation, an unknown or hidden app and an app without a
verified icon give the same 403.
glyph is /api/addons/apps/{id}/glyph?generation=N when the manifest declares
ui.glyph and the receipt verified it. The route has the rules and headers of the
icon route. The UI uses the glyph as a CSS mask in the text colour in the chat
composer buttons, and the outlined first letter of the title when there is none.
Start and stop
POST /api/addons/apps/{id}/start and .../stop take
{"operationId": "...", "generation": N}. They are thin routes over the typed enable
and disable lifecycle actions: the same administrator check, the same owner
forwarding, the same operation identity and the same outcome-unknown rule. Stop drains
the process and keeps data.
Only administrators can start or stop. Everyone else gets 403 whatever the body says,
before the body is read.
generation is the generation the caller saw in the list. If the installed
generation differs, the request is denied (403) before any operation is recorded.
A repeated operationId replays; it never runs twice. After an outcome_unknown
response, keep the operationId and poll operation-status with it.
Health stays a separate observation: a successful start records intent and starts the
process; the list’s state says whether it is running.
The typed enable and disable actions of POST /api/addons/dispatch accept the same
generation precondition through the request’s generation field when it is not zero.
No MCP tool maps to the Apps routes in this release. The admin mutation tools for addons
are a later task and will have their own review.
Built-in add-ons
GET /api/addons/builtin lists the page add-ons that ship inside the web bundle, so the
My add-ons page can show them next to the installed add-ons. The answer is
{"builtin": [...]}, and each entry has an id, a kind (always page), a titleKey,
an icon and a mainPath, plus a feature or adminOnly when the entry has a gate.
Today the list is empty: Studio and Talk, which used to be built in, are packaged
add-ons now (see The Studio add-on and
The Talk add-on), so a person installs and removes them like the
others. The route is kept for the day a page is built in again. It needs an
authenticated caller and does not need the addons feature. When authentication is off,
the caller is the local owner and sees every entry. The answer depends on the caller and is
sent with Cache-Control: private, no-store.
Pins
Pinned add-ons are listed in the sidebar under Add-ons, in pin order. The menu of a pinned card in My add-ons has Move earlier and Move later.
GET /api/addons/pins returns the caller’s pinned add-on IDs as a JSON array, in order.
PUT /api/addons/pins takes a JSON array of add-on IDs, replaces the caller’s pins with it
and returns the saved list. Both routes need an authenticated caller. They need no
administrator role and no addons feature, like GET /api/addons/builtin. A PUT from a
browser must be a same-origin request or carry a credential header. The answer depends on
the caller and is sent with Cache-Control: private, no-store.
Filtering. A pin is filtered like a tile. The list holds only IDs the caller may see
now: the built-in add-ons that pass their gates (none today), plus the installed apps the owner lists
for the caller. An ID the caller cannot see is left out of a read and dropped from a
save, with no hint whether it exists. Duplicates are dropped.
Hidden pins survive. A pin that is only hidden for now (an access change, or an
add-on removed inside its retention window) is kept after the visible pins when the
caller saves.
Limit. A save of more than 32 IDs, or a body that is not a list of strings, is
refused with 400. If the add-on owner does not answer, a save is refused with 503, so
an outage cannot drop pins.
Retention. When an add-on is removed, its pins are hidden at once and kept for 30
days. If the add-on is installed again inside that window, the pins come back. After 30
days the pins are deleted. A background sweep runs every six hours; with several
frontends, one of them runs it at a time. A disabled add-on is not removed, so its pins
never expire. A sweep that cannot read the add-on owner changes nothing.
Explicit selection. New and existing accounts, including the local owner, start
without implicit pins. Startup, reads, and saves never add Studio, Talk, or any other
ID on their own. Existing saved user pins remain unchanged. Explicit pins and unpins
survive restarts and are shared across frontends with an account database.
Every absent ID follows the same 30-day retention rule, even if it was never installed.
The store no longer creates or uses seed metadata; it does not drop existing database tables.
Startup. If the pins file cannot be read (it is corrupt), the server does not start
and logs the error. It does not fall back to memory, because that would lose every unpin
at the next restart.
Distributed state: shared. With an account database, the table addon_pins is
shared by every frontend. With authentication off there is one local owner, and the pins
are kept in addon-pins.json in the data path, per instance.
builtin and pins are reserved add-on IDs: an add-on cannot use them, because the host
serves /api/addons/builtin and /api/addons/pins.
Add-on pages
An add-on with a ui object contributes pages to the web UI. The code of those pages is
the packaged ES module the manifest names, served by the owner, and the host loads it
after the host itself was built: nothing about an add-on is known to the UI build. The
host never resolves imports for it, never hands it a router, a store or a request
function, and never lets it replace a route.
The UI entry of an app
An enabled app whose installed package has a sha256 digest carries a ui object in
GET /api/addons/apps. A disabled app, a headless app and an app without a digest do not.
Field
Meaning
entry
The same-origin URL of the module: /api/addons/{id}/assets/{digest}/{path}.
css
The URLs of the declared style sheets, under the same digest.
sdk
{min, max}, the host SDK versions the module accepts.
pages, navigation, chatActions
The identifiers the manifest declares. The host decides where each is shown.
digest is the package sha256 in lower-case hex. A new package is a new URL, which is
why the files are immutable.
The asset route
GET /api/addons/{id}/assets/{digest}/{path} streams one declared file (the entry module
or a style sheet) from the verified package on the owner, relayed by the frontend that
received the request. It is a read for every caller who holds the addons feature.
The file is served only while the add-on is installed and enabled and the digest is
the current one. An older package, another add-on’s digest, a disabled or uninstalled
add-on, a file the manifest does not declare, a traversal, a directory and a missing
feature all give the same denial without any file content, and a denial is never
cached. (A path that ends in a slash is stripped by the app’s router first, so it gives
404 instead of 403.)
The owner serves the bytes, never the add-on process, and a file that is not a regular
file of the package is refused.
The response is text/javascript or text/css with X-Content-Type-Options: nosniff
and Cache-Control: private, max-age=31536000, immutable.
The browser authenticates with its same-origin session cookie. An API key goes in the
Authorization header. A credential in the URL is never accepted, and a cookie
request without same-origin fetch metadata is refused.
A replica relays the response from the owner: the same bytes, headers and denials.
There is no MCP tool for this route, as for the other Apps routes.
The host SDK
The module exports createAddon(sdk) and nothing it needs comes from anywhere else.
createAddon returns { Component, chatActions, dispose }; Component and
chatActions are optional and dispose() is required. The SDK is a frozen object:
Member
What it is
React
The host’s own React. Use sdk.React.createElement and sdk.React.useState: hooks run on the host’s React instance. A bare react import fails to load, and a second bundled React would break hooks.
ui
Wrappers over host components: Button, Spinner, EmptyState, Badge, Stack and Text. A wrapper has a fixed type, so React never remounts it.
Icon, iconNames
A semantic icon. A name outside iconNames draws a neutral icon.
theme
tokens (CSS custom property references with stable names), mode() and subscribe.
locale
language(), subscribe, define(language, bundle) and t(key, fallback, vars). Bundles belong to this add-on only.
navigation
navigate(path), href(path), current(). Only the add-on’s own declared pages resolve; anything else throws.
api
read(request) and propose(request), both bound to this add-on and its installed generation by the SDK. A read is always the typed read, with the resourceId of the resource the person named; a write is only ever a stored proposal that the host confirms. There is no raw request. Operation identifiers are op- and a UUID, which is a namespace name the owner accepts.
resources
The person’s own resources of this add-on: list, create, rename, remove, apply, operation, grants, setGrant, revokeGrant, searchUsers and selection.get/set/clear. See the resource calls of the SDK.
notify
info, success, warning, error.
markDirty(flag), isDirty()
Unsaved edits. The shell asks before it leaves or replaces the page.
layers
openDialog(spec) and openPanel(spec): the host draws the dialog or side panel and owns its focus, Escape and unmount.
signal, onDispose(fn)
The signal aborts when the add-on is withdrawn; disposers run once.
A chat action is {id, label, icon, open(context)}, where id must be one of
ui.chatActions. context is exactly {conversationId, resourceRef?}. There is no
history, message or send hook, and an add-on cannot intercept submission or override a
route. An action that is undeclared, duplicated, without a label or without open is
ignored; an error inside open never reaches the host.
Translating an add-on page
An add-on page reads its words from JSON bundles named <namespace>.<language>.json in
addons/<id>/ui/src/i18n/, one for English and one for each language of the web UI
(core/http/react-ui/public/locales). The page follows the language of the web UI, and a key that a bundle
lacks reads in English. The connector pages (Telegram, Slack, Discord, GitHub, Jellyfin, Home Assistant)
also share the bundles in addons/internal/connector-ui/src/i18n/, which hold the readiness list, the
permissions, the approval, the pairing and the file limits. A bundle uses {{name}} placeholders and
_one / _other plural keys. Do not translate product names, identifiers, capability keys or code.
node addons/internal/i18ncheck/check.mjs (part of make test-i18n and of the UI unit tests in CI) fails
when a language lacks a bundle, a bundle lacks a key of English or has an extra one, a placeholder differs
from English, or a value is empty. There is no baseline: add a key to English and every language in the
same change.
The Voice, Face, Fine-tuning, Quantization and Memory pages read their words from the same kind of bundle
(addons/<id>/ui/src/i18n/<id>.<language>.json, flat keys). A list of notes is stored as numbered keys
(voice.why.0, voice.stored.0.where) and the page puts it back together, so each item is translated like any
other text. A string that has no translation yet repeats the English text in that language’s bundle, which
satisfies the gate and shows English; replace it when a translation exists.
Compile an add-on with classic JSX transformed to React.createElement over
sdk.React, inside the createAddon factory. Do not import a JSX runtime. The fixture
packages under tests/addons/fixture/ui are written in that form.
The resource calls of the SDK
sdk.resources is the page of an add-on talking to the
UI-only resource management of the host. It is a
fixed list of typed calls: the add-on never supplies an address or a header, so it
cannot reach another route or another add-on. The host shapes each call, adds the
own-session confirmation header that the route needs and sends the add-on’s
installed generation, so a stale tab is refused by the server.
A call that changes something takes an operation ID. The SDK makes a new one for each
call; pass {operationId} in the options to repeat the same operation after an
unknown_outcome answer. A malformed identifier, role or revision is refused in the
SDK before any request. After the signal aborts every call throws and nothing is sent.
Errors are AddonsError with a kind (stale, denied, invalid,
unknown_outcome, sharing_disabled, not_selected, unavailable, network), the
HTTP status, the server’s type and, for an unknown outcome, the original
operationId.
A chat request that has add-on tools enabled carries the conversation in the
X-LocalAI-Conversation-Id header (when it has the shape the server accepts), which is
how a tool call that names no resource finds the person’s selection.
Core routes from add-ons
An add-on page can call the core API of LocalAI, for example /v1/face/verify, with
sdk.core.fetch(path, init). The call runs with the signed-in user’s own session,
through the same authentication and authorization as any request the browser makes.
The add-on gets no extra credential and no elevated role: a route that needs the
administrator role stays closed to a user without it, and a route behind a feature
(for example face_recognition) stays closed to a user whose feature is off. Those
calls answer 403, and 401 when the session is missing. The add-on cannot widen
what the user may do.
sdk.core.fetch is fetch with a fixed policy. It sends the cookies of the page
(credentials: 'same-origin'), refuses other origins (mode: 'same-origin'),
refuses redirects, and does not use the cache. It removes any Authorization,
Cookie and X-LocalAI-Confirm header that the add-on sets, and it stops when the
add-on is withdrawn. X-LocalAI-Confirm marks a person’s own action in their own tab,
and add-on code is not the person.
The path must be a same-origin path that starts with one /. These are refused with
an invalid_path error before any request is made:
an absolute URL, a path that starts with //, a backslash, or a control character;
a . or .. segment, also when it is written with percent-encoding;
the add-on gateway (/api/addons) and the auth routes (/api/auth). The add-on
gateway has its own typed calls, and the auth routes hold account credentials. The
check uses the decoded path, so /api/%61ddons/apps is refused too;
the sharing routes: /api/shares, the folder sharing routes under
/api/chats/files/shares, and every API path whose last segment is share,
such as /api/chats/agents/{id}/share, /api/collections/{name}/share and
/api/chats/connectors/{id}/share. Only the person shares, in the host’s Share
dialog: an add-on page renders sdk.ui.ShareDialog with
sdk.resources.shareClient for its own resources, or sdk.ui.ConnectionShareDialog
for a connector binding (see Share with your team);
an encoded / or \ in the first two segments, because it can hide a segment
boundary. In a later segment it is a normal identifier (/api/voice-profiles/a%2Fb).
How the host loads it
The SDK range must contain the host SDK version (1). Otherwise nothing is imported and
the page says the add-on needs another interface version.
Every URL must be a same-origin asset of that add-on’s own package, all under one
digest. Under a path prefix the host puts its base path in front, as for every API
call.
Style sheets are read as text and scoped: every selector becomes
:where([data-addon="{id}"]) …, :root, html and body map to the add-on’s root,
@import, @font-face and every other at-rule except @media, @supports,
@container, @layer and @keyframes are dropped, and keyframe names are
renamed. The sheet reaches only the add-on’s own root.
The same rule is applied to every declaration, including those inside
keyframes, nested rules and @media, @supports, @container and @layer
blocks, and to at-rule conditions: a declaration is dropped when its text,
after comments and CSS escapes are resolved, contains url(, src(,
image-set( (also with a vendor prefix), cross-fade(, element(,
paint(, image(, expression(, behavior or -moz-binding, or when it
has a backslash escape outside a quoted string. data: images are dropped
as well; an add-on that needs an image uses an asset of its own package
from its code.
The module is imported by URL with a timeout and an abort, createAddon is called
with the SDK, and the result is checked.
The page component is drawn inside an error boundary in the add-on’s root. A throw
draws an error card and nothing else.
Revalidation, updates and unsaved edits
The shell reads the apps list while an add-on page, the Add-ons navigation or a chat
action needs it (every 5 seconds, 30 in a hidden tab). An add-on that is no longer
listed, was disabled, failed, was replaced by another generation or package, or has no
UI any more is withdrawn at once: its SDK signal aborts, its component unmounts, its
slots (navigation entries and chat actions) disappear, dispose() runs, its style
sheets are removed, and the page says why with a Reload action. The owner already
denies its code and calls, so an old copy that stays in memory cannot do anything.
A reader no longer sees a stopped add-on at all, so for a reader a disabled add-on reads
as “not installed, or you can no longer use it”.
If the add-on reported unsaved edits with markDirty, it is not unmounted: the page
stays on screen, frozen and with its signal aborted, with a banner saying the edits
cannot be saved. Reload then asks before it discards them. Leaving the page asks
as well, and so does closing the tab.
Navigation entries
A page named in ui.navigation is linked in the detail view of the add-on and under its
pinned entry while the add-on is enabled, not failed and compatible with the host SDK. The same registry keeps
the validated chat actions per add-on and generation and removes them with the add-on.
Declared chat actions are drawn by the host in the chat page (see
Extension points and slots); a bare identifier has no
placement and is not drawn.
Verification
sh scripts/addons/verify.sh esm-ui runs the node unit tests of the SDK, loader, style
scoping and registry, the Go specs of the asset route through real stored keys and
sessions, and a browser spec against the UI test server running with authentication and
a real owner. That spec installs the fixture packages after the build, from a catalog on
loopback, with the protocol fixture as their process.
Extension points and slots
An add-on extends the existing LocalAI pages through declarations in its manifest. The
host validates every declaration at install and draws the contributions itself. Nothing
is registered while the add-on runs: the module supplies only the components and the
handlers its manifest names, and the host ignores the others (and logs them in a
development build).
Declarations
All four lists are inside ui and are optional. A manifest without them is valid.
Field
Entry
Rules
ui.chatActions
A bare identifier, or {id, label, icon, placement, target}
id is a namespace name. label is plain text (60 characters at most) or a language map; markup characters are rejected. icon is a host icon name from the SDK list or the packaged ui.icon path; a remote or absolute address is rejected. placement is composer or message. target has exactly one of {tool} (a tool in capabilities.tools) and {component} (an export of the module).
ui.slots
{id, slot, component}
slot is one of the host slot identifiers below. id is a namespace name that no chat action uses.
ui.renderers
{kind, tool, component}
kind is approval-card or tool-result. tool is a tool of the same add-on. One renderer for each kind and tool.
ui.controls
A host control ID
One of the IDs in Host controls. At most 8, no repeats. The add-on supplies no component for it.
A component name is a PascalCase identifier of at most 64 characters. Each list has at
most 16 entries. Identifiers are unique across chat actions and slots. Any unknown field
in an entry is rejected.
Host slots
The slot list is closed. A new slot is a host change with its own review: it is never
added by a manifest. A slot passes frozen props and nothing else. No slot passes message
text, history, the model or any host state.
Slot
Where the host draws it
Props
chat.composer.actions
In an overflow menu next to the attach buttons of the composer. Actions of placement composer are menu items. Components are drawn in the menu.
conversationId, disabled
chat.message.actions
In the action row of each message. Actions of placement message are icon buttons.
conversationId, messageId, role
app.nav
On the Add-ons page, below the tile grid. Under the legacy switch: at the end of the second navigation row of the Add-ons hub, after the links of ui.navigation.
none
settings.sections
On the add-on’s own page: the Settings tab of its details on the Add-ons page (/app/addons?detail=<id>&view=settings), one section for each component. Only the add-on’s own sections are drawn there, and only for an administrator.
none
files.preview
On the Files page, in the preview of the selected file, between its size and its download link. The first component that handles the file’s extension is drawn; the host’s own view stays.
path, name, extension
A settings.sections component is drawn on the Settings tab of its add-on’s details, not
on the Settings page. The Settings page has an Add-ons group, shown when at least one
add-on declares a section, that lists those add-ons, each with a link to its Settings tab.
An add-on that has a page of its own gets a Settings link from the host above that
page. The tab and the link are for administrators; a section is never drawn for anyone
else, so a section does not need to hide itself from other users. The old address of a
section, /app/settings#ad-section-<add-on>-<contribution>, opens the add-on’s Settings
tab. Below the add-on’s own sections the tab draws the host controls the
add-on has, such as the network of the commands it runs: LocalAI’s own runtime settings,
drawn and saved by LocalAI. Draw the section with the settings kit.
messageId is the position of the message in the conversation. role is user,
assistant, system or tool.
A files.preview contribution declares the extensions it handles, lower case and without a
dot ("extensions": ["docx", "xlsx"], one to 16, no repeats). No other slot has the field.
path is the path of the file inside the user’s files, name its name and extension its
extension. The component reads the file through a read tool of its own add-on, as the user;
the host never hands it file content.
Host controls
A host control is a component that LocalAI ships and draws itself, bound to its own
settings. An add-on asks for one by ID in ui.controls; it supplies no code, value or
label for it, so it cannot change what the control does. The list of controls is closed,
like the slot list. Any add-on can use any control it is entitled to: the host never reads
the add-on’s ID to decide.
Control
Where the host draws it
The add-on must
network-policy
On the add-on’s Settings tab: the network of the commands it runs (limit, preset of a new chat, ports, extra registries, always allowed hosts, private networks, and the audit; see Network access). In the chat’s Tools menu: the Network row, while the add-on runs the chat’s commands, with a link to the add-on’s Settings tab for an administrator. On a network card: the same link.
Be granted a host operation that covers egress.check (for example devbox=egress. in LOCALAI_ADDON_HOST_OPS) and declare capabilities.network. A manifest written before that field existed and declares a tool that replaces bash keeps the control.
tool-providers
On the add-on’s Settings tab: the rows of Settings > Tools for the built-in tools it replaces (who serves the tool, the choice when several add-ons replace it, and the switch of the built-in tool).
Declare at least one tool that replaces a built-in tool (shadows).
sandbox-profiles
On the add-on’s Settings tab: the policy of its sandbox profiles (the default profile, who may use each one, the memory and disk quota and the pins to the previous image). In the chat’s Tools menu: the Profile row.
Declare execution.profiles on the tool that replaces bash. It needs no host operation. Declare also execution.customProfiles (feature level 22) if the add-on can run profiles that an administrator adds.
The network controls read the durable policy from the add-on owner, not the
frontend’s runtime settings. The form displays the owner’s revision. Apply sends
only changed policy fields with that revision, then reads the owner again after a
successful write. Enabling private access still requires the typed confirmation;
the confirmation phrase stays in the browser, outside the policy patch. Audit
retention remains a runtime setting, not an editable owner-policy field here.
If another administrator changes the policy, the owner rejects the stale revision.
Choose Reload and rebase edits, review your retained edits against the current
owner policy, then apply them. If the owner is unavailable, the form keeps your
draft and blocks saving; it does not substitute local runtime settings. If a write’s
outcome is uncertain, Retry same operation reuses its original identity and
payload. Reloading alone does not clear an uncertain write.
Always allowed hosts accept exact names, *.example.com for descendants, or *
for public destinations. Add example.com separately to include the apex. Patterns
can specify a port, such as *.example.com:8443. They still obey the network
ceiling, allowed ports, and private-address guard. Extra registries require exact
names. The owner validates every change; see Network access.
These controls do not change native add-on settings declared in settings.sections.
The apps list carries the controls in ui.controls, with only those the add-on is
entitled to now. A control whose grant was removed is dropped from the list, without an
error. ui.requestedControls lists the manifest declarations separately, so the UI can
explain a restriction without offering an editor. Declaring a control grants nothing: the host operation, the limit and the audit
work the same with or without it. A manifest without ui.controls is valid, and an add-on
with a control has a Settings tab even when it declares no settings.sections.
A second add-on that runs commands through the same proxy gets the same block, row and
link with one manifest line, a network declaration and one grant,
and no change to LocalAI:
The grant is one more entry of LOCALAI_ADDON_HOST_OPS, next to the ones it has:
devbox=egress.. The setting replaces the default list, so keep its other entries.
What the host guarantees
A contribution is drawn only while the apps list the server returned says the add-on is
enabled, not failed and compatible with the host SDK, and only for the generation and
package the loaded module belongs to. A disable, a crash, an update or a revocation
removes every contribution at the next list. A re-enabled add-on is loaded again on the
next page load.
The page reads the apps list once for the slots. It keeps reading it only while a
usable add-on contributes.
Each contribution is in its own error boundary. A component that throws leaves a small
“Unavailable” marker, and the page keeps working.
A contribution is drawn in a container of its own. It cannot replace or hide a host
node. The style sheet of the add-on is scoped to its root.
A tool action is one typed read call of the same add-on, for the tool the manifest
named, with {tool, context} as arguments. The context has conversationId and, for a
message action, messageId and role. The server authorizes the call as for every other
call: hiding a button is never the control. The result is drawn by the declared
tool-result component or, without one, as bounded text. A result that names a stored
proposal ({"proposalId": "..."}) opens the approval frame.
A component action opens the exported component in a host dialog, with the same
context and a close function.
The server, not the page, limits a tool action to the tools the add-on declared: a
request for an undeclared tool is a 403 (see Declared tools).
Add-on UI code is trusted code
The UI module of an add-on is native code that runs in the origin of the host page. It is
not sandboxed. The host cannot technically prevent it from reading the page, calling the
same routes as the person or driving host buttons, including the buttons of the approval
frame. The controls are the trust decision when the person installs the add-on, the
server-side authorization of every request (roles, grants, declared tools and the
revocation of credentials) and the approval frame that the host owns: a confirmation
needs the proposer’s own browser session and the digest of the stored proposal. Install
only add-ons that you trust.
Approval cards
A proposal of an add-on is shown in a frame the host owns. The frame loads the stored
proposal, shows who asks, how many changes it has, when it expires and its state, and draws
the approval-card component declared for the tool inside it. The component receives
plain data (proposalId, tool, effects, arguments). It gets no callback and no
digest. Confirm and Cancel are the frame’s buttons. A confirmation sends the
X-LocalAI-Confirm header and the digest that was displayed, and the server accepts it only
from the proposer’s own browser session, as in Proposals and confirmation.
An add-on asks for the frame with sdk.approvals.present(proposalId). The proposal must
belong to the same add-on.
Private files in a page and in chat
A read tool may answer with file results. LocalAI replaces each output of the
add-on by a private artifact identifier of its own before anything reaches a
browser or a model. sdk.files.read(request, options) is sdk.api.read for
such a tool: it resolves to { files, payload }, where each file is { id, name, mediaType, size } as the host recorded it. The add-on’s handle, a path
and a URL are never part of it. The add-on draws the file with
sdk.ui.ArtifactCard, which takes only artifactId: the card loads name, size,
state and expiry from GET /api/addons/artifacts/{id} and offers the
authenticated download of the host route. A chat tool result of kind
artifact is drawn with the same card. The identifier is the only thing the
chat stores. An add-on cannot supply a link, a name or a path that the card
shows.
Verification
sh scripts/addons/verify.sh host-slots runs the node unit tests of the slot registry,
the component validation of the loader and the approval rules; the Go specs of the
manifest declarations and the apps list; and a browser spec against the UI test server
with authentication and a real owner. The spec installs the slots fixture package after
the build. It contributes to every slot, with a contribution that throws and a style sheet
that collides with host class names.
The first-party add-ons (Tables, Voice, Face, Fine-tuning, Quantization, Studio and Talk) are each distributed as an OCI image of one platform for each
supported operating system and architecture, joined by an image index. The host
installs it as any other OCI package: it extracts layers into a private directory and
starts the executable as a managed process. No container runtime runs the add-on.
Docker or ORAS only construct and move the distribution.
Package format
sh scripts/addons/package.sh --layout <dir> --version <semver> --platform <os/arch>
writes a local OCI layout with one image and a receipt.json of its digests. The tool
never pushes, tags, signs or logs in.
Add --config addons/<id>/package/platforms.yaml to package another add-on. The script
reads the add-on name, the executable and the UI directory from that file and, without
--executable, builds ./addons/<id>/cmd/<executable> for the host platform. Every
add-on is pure Go and is built with CGO_ENABLED=0, so its executable is static and
needs no C toolchain and no C library on any platform. This includes Tables, which
stores its data with a pure-Go SQLite driver, so it also starts on musl hosts. The
default configuration is the one of Tables.
io.localai.addon.id, io.localai.addon.version, io.localai.addon.platform, org.opencontainers.image.version, and org.opencontainers.image.revision when the commit is known.
Config
OCI image config with the os and architecture of the platform. No history, no timestamp.
Layer executable
The entrypoint (mode 0755) and the runtime files the platform needs (mode 0644), as application/vnd.oci.image.layer.v1.tar+gzip.
Layer ui
Only when the manifest declares a UI: every file under the directory of ui.entry. The declared entry, style sheets and icon are required. The layer is absent otherwise.
Layer manifest
manifest.json with version, os and arch set to the release version and platform.
Image index
One entry for each enabled platform, artifactTypeapplication/vnd.localai.addon.package.index.v1, with the version and commit as annotations.
Every part is deterministic: the same inputs give the same digest. A package is rejected,
before it can be published, when:
the entrypoint, a declared UI asset or a required runtime library is missing;
the manifest, the image config, the annotations or the receipt name another platform
or version, or the artifact type differs;
a layer has an unexpected media type, role, order or file, or a blob does not hash to
its digest;
a file has set-id, sticky or group/world-write bits, a non-entrypoint file is
executable, the entrypoint is not, or a path is absolute, escapes the root, repeats or
is not a regular file;
the UI bundles its own React runtime (the host provides React through the UI SDK);
the icon is not an image of its declared type.
addonpkg extract restores a verified layout to a directory with the validated
executable mode. The installer applies the same path rules and ignores the modes in the
archive other than the executable bit.
Release platform matrix
Each first-party add-on has its own addons/<id>/package/platforms.yaml. It lists the
platforms of that add-on. A platform is shipped only
while enabled: true, and it needs a native runner and the executable-start native
check. Until a platform’s native check passes on a runner of that platform, it stays
listed with enabled: false. The workflow fails closed on an empty matrix and on a
missing repository input (ADDON_OCI_REPOSITORY). There is no default registry.
The add-on repository is quay.io/go-skynet/local-ai-addons; every other
backend image repository is refused.
Every platform matrix lists five platforms: linux/amd64 on ubuntu-24.04, linux/arm64
on ubuntu-24.04-arm, darwin/arm64 on macos-15, darwin/amd64 on macos-15-intel and
windows/amd64 on windows-2025. Every add-on except Sandbox enables all five. Sandbox
enables only the Linux platforms. A test fails when a platform is enabled without a
recorded check.
A Windows package names its executable <executable>.exe: Windows has no execute bit,
and only the .exe extension makes a file a program there. The build sets the name in
the manifest of the Windows package, so platforms.yaml and the manifest template keep
the plain name. The package job runs its steps with the bash of Git for Windows on the
Windows runner.
A package that ships skills names their folder with skills: (for example
skills: addons/office/skills). The build lays it at the package root as skills/,
in a layer of its own, on every platform, and checks it with the rules the owner
applies at install: the folders must be the skills the manifest declares, and every
file must pass the checks of Skills. A package that the owner would refuse
is never built.
Each package also has a catalog template in gallery/addons/<id>.yaml.tmpl, so it can be
listed in Find add-ons once a maintainer renders and publishes its entries. See
gallery/addons/README.md for the commands.
All add-ons publish to one OCI repository, the value of ADDON_OCI_REPOSITORY. Each
add-on is a set of tags of that repository, and every tag starts with the add-on id:
<id>-sha-<short sha> for a commit, <id>-<version> for a release, and
<id>-development or <id>-latest for a channel alias. For example, the Fine-tuning
build of one commit is
oci://quay.io/go-skynet/local-ai-addons:fine-tuning-sha-99d1dca2c869.
A release entry of the official library is pinned by digest. A development entry is
mutable, as a development backend is: it names the moving tag
(oci://quay.io/go-skynet/local-ai-addons:fine-tuning-development), sets mutable: true
and has no digest. At install LocalAI resolves the tag to a digest, verifies the signature
against that digest, installs by it and records it in the receipt. A mutable entry must be
an OCI artifact. The update check compares a mutable entry by the digest its tag names (see
How the candidate is chosen).
Set ADDON_OCI_REPOSITORY to quay.io/go-skynet/local-ai-addons. The value has no tag
and no digest. A value that is a backend image repository makes the add-on tools refuse
it. addonpkg target --repository <repository> --addon <id> --tag <tag> prints the
reference one add-on publishes to, without a network request.
The index entries pin each platform image by digest, so the tag only names the
artifact. The host accepts a tag reference (oci://<repository>:<tag>) and reads the
repository with any number of path elements, so an index that still names the old
repository-per-add-on form (oci://<repository>/<id>:<tag>) keeps working.
Publishing events (a push to master, a version tag and a published release) fail closed
for an add-on until at least one of its platforms is enabled in its platforms.yaml.
Pull requests and other pushes publish nothing, so an add-on without an enabled platform
only gets no package legs there. A missing or malformed platforms.yaml fails the plan on
every event.
Channels and tags
scripts/addons/channel.sh --event <name> --ref <full ref> --sha <commit> is the one
place that decides what an event may publish. Its output is what the workflow uses.
Event
Immutable tag
Moving tag
Pull request
none
none: nothing is pushed, no secret or OIDC token is available
Push to master
sha-<12 hex of the commit>
development
Push to another branch
none
none: a branch push never publishes, whatever its name
Push of a v<semver> tag
<semver>
none: a tag alone never advances latest
Current latest stable, non-draft release
<semver>, the index of the tag push; nothing is built
latest, after complete publication
Other published release (older stable or pre-release)
<semver>, the index of the tag push; nothing is built
none
The names in this table are the part after the add-on id. The registry tag is <id>-<name>,
for example tables-sha-4edf30cda051 or voice-development.
Names are in disjoint namespaces: latest and development are reserved, <semver>
and sha-<12 hex> are immutable, and every branch channel starts with branch-. The
branch channel is branch- + a label + - + the first 12 hex characters of the SHA-256
of the full original ref (refs/heads/...). The label is the branch name in lower case,
every run of characters outside a-z0-9 replaced by one dash, cut to 40 characters
(x when nothing is left). The hash makes Feature/X, feature-x and feature/x
three channels. Only the exact ref refs/heads/master is development. Nothing built
from another branch is published, and no new branch channel is created. Channels that
an earlier run published stay where they are.
Immutable tags are never overwritten. A second publication of a version with other
content is refused. The one exception is a rebuild of the same version and commit after
an earlier run published it: the published content is kept (--adopt-existing), and the
workflow verifies its signature before it promotes anything.
Publication and signing
The workflow .github/workflows/addons-package.yml has these jobs.
Job
What it does
Credentials
validate
One leg for each add-on. Builds the UI of the add-on, and runs the packaging checks (which cover every add-on) on every event except the release event, which builds nothing. A red validate stops package, publish and promote.
none
plan
Runs channel.sh and, for each add-on, checks its platform matrix. It joins the matrices into one list of legs and names the add-ons that have legs. It checks the registry input.
none
package
Needs plan and validate. One native runner for each enabled platform of each add-on: builds the executable and UI, runs package.sh and the native runtime check, uploads the layout.
none
publish
One leg for each add-on. Needs plan, validate and every package leg. Joins the legs of the add-on, pushes platform digests and the index by digest to the repository of the add-on, tags the immutable version, signs by digest (keyless, OCI 1.1 referrers, new bundle format) and verifies with the exact identity of this workflow.
registry login and id-token: write
promote
One leg for each add-on. Needs publish, and through it validate. Moves the aliases of a push, serialized by add-on and channel.
registry login
Release finalization needs two things: a public release and the pinned catalog from
its matching tag push. If the tag build finishes first, the release event uses its
artifact. If the release is already public when the tag run renders the catalog,
that run can finish the release. Neither path polls for the other or rebuilds on
the release event. A draft gets no catalog. Before attachment, the registry must
serve the pinned package digests and Sandbox guest images.
Each public release gets its own addons-index.yaml. Retrying with identical bytes
is safe; a different existing catalog is an error, never an invitation to overwrite
it. Only the current latest stable release can advance <id>-latest.
addonpkg verify-published verifies the immutable add-on index, its revision and
platform images against the signing identity of the tag before promotion.
An add-on with no enabled platform gets no legs. On a pull request or a branch push this
fails nothing. On an event that publishes, the plan fails for that add-on and nothing is
published, so a release never leaves one add-on behind without notice.
A pull request, including one from a fork, never reaches publish or promote, and
pull_request_target is not used. A missing or failed leg, or a failed validate,
leaves every alias unchanged: nothing is published from a partial set of legs, latest
moves only after complete validation, and aliases move only after signing. The workflow
policy (addonpkg policy) requires this chain in the job graph. It rejects a publish
that does not need validate, and a validate job with continue-on-error or an
always(), failure() or cancelled() condition.
Promotion is serialized by a concurrency group for each channel and is checked against
the registry: development and branch channels do not move to a commit that is an
ancestor of the one they name, and latest does not move to a lower version or to a
pre-release. A slow older run therefore ends as a no-op.
A force-pushed branch is the new truth of that branch. When the commit a branch
channel names is no longer in the checkout (git answers “not a valid commit name”), the
promotion succeeds only if the run is a push to the exact ref that owns the channel
(--ref and --event of addonpkg promote; the channel name is derived from the ref).
For any other event or ref the alias stays where it is and the command fails with
E_UNREACHABLE. development follows the strict rule: an unreachable commit is always
refused with E_UNREACHABLE, and it needs a manual decision. Any other git failure
fails the promotion. A slow run of a pre-rewrite commit that finds the rewritten tip in
its checkout cannot be told apart from a new diverged commit, so a promotion of the
old commit after a force-push can briefly move the channel back until the next push.
The registry has no atomic
compare-and-swap for tags, so the group, not the check, is what closes the window
between two runs.
The signer identity is the workflow file of this package pipeline, not the backend
image workflows: https://github.com/<owner>/<repo>/.github/workflows/addons-package.yml@<ref>
with the issuer https://token.actions.githubusercontent.com. The identity contains the
ref of the run, which differs for each release tag.
Catalog entries
gallery/addons/tables.yaml.tmpl and addonpkg catalog render one entry for each
platform from a verified merged layout. An entry pins the digest of the platform image,
names the repository and the immutable tag, carries the channel it is current for and
holds the expected signature policy. The catalog resolves a selection by version or by
channel, so a channel is metadata that names the entry and its digest, never a tag that
is read at install time. See gallery/addons/README.md.
An entry may also carry a requires object, the compatibility hint of the update check
(see Update detection and upgrade).
The host applies the signature policy of the library (source), not the one of an entry:
a refresh replaces an entry’s policy with the policy the administrator configured on the
source. Executable verification (the signature of the package digest against the
workflow identity) and the trust of the catalog document itself (how the library is
fetched) are two separate things, and the host tests them separately.
Workspace operations
An add-on that holds sandbox=workspace., office=workspace. or web=workspace. in the host operation setting can ask for the files of the user it is working for:
workspace.materialize builds a read-only tree of some folders of the user in a directory of the add-on’s own data directory.
workspace.commit takes the upper.tar layer the add-on left in such a directory and commits it as one change set. It needs an act request.
workspace.changes lists the change sets after a revision.
workspace.admin answers only when the user of the request is an administrator, and is refused for anyone else. An add-on uses it to guard a setting; it never decides who is an administrator itself.
workspace.export copies one file of the user into the data directory, and workspace.import (an act request) writes one file of the data directory into the files of the user, with the version check of the files API.
workspace.import with "chatFolder": true takes a file name as path and writes the file into the folder of the chat of the call (Chats/<folder>/, which the host makes when it is missing). A call that no chat made, or a chat that keeps no file (incognito), is refused. The apply of a write tool that declares chatFiles (feature level 16) may call workspace.import too, although it is an apply request and not an act request. That call must set chatFolder and must not set overwrite or baseVersion: it saves a new file in the folder of the chat that proposed the change and nowhere else. When the name is taken, the host keeps the file that is there and gives the new file another name (conflictOf names the one asked for). Any other apply request, a preview and a call that no chat made still cannot import.
Every call runs as the user of the live request, never as a user named in the arguments. dir is a relative folder inside the add-on’s data directory; an absolute path, a parent reference or a symbolic link is refused.
What a call can reach depends on who made the request:
A call from a chat. The host binds every add-on call that a chat makes to that chat, for every tool kind: a read tool that names no resource (such as the Office add-on’s read-docx) as well as an action or a change. The calls act with the chat’s own access, the same access as the chat’s file tools:
In a chat whose agent has no folder, / is the user’s home, as before.
In a chat whose agent has a folder (see Folders of an agent), / is the agent’s folder. A path names a file inside it: /Other/x is Other/x inside the folder, not a folder of the home. The add-on can also name the chat’s own folder as /workspace/chat/x, and the shared folders as /workspace/shared-<name>/x (read only). A path with a parent reference, NUL or a control character is refused. An encoded or look-alike separator (..%2f, %2e%2e, a backslash, U+2024, U+FF0F) is part of a name. A path outside these folders is not found. The agent’s mode applies: a read-only folder takes no file.
When an add-on mounts its / at home, the host also mounts the chat’s folder at chat in a chat whose agent has a folder, so the Sandbox sees /workspace/home and /workspace/chat as the chat’s file tools do. No add-on needs a change for this.
workspace.changes lists only the change sets inside the chat’s folders, and a workspace.commit entry outside every mount comes back as an outside-view conflict.
A change that waits for a person keeps the chat it was proposed in. Its apply acts with that chat’s access, also when the person confirms it later in the browser or in a messaging chat. A proposal stored by an older release has no chat and applies as a call that no chat made.
A call whose chat the host cannot resolve (the chat is gone, its agent’s folder is missing, or the binding names another user than the actor) is refused with bad_request. It never falls back to the home. An action always works for one chat, so an action request that carries no binding and whose resource names no chat of the user is refused too.
A call that no chat made, such as a call from the add-on’s own page or the OpenAI-compatible route, works on the user’s whole home, as the Files page does. The person acts with their own rights there.
The binding stays on the host. It is kept next to the envelope of the live request, and between frontends it rides in the signed forwarded request (see Owner forwarding and HTTP relays). It is never a field of the envelope the add-on receives, which installed add-ons decode with unknown fields refused, so the add-on contract does not change. The access is resolved again from the stores at each call (stateless per request).
Network operations
An add-on that holds sandbox=egress. in the host operation setting (the default) can ask about the network connections of the commands it runs (see Network access):
egress.check (act, feature chats) takes {host, port, kind, tls}, with kindconnect or http, and answers {action, reason, allowPrivate, self}, with actionallow or block. An allow carries self: the addresses of the server as CIDR strings (its interfaces, loopback, and the addresses of the host of the external base URL), the same list web_fetch refuses. The add-on refuses them on every dial, besides the interfaces of its own machine, so a command cannot reach the LocalAI API through the server’s public name or address. When a card asks the person (see the cards under Network access), the call waits for the answer, at most 60 seconds, before it answers. The chat is the resource of the live envelope and the user is its actor: arguments named chat, user, preset or allow, or any other unknown name, are refused. The host writes the audit line of the verdict itself. The operation may wait up to 60 seconds for a card and has a 75-second timeout.
egress.audit (act, feature chats) takes {events: [...]}, at most 500 lines of {host, port, kind, verdict, reason, addr, bytesUp, bytesDown, durationMs, at}. verdict is done (an allowed connection ended; the bytes it moved) or block (the add-on refused it itself: an address that is private, the server’s own or a metadata address, a TLS name that is not the host, a limit, or a connection while no call ran). A call made under a job lease (see Execution provider and status payload) is unattended: egress.check blocks a host that would need a card with the reason unattended instead of asking.
Simple Office
Simple Office is a lightweight option for basic office-file work, without requiring Sandbox. It reads and edits documents in the user’s files, from a chat. It is a package like the others (office in the add-on library) and uses the workspace.* host operations to take a file in and give the result back.
Tool
Kind
What it does
read-docx, read-xlsx, read-pptx, read-pdf
read
Return the text of a file: paragraphs with their index, cells row by row (a formula that has no stored result shows as the formula, such as =SUM(A1:A2)), slides with their shapes, pages. The answer is cut to about 48 KiB and says so.
edit-docx, edit-xlsx, edit-pptx
action
Apply a list of changes (at most 200) to a file. All of them are saved, or none.
create-docx, create-xlsx, create-pptx, create-pdf
action
Make a new file. create-docx and create-pdf take a markdown string; create-xlsx takes a single-sheet csv string. All three take path and optional title strings; XLSX also accepts sheet. The former blocks and sheets arguments are no longer supported. PDF writes Latin-1 text with the built-in font. See Simple Office for the contract and limits.
The action tools run at once, as the user of the chat, with no confirmation, and only in a chat. Every tool, a read tool too, works with the chat’s own access: in a chat whose agent works in one folder, / is that folder (see Workspace operations). Without accounts, the files are the same ones the chat and the Files page use. With accounts and local-owner mode, the workspace.* operations are refused, because the local owner is no account and has no files; use named-user mode for the Office and Sandbox add-ons. A file that someone else changed after the tool read it is never overwritten: the tool’s version is saved as a second file next to it, and the answer says so. A file that is not of the type its name says, or a path outside the user’s files, is refused with a reason the model can read.
The add-on also ships xlsx, docx, pptx, and pdf skills (see Document skill providers).
These procedures use Office tools to read, edit, and create documents within the tools’ supported capabilities.
They require no command runner. Sandbox supplies separate Python/Paper procedures under the same logical names.
Stopping Office does not restore core procedures; another provider serves only when eligible and not blocked by an explicit pin.
A test checks that each tool named by an Office skill belongs to its manifest.
Web
The Web add-on serves the chat tools web_search and web_fetch in place of the built-in
ones. Its tools search and fetch declare "shadows": "web_search" and
"shadows": "web_fetch", so a chat with the add-on on and running sees one web_search and
one web_fetch, served by the add-on. It adds two things the built-in tools do not have:
search providers that need a key (Brave Search, Tavily, Google Programmable Search), tried in
an order the administrator chooses, and the text of PDF files. Both tools run the code of the
built-in tools for the rest: the same SSRF guard, limits and untrusted-content label. See
Web search and web pages for what it does in a
chat and how to set it up.
Replaces web_fetch. Arguments url, maxChars, format. Reads PDF too.
status, set-settings, test-search
read, page only (uiOnly)
The settings of the add-on, on the Settings tab of its details on the Add-ons page: the providers, their order and keys, and a test of each provider. A change and a test need an administrator, which the add-on asks the host with workspace.admin.
The contract allows no underscore in an argument name, so the add-on’s tools name
max_results and max_chars of the built-in tools maxResults and maxChars. The model
reads the add-on’s schema.
The keys are kept in settings.json in the add-on’s data folder (mode 0600). They are never
returned by a tool, written to a log or put in a model’s prompt or a tool result: the
Settings tab shows only whether a key is set. A key reaches its provider in a request header
(X-Subscription-Token, Authorization or X-Goog-Api-Key), never in a URL, and the clients
of the keyed providers follow no redirect, so a key is never sent to another host.
The add-on runs on the add-on owner, like every add-on. Its settings, its search cache and
its rate limits live in that one process, so they are the same for every frontend of a
cluster.