#488
feat(tools): add knowledge_search over the shared knowledge base
Summary
Adds a knowledge_search tool that lets the assistant query the shared/manual
knowledge base (documents flagged Manual=true) via natural language. This
complements the per-agent RAG retriever (which now excludes Manual docs), so
operators can publish curated knowledge that is only reachable through an
explicit tool call instead of being silently mixed into every agent turn.
Changes
pkg/tools/knowledge_search.go: new tool callingKnowledgeStore.SearchDocuments, scoped toManual=true.pkg/tools/search.go: excludeManual=truedocs from the generic retriever.pkg/tools/registry.go+tools.go: register the tool (only wheneveryService=true).pkg/templates/...+providers/assistant.go: forced-retrieval rule + tool-name rendering.pkg/providers/performer.go:callWithRetriesacceptsextraOpts ...llms.CallOption; keepsCallWithToolson the default path and switches toCallWithExtraOptionsonly when extra options (e.g. a forced namedtool_choice) are present.pkg/database/knowledge/knowledge.go: defineKnowledgePublisherlocally to break thetools → knowledge → subscriptions → toolsimport cycle.- Env gate
PENTAGI_ASSISTANT_FORCE_KBSEARCH(default off) forces the first assistant call to a namedtool_choicefor deterministic retrieval; verified disabled in production. docker-compose.yml+Dockerfile.ollama+.gitignore: optional local Ollama service for RAG embeddings.push_to_fork.sh: one-shot helper to push to the fork over SSH port 443.
Why
Shared knowledge (deployment briefs, access keys, runbooks) should be explicitly retrievable and auditable, not injected into every agent context.
Testing
- End-to-end: a running flow autonomously invoked
knowledge_searchand returned the correct curated document (relevance 0.8655). pkg/tools/...andpkg/providers/...tests pass (two pre-existing upstream README/Graphiti baseline failures are unrelated).- Container rebuilt with
CGO_ENABLED=0; API login returns 200.
Notes
The forced-tool_choice path is env-gated and disabled by default; production behavior is unchanged unless explicitly enabled.
Hi maintainers, thanks for taking a look at this PR!
Since it's opened from a fork, the CI workflows are currently awaiting approval (2 workflows). Could you please approve the workflows so they can run, and review the changes when you get a chance?
Quick recap: this adds a knowledge_search tool over the shared/manual knowledge base, plus an env-gated forced tool_choice path that is disabled by default (production behavior unchanged). All 6 commits are signed and show as Verified.
Happy to address any feedback — thanks!