867 Commits

Author SHA1 Message Date
Ettore Di Giacinto 37810d918a fix(collections): rehydrate in-process collections lazily after init failure (#468)
When NewInProcessBackend boots, it iterates every on-disk collection and
calls newVectorEngine to construct its engine wrapper. For the postgres
engine that constructor performs a "test embedding" probe that requires
the embedding model to be reachable. If the embedding service is briefly
unavailable at boot — e.g. the node hosting the embedding model has
temporary NATS connectivity issues — the construction fails and the
collection is silently dropped from the in-memory map. Subsequent
operations against that collection (Upload / Search / ListEntries / …)
all return "collection not found" indefinitely, even after the embedding
service comes back, because nothing ever retries.

Worse, the collection still exists on disk (its JSON sidecar) and its
data still exists in the vector DB (e.g. the per-collection
documents_col_<uuid> table in PostgreSQL). From the user's perspective
their collection has silently disappeared.

Two changes:

1. NewInProcessBackend always registers every on-disk collection in
   state.Collections — even when newVectorEngine returns nil. A nil
   entry is a placeholder meaning "known on disk, not yet loaded".

2. backendInProcess.lookup centralises the cache read for every
   operation. If the cache holds a placeholder, it retries
   newVectorEngine now, under the write lock. So as soon as the
   embedding service is reachable again, the next request to the
   collection will rehydrate it transparently. If init still fails or
   the collection isn't on disk at all, lookup returns (nil, false)
   and the operation surfaces "collection not found" as before.

The state.EnsureCollection callback used by the internal RAG provider
already handled the placeholder case (it re-inits whenever the cache
entry is missing or nil), so it needs no change.

This does not address the underlying probe-and-cache pattern in
LocalRecall's NewPersistentPostgresCollection — read-only operations
on existing collections still require an embedding probe at engine
construction. That is a separate, deeper fix worth pursuing in
LocalRecall directly.
v2.9.0
2026-05-08 14:52:35 +02:00
Ettore Di Giacinto c1a1231793 chore(deps): bump localrecall — go-fitz cgo → go-pdfium WASM
Pulls LocalRecall@a7724fe which switches PDF extraction from
gen2brain/go-fitz to klippa-app/go-pdfium with the WebAssembly backend.
Fixes aarch64 link failures (`__isoc23_strtol` undefined reference) in
binaries that pull LocalRecall through cgo.

Pure dep bump — no LocalAGI source changes. Indirect graph picks up
go-pdfium + tetratelabs/wazero; drops gen2brain/go-fitz +
ebitengine/purego + jupiterrider/ffi.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 07:47:08 +00:00
Ettore Di Giacinto facd8881b1 chore(deps): bump localrecall to v0.6.0 for go-fitz PDF extraction
LocalRecall v0.6.0 swaps the PDF text extractor from dslipak/pdf to
gen2brain/go-fitz (libmupdf bindings) and wraps the call in a 60s
goroutine timeout. Fixes upload hangs that affected adversarial PDFs
(broken xref tables, encrypted, image-only without OCR) where the
previous parser would block indefinitely.

Pure dep bump — no LocalAGI source code changes. Indirect graph picks
up gen2brain/go-fitz, ebitengine/purego, jupiterrider/ffi; drops
dslipak/pdf.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 23:07:19 +00:00
Ettore Di Giacinto e83bf515d0 fix(collections): handle errors from LocalRecall constructors
LocalRecall's NewPersistent{Chrome,LocalAI,Postgres}Collection now
return errors instead of os.Exit'ing on init failure. Bump the dep and
update newVectorEngine to consume the new signatures, surfacing failures
as a nil collection (the existing "engine misconfigured" code path)
instead of letting the upstream os.Exit kill the embedding process.

Without this, a transient embedding-service or PostgreSQL outage during
lazy RAG init would crash any long-running host (e.g. the LocalAI
distributed orchestrator) instead of degrading to "no RAG available".

RAGProviderFromState already handles a nil collection from
EnsureCollection by returning (nil, nil, false) to the agent pool, which
is the same path agents take when no RAG is configured — so callers
upstream need no further change.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-05-04 16:51:00 +00:00
Ettore Di Giacinto 3369136c73 chore(deps): bump localrecall for vector-dim migration fix
Picks up the postgres backend fix where switching the embedding model
on an existing collection now resizes the VECTOR column instead of
failing every subsequent insert with SQLSTATE 22000.
2026-04-15 16:51:42 +00:00
Richard Palethorpe c65d62e762 chore: Update fiber to v2.52.11 (#461)
Signed-off-by: Richard Palethorpe <io@richiejp.com>
2026-03-31 19:38:55 +02:00
Ettore Di Giacinto 736ccbb95e forward reasoning
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-03-25 17:28:45 +00:00
Ettore Di Giacinto 640d97b6db small fixups
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-03-25 15:38:18 +00:00
Ettore Di Giacinto 23344560f0 small fixups
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-03-25 14:25:29 +00:00
Ettore Di Giacinto 3d0af0088e split run from start
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-03-25 13:48:23 +00:00
Ettore Di Giacinto 1b87514b2f allow to ask directly
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-03-25 08:33:17 +00:00
Ettore Di Giacinto b485b77037 Adapt client too
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-03-21 00:47:23 +00:00
Ettore Di Giacinto 07caa0b95d Adapt client too
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-03-21 00:46:41 +00:00
Ettore Di Giacinto 43c65ec7e8 feat: update localrecall to support files with same names in the collections
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-03-19 17:45:13 +00:00
dependabot[bot] cc2d2838ca chore(deps-dev): bump eslint-plugin-react-refresh from 0.5.0 to 0.5.2 in /webui/react-ui (#430)
chore(deps-dev): bump eslint-plugin-react-refresh in /webui/react-ui

Bumps [eslint-plugin-react-refresh](https://github.com/ArnaudBarre/eslint-plugin-react-refresh) from 0.5.0 to 0.5.2.
- [Release notes](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/releases)
- [Changelog](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/compare/v0.5.0...v0.5.2)

---
updated-dependencies:
- dependency-name: eslint-plugin-react-refresh
  dependency-version: 0.5.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-18 08:43:54 +01:00
Ettore Di Giacinto da286065e1 feat: support streaming mode for tool calls
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-03-15 22:34:07 +00:00
Ettore Di Giacinto 9438d39f70 feat: support streaming mode for tool calls
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-03-15 22:33:51 +00:00
Ettore Di Giacinto e38f13ab8c feat: add handler to serve raw files
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-03-14 22:28:28 +00:00
LocalAI [bot] 2d2da7df95 feat: add --prompt flag for foreground agent mode (#454)
* feat: add --prompt flag for foreground agent mode

- Add --prompt/-p flag to 'agent run' command
- When --prompt is provided, runs agent in foreground mode
- Creates agent, executes Ask() with the prompt, prints response, and exits
- Supports both agent name and --config file input modes
- Follows existing code patterns in the repository

* fix: correct JobResult field access for error and response

---------

Co-authored-by: localai-bot <localai-bot@noreply.github.com>
2026-03-11 17:53:47 +01:00
LocalAI [bot] dc21ee83bc feat: implement 'agent run' CLI command (#448) (#449)
* feat: implement 'agent run' CLI command (#448)

- Add 'local-agi agent run' command supporting agent name or config file
- Support 'local-agi agent run <name>' to run agent from registry (pool.json)
- Support 'local-agi agent run --config <file.json>' to run from JSON config
- Extract web server into 'local-agi serve' subcommand
- Implement agent name lookup from registry
- Add JSON config file parsing and validation
- Create standalone agent execution logic
- Add proper error handling for invalid inputs
- Reuse existing service factories (actions, connectors, filters, skills)
- Environment variable fallback for config values
- No web server - agent runs in foreground with clean SIGINT/SIGTERM handling

References: https://github.com/mudler/LocalAGI/issues/448

* refactor(cmd): use pool to start agent instead of duplicating logic

Replace ~220 lines of duplicated agent initialization code in
startStandaloneAgent() with a call to pool.StartAgentStandalone().
The new pool method delegates to the existing startAgentWithConfig(),
eliminating code duplication between the CLI and the pool.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add default help command to root

* fix: default to serve command when no subcommand provided

The e2e tests fail because when the container starts with no arguments,
the root command shows help instead of starting the web server.

Changed the root command to call serveCmd.RunE() directly when no
subcommand is provided, ensuring the web server starts by default.

This fixes the CI e2e test failure where the web server wasn't starting.

* fix: add serve subcommand to Dockerfile ENTRYPOINT

* refactor: remove unused GetRAGProvider function

* refactor: centralize env var setup in cmd/env.go

---------

Co-authored-by: localai-bot <localai-bot@noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 22:09:02 +01:00
dependabot[bot] 9b744d2bac chore(deps-dev): bump eslint from 10.0.0 to 10.0.3 in /webui/react-ui (#451)
Bumps [eslint](https://github.com/eslint/eslint) from 10.0.0 to 10.0.3.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](https://github.com/eslint/eslint/compare/v10.0.0...v10.0.3)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 10.0.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-09 23:05:19 +01:00
LocalAI [bot] 4177479f82 chore(deps): bump cogito from v0.9.2 to v0.9.3 (#452)
Co-authored-by: LocalAI Bot <localai-bot@example.com>
2026-03-09 22:37:10 +01:00
LocalAI [bot] 34db83dc32 fix(slack): correct thread timestamp and improve file upload handling (#447)
Root cause: uploadJobResultFiles was passing msgTs (placeholder reply timestamp)
as thread_ts for file uploads. Slack's API rejects this - it requires the
parent thread timestamp, not a reply's timestamp.

Changes:
1. Use 'ts' (thread root timestamp) instead of 'msgTs' in replyToUpdateMessage
2. Fix type handling in attachmentsFromMetadataOnly to handle []interface{}
3. Download and upload generated images (e.g., DALL-E) as files instead of
   just adding link attachments, to preserve temporary URLs
4. Remove dead code: generateAttachmentsFromJobResponse was never called

This matches Telegram connector behavior where files are properly uploaded
rather than just referenced by URL.

Co-authored-by: localai-bot <localai-bot@noreply.github.com>
2026-03-08 15:59:37 +01:00
Ettore Di Giacinto 5a27c471ca chore: refactoring to make it importable
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-03-06 16:49:48 +01:00
Ettore Di Giacinto 3ecbbf3eac chore: minor enhancement to be fully importable
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-03-06 16:39:30 +01:00
Ettore Di Giacinto d9bf193457 feat(ui): allow to edit agent before importing (#444)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-03-04 18:39:11 +01:00
Ettore Di Giacinto 2acdc6688c fix(conv): merge system messages
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-27 11:08:16 +01:00
LocalAI [bot] fb20d12ae1 feat: add automatic compaction settings to agent config (#437)
* Merge origin/main and resolve conflicts: keep all features including auto-compaction and evaluation

* fix: resolve merge conflict syntax errors in config.go

* feat: wire auto-compaction options to cogito

Wire enableAutoCompaction and autoCompactionThreshold options to
cogito.WithCompactionThreshold() when starting the agent.

---------

Co-authored-by: Team Coding Agent 1 <team-coding-agent-1@local>
2026-02-26 21:32:27 +01:00
Ettore Di Giacinto 7bbec7b6dd fix(templates): add agentname in prompt templates (#438)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-26 15:43:13 +01:00
LocalAI [bot] 905ffcb185 chore: update cogito go dependency to latest main (#436)
Updated github.com/mudler/cogito from
v0.9.2-0.20260223101954-070948df04f7 to
v0.9.2-0.20260225234859-b76691637703

Co-authored-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
2026-02-26 01:12:12 +01:00
LocalAI [bot] cb82322df2 feat: add inner monologue template support for scheduler and template-based skills prompt (#435)
* feat: add scheduler task template and template-based skills prompt

- Add WithSchedulerTaskTemplate option for recurring tasks run by scheduler
- Expose scheduler_task_template in core/state/config.go for user configuration
- Add WithSkillPromptTemplate option for custom skill prompt templates
- Use {{.Skills}} slice in templates to iterate over Skill.Name, Skill.Description
- Default template mimics current XML behavior with <available_skills> format
- Rename customIntro to customTemplate in services/skills for consistency

* cleanups

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Update core/state/config.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-25 18:44:49 +01:00
LocalAI [bot] 56ecd1921e chore: disable reasoning by default (#433)
Set EnableReasoning DefaultValue to false in agent config form metadata.

Signed-off-by: mudler <mudler@localai.io>
2026-02-24 21:50:55 +01:00
Ettore Di Giacinto a0faa14ffe fix(slack/files): trying to debug files upload
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-23 22:39:23 +00:00
Ettore Di Giacinto 7494a1559e chore(observables): add missing observables
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-23 21:09:01 +00:00
Ettore Di Giacinto 3dad5acf1f chore(pdf): refactor and try to always send pdf
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-23 20:53:02 +00:00
Ettore Di Giacinto 99f7e3ab60 fix: finish the job once
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-23 19:10:29 +01:00
Ettore Di Giacinto 5b90d4c3e2 chore: stop tool call when model calls send_message
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-23 19:06:31 +01:00
Ettore Di Giacinto 9406d699cc chore: allow to configure inner monologue template
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-23 18:43:25 +01:00
Ettore Di Giacinto 78defbad32 fix: avoid panics
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-23 15:31:04 +01:00
Ettore Di Giacinto 2efadbf6c4 bump go mod
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-23 11:55:42 +01:00
Ettore Di Giacinto b46c300307 chore: enable more behavioral settings
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-23 11:42:30 +01:00
Ettore Di Giacinto d2407105a4 fix: remove the duplicated unlock call
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-22 23:24:30 +00:00
Ettore Di Giacinto 32a1a59389 feat: add accumulator to print tool status/results during execution (#427)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-22 22:44:19 +01:00
Ettore Di Giacinto 61a89aaf58 feat(pdf): improve pdf markdown rendering (#426)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-22 22:42:36 +01:00
Ettore Di Giacinto c5e3df41ee fix: atomic writes to the pool, create backups
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-22 19:11:46 +01:00
Ettore Di Giacinto cb37f80724 fix(slack): process all metadata
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-22 10:12:13 +01:00
Ettore Di Giacinto bc256fbbe2 chore: avoid panics from Slack connector
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-22 09:49:03 +01:00
Ettore Di Giacinto 8014d22588 fix: unify api keys for collection endpoint
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-21 23:39:19 +00:00
Ettore Di Giacinto 410ba7a467 feat: allow to manage external localrecall instances (#425)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-22 00:02:12 +01:00
Ettore Di Giacinto c56cc43552 feat(memory): add knowledgebase and memory management from LocalRecall (#424)
* feat: integrate knowledge base management

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* refactorings

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

---------

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-02-21 23:17:33 +01:00