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.
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>
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>
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>
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.
* 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>
* 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>
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>
* 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>
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>
* 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>