Skip to content

DEV: add Knowledge Assistant (RAG) agent type to agent builder#3376

Open
mich-elle-luna wants to merge 2 commits into
mainfrom
agent-builder-rag
Open

DEV: add Knowledge Assistant (RAG) agent type to agent builder#3376
mich-elle-luna wants to merge 2 commits into
mainfrom
agent-builder-rag

Conversation

@mich-elle-luna
Copy link
Copy Markdown
Collaborator

@mich-elle-luna mich-elle-luna commented May 27, 2026

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

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 rag in agent-builder.js, treats JavaScript as a first-class generated language (not Python-only), and loads templates via Hugo-injected AGENT_TEMPLATE_BASE instead of a brittle base URL. New Python and Node.js rag_agent templates 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.

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>
@mich-elle-luna mich-elle-luna requested a review from a team May 27, 2026 21:44
@github-actions
Copy link
Copy Markdown
Contributor

@jit-ci
Copy link
Copy Markdown

jit-ci Bot commented May 27, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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', '[]'))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a30c659. Configure here.

Copy link
Copy Markdown
Collaborator

@dwdougherty dwdougherty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The complete example isn't displayed and it isn't downloadable or available for cut-and-paste. This kind of rings a bell - like we had this problem once before during initial development. 🤷🏻‍♂️

@dwdougherty dwdougherty requested a review from a team May 28, 2026 14:27
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants