DEV: add Knowledge Assistant (RAG) agent type to agent builder#3376
DEV: add Knowledge Assistant (RAG) agent type to agent builder#3376mich-elle-luna wants to merge 2 commits into
Conversation
Adds a third agent type — Knowledge Assistant — to the interactive agent builder, alongside the existing Recommendation Engine and Conversational Assistant. Includes Python and Node.js templates with Redis-native hybrid retrieval, semantic caching, session memory, and citations. - Python template: single redis-py client (decode_responses=False), redisvl for index creation only, FT.SEARCH hybrid query with vector-only fallback, load_directory() helper, idempotent sample doc ingestion - Node.js template: node-redis v4, same hybrid search pattern, loadDirectory() helper, ft.info() guard to skip re-ingestion on restart - agent-builder.js: adds rag type to CONFIG, enables JavaScript alongside Python, fixes root-relative template URL, adds third suggestion chip - agent-builder.html: adds Knowledge Assistant chip to initial message - _index.md: updated to mention three agent types and JS support Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a30c659. Configure here.
| doc = self._decode_doc(result.docs[0]) | ||
| # vector_distance for cosine: 0=identical, 1=orthogonal. Hit when similarity > CACHE_THRESHOLD. | ||
| if float(doc.get('distance', '1.0')) < (1.0 - CACHE_THRESHOLD): | ||
| return doc.get('response', ''), json.loads(doc.get('citations', '[]')) |
There was a problem hiding this comment.
Cache results lose response and citations fields
High Severity
_check_cache passes a cache search result to _decode_doc, but _decode_doc only extracts document-specific keys (chunk_id, doc_id, title, source, content, distance), discarding the response and citations attributes present on the cache document. As a result, doc.get('response', '') always returns an empty string, which is falsy, so if cached_response: in query() never triggers. The semantic cache feature is completely non-functional — every query always hits the LLM.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit a30c659. Configure here.
Hardcoded /code/agent-templates/ broke on staging when the site is served from a subdirectory. Hugo's relURL now injects the correct base path as window.AGENT_TEMPLATE_BASE so the XHR resolves relative to wherever the site is deployed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>


Adds a third agent type — Knowledge Assistant — to the interactive agent builder, alongside the existing Recommendation Engine and Conversational Assistant. Includes Python and Node.js templates with Redis-native hybrid retrieval, semantic caching, session memory, and citations.
Note
Low Risk
Changes are limited to docs, static templates, and client-side builder UX; no production auth or data-path changes.
Overview
Adds a Knowledge Assistant (RAG) as a third agent-builder option alongside recommendation and conversational agents, with docs and UI chips updated to reflect three agent types.
The interactive flow now registers
raginagent-builder.js, treats JavaScript as a first-class generated language (not Python-only), and loads templates via Hugo-injectedAGENT_TEMPLATE_BASEinstead of a brittle base URL. New Python and Node.jsrag_agenttemplates implement document chunking/ingestion, RediSearch hybrid retrieval (text filter + KNN with vector fallback), semantic answer caching, session history, and cited answers; sample docs ingest only when the index is empty.Reviewed by Cursor Bugbot for commit 4dd4b0b. Bugbot is set up for automated code reviews on this repo. Configure here.