Skip to content

Docs/knowledge demo example#156

Open
dolev31 wants to merge 36 commits into
mainfrom
docs/knowledge-demo-example
Open

Docs/knowledge demo example#156
dolev31 wants to merge 36 commits into
mainfrom
docs/knowledge-demo-example

Conversation

@dolev31
Copy link
Copy Markdown
Collaborator

@dolev31 dolev31 commented Apr 19, 2026

Summary

This PR adds a new hands-on example under docs/examples/knowledge_demo/ that demonstrates CUGA's knowledge engine end to end through a realistic HR Benefits Assistant scenario.

It also fixes a blocking bug that prevented knowledge usage in SDK mode.

Why

The repo already documents the knowledge engine at a reference level in KNOWLEDGE_PIPELINE.md and the root README.md under the Knowledge Base section, but it does not include a walkable example that shows the difference between agent-level and session-level knowledge in practice.

That distinction is one of the most compelling parts of the feature, yet developers browsing docs/examples/ did not have a concrete example they could copy when integrating knowledge into their own agents.

What is included

This PR adds a fictional HR Benefits Assistant for Acme Corp.

Agent-level documents

Persistent, shared across conversations:

  • employee_handbook.md
  • health_insurance_plan.md
  • pto_policy.md
  • 401k_plan.md

Session-level documents

Ephemeral, per-conversation documents for a single employee, Sarah Chen:

  • benefits_enrollment.md
  • pto_balance.md
  • march_2026_pay_stub.md

All numbers in the example, including IRS limits, accrual rates, and premiums, are realistic for 2026 so the agent's answers are easy to verify.

Integration paths shown in the example

Both paths are documented in the example README.md.

Path A: SDK (main.py)

Demonstrates the full programmatic surface using:

  • CugaAgent(enable_knowledge=True)
  • agent.knowledge.ingest(...)
  • agent.knowledge.search(...)
  • agent.invoke(...)

Path B: UI (cuga start demo_knowledge)

Demonstrates the UI flow:

  • upload agent-level docs through the manage page
  • publish the agent
  • attach session-level docs in chat
  • run demo prompts that require cross-scope reasoning

Demo prompts included

The example README.md includes prompts that exercise different retrieval scopes:

  • "What's the vacation carryover limit?"
    Agent-level only

  • "How many PTO days do I have left?"
    Session-level only

  • "Based on my pay stub and HSA enrollment, am I on track to max out my HSA?"
    Combines agent-level IRS limit and employer contribution rules with Sarah's YTD payroll deductions

  • "Will I have enough PTO for a 10-day July vacation?"
    Combines policy with Sarah's personal balance and accrual rate

Conventions

The example follows the same conventions as:

  • docs/examples/cuga_as_mcp/
  • docs/examples/cuga_with_runtime_tools/

Specifically:

  • path dependency on the root cuga
  • shared lockfile usage
  • .env.example
  • uv run --project ../../../ main.py

Bug fix included

Problem

KnowledgeClient.get_langchain_tools() generated 7 tool wrapper functions whose signatures did not accept a thread_id keyword argument.

At runtime, cuga_lite_graph.py injects thread_id, which caused SDK-mode calls to agent.invoke() with knowledge enabled to crash with:

TypeError: knowledge_search_knowledge() got an unexpected keyword argument 'thread_id'

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **New Features**
  * Added a runnable HR Benefits Assistant demo showcasing knowledge-engine capabilities with realistic sample employee and session data and example queries.

* **Documentation**
  * Added a comprehensive knowledge-demo walkthrough, demo README, example environment file, and linked the demo from the main docs.

* **Chores**
  * Updated version-control ignores for demo artifacts, set demo Python runtime, and adjusted a project dependency for compatibility.

<!-- review_stack_entry_start -->

[![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/cuga-project/cuga-agent/pull/156?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

dolev31 and others added 30 commits April 5, 2026 17:08
Replace OpenRAG with a built-in knowledge engine supporting:
- Vector store abstraction (SQLite default, Milvus, PGVector)
- Docling document parsing (PDF, DOCX, HTML, etc.)
- Session-scoped and agent-scoped document management
- Knowledge MCP server, REST routes, and frontend panels
- Configurable RAG profiles (speed/standard/balanced/max_quality)
- Backward-compatible deprecation of OpenRAGClient

Includes rebuilt frontend bundles reflecting knowledge UI additions.
Merge main into knowledge feature branch to incorporate:
- Out-of-the-box agents (demo_docs, demo_health, oak_health)
- Authorization flow improvements
- Agent name customization
- FastMCP security bump
- Docker/deployment updates
- Frontend dist relocation to src/cuga/frontend/dist

Knowledge features preserved and integrated with new demo presets.
…eddings

sentence-transformers/torch were removed from the project in favor of
fastembed. Switch knowledge engine to FastEmbedEmbeddings to match.
…he with policies

Replace langchain-community FastEmbedEmbeddings with a thin adapter that
uses fastembed.TextEmbedding directly and reuses the model cache from
embedding_service. Keeps langchain-community for SQLiteVec and Ollama.
…ai/ollama)

- fastembed: default, uses fastembed.TextEmbedding directly
- openai: requires api_key (config or env), supports custom base_url
- ollama: supports custom base_url, defaults to localhost:11434
- Remove huggingface as provider (auto-migrated to fastembed)
- Add api_key and base_url config fields for embeddings
- Clear error messages when config is missing
…i, ollama

Four distinct providers, each logically correct:
- fastembed: default, lightweight local embeddings (installed with cuga)
- huggingface: sentence-transformers (optional dep, clear install instructions)
- openai: API-based, requires api_key config or OPENAI_API_KEY env var
- ollama: local server, configurable base_url
Create the converter once (lazy) and pass it to DoclingLoader, avoiding
model weight reloads on every document ingestion.
…d, knowledge agent ID

- Replace Debug (bug) icon with Settings icon for Configuration section
- Fix conversation history not loading when clicking previous sessions
  (pass selectedThreadId to CarbonChat so threadId changes trigger history reload,
   and keep isReadonly=true so homescreen doesn't override loaded history)
- Fix knowledge documents not showing (setKnowledgeAgentId was using display name
  instead of actual agent ID)
- Fix "body stream already read" error (manageRes.json() was called twice)
- Restyle right panel section switcher with grounded tab-strip borders
…ead of ~/.cuga/

Move vector DB, metadata, uploaded files, session state, and auth token
from ~/.cuga/ (shared home dir) to <cwd>/.cuga/ (per-project isolation),
matching how policies already use <cwd>/.cuga/.

Also fix test_defaults assertion for embedding_provider (fastembed not auto).
…gine start

- Add `cuga start demo_knowledge` CLI mode (knowledge enabled from startup)
- Add `cuga start demo_knowledge --reset` to wipe all knowledge data
- Add `cuga stop demo_knowledge` handler
- Default knowledge to disabled (knowledge_settings.toml, KnowledgeConfig dataclass)
- Knowledge engine can be started on-demand via POST /api/knowledge/enable
  (called when user toggles knowledge ON in the manage UI)
- Extract initialize_knowledge_engine() as reusable async function on app_state
  (full init: engine + session provider + MCP server + token + warmup)
- Fix demo restart bug: no longer wipes knowledge data on every demo start
  (only wipes when --reset explicitly passed)
- Fix reset: delete WAL sidecar files, check flock before deleting,
  log warnings instead of silently swallowing errors
- Warn when --reset passed to non-knowledge demos
- Fix Dynaconf caching: force enabled=true in saved config for demo_knowledge
  (env var set after settings import is not picked up by Dynaconf cache)
sami-marreed and others added 3 commits April 7, 2026 22:36
# Conflicts:
#	.gitignore
#	.secrets.baseline
#	pyproject.toml
#	src/cuga/backend/cuga_graph/nodes/chat/chat_agent/chat_agent.py
#	src/cuga/backend/cuga_graph/nodes/cuga_lite/cuga_lite_graph.py
#	src/cuga/config.py
#	src/cuga/frontend/dist/index.html
#	uv.lock
Adds a new example under docs/examples/knowledge_demo/ that demonstrates
the knowledge engine end-to-end with an HR Benefits Assistant scenario:

- 4 agent-level sample docs (handbook, health plan, PTO, 401(k))
- 3 session-level sample docs (one employee's enrollment, PTO balance,
  pay stub) that exercise cross-scope RAG reasoning
- main.py showing the programmatic SDK surface
  (agent.knowledge.ingest/search + agent.invoke)
- README covering both Path A (SDK) and Path B (cuga start demo_knowledge)
- pyproject.toml + .python-version + .env.example matching the
  cuga_as_mcp / cuga_with_runtime_tools example convention

Also fixes a blocking bug in src/cuga/backend/knowledge/client.py:
get_langchain_tools() generated tool functions that didn't accept the
`thread_id` kwarg that cuga_lite_graph injects at runtime, which made
any SDK-mode knowledge use via agent.invoke() crash with TypeError.
Adding **_ to the 7 tool wrappers absorbs the injected kwarg while
keeping the JSON schema (and thus the LLM-facing API) unchanged.

Root README.md gets two new links to the example (Knowledge Base
section + Additional Resources list). .gitignore adds the local-only
demo_knowledge_docs/ scratch folder.

Verified end-to-end:
- 69/69 knowledge unit tests pass
- Path A clean run answers "40 hours (5 days)" for PTO carryover,
  session search returns sarah_chen_pto_balance.md as top hit
- Path B: cuga start demo_knowledge boots, /api/knowledge/health
  reports healthy+ready, HTTP upload + search both succeed
@dolev31 dolev31 requested a review from sami-marreed April 19, 2026 08:47
@sami-marreed
Copy link
Copy Markdown
Contributor

Merge main and resolve conflicts (blocking)

Please merge or rebase onto the current main, resolve conflicts (this branch has historically overlapped .gitignore, pyproject.toml, cuga_lite_graph.py, client.py, lockfiles, etc.), then push so the PR is mergeable and CI reflects an integrated tree. GitHub currently shows the branch as conflicting with main.


Trim unrelated churn (high priority)

  • pyproject.toml adds openlit>=1.40.1 to the core dependencies list. On main, OpenLit is already handled via optional observability / overrides — this looks out of scope for a docs + knowledge-tool wrapper fix. Unless there is an explicit decision to make OpenLit a default dependency, drop this hunk (or split to a separate PR with rationale).

  • src/cuga/frontend/dist/main.*.js (~1 MB bundle) appears in the branch diff vs main. A knowledge demo + KnowledgeClient fix should normally not rebuild/commit frontend artifacts unless something here truly requires it — please remove unless tied to a concrete UI change for this PR.

  • .gitignore adds docs/examples/demo_apps/file_system/build/ alongside demo_knowledge_docs/. The demo_apps path looks unrelated to the knowledge demo — consider dropping it or moving it to a separate maintenance PR.

  • cuga_lite_graph.py diff vs main is only extra blank lines. Please revert that noise so history stays clean.


Code fix (KnowledgeClient.get_langchain_tools)

Adding **_: Any (with the NOTE comment) so injected kwargs like thread_id do not raise TypeError matches the described SDK/runtime mismatch — sensible given schema stability concerns.


Docs example

The docs/examples/knowledge_demo/ layout (agent vs session docs, dual paths SDK/UI, .env.example explaining Dynaconf) aligns well with the stated goals; once conflicts and unrelated files are cleaned up, this part should be straightforward to land.

…xample

# Conflicts:
#	.gitignore
#	src/cuga/backend/cuga_graph/nodes/cuga_lite/cuga_lite_graph.py
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 64a72f60-60a5-43be-8e00-154213f9dfab

📥 Commits

Reviewing files that changed from the base of the PR and between 16dda85 and bd94478.

📒 Files selected for processing (2)
  • docs/examples/knowledge_demo/main.py
  • src/cuga/backend/knowledge/client.py

📝 Walkthrough

Walkthrough

This PR adds a runnable HR Benefits Assistant knowledge-engine demo to docs/examples/knowledge_demo/, showcasing Cuga's agent-scoped and session-scoped document retrieval. Core library tool schemas are updated to accept injected parameters, and comprehensive documentation and sample HR documents enable reviewers to understand and run the demo end-to-end.

Changes

Knowledge Demo: HR Benefits Assistant

Layer / File(s) Summary
Knowledge tool signature robustness
src/cuga/backend/knowledge/client.py
KnowledgeClient.get_langchain_tools() updates all tool function signatures to accept **_: Any, allowing runner-injected fields (e.g., thread_id) without exposing them in StructuredTool JSON schema.
Core project and documentation updates
.gitignore, pyproject.toml, README.md
Main project .gitignore adds build and demo directories, pyproject.toml adds openlit>=1.40.1 as core dependency, and README.md adds knowledge demo links and resource references.
Knowledge demo project configuration
docs/examples/knowledge_demo/.env.example, .python-version, pyproject.toml
Demo project declares Python 3.12 requirement, configures Dynaconf environment variables for knowledge scopes and LLM providers, and pins local cuga as editable dependency via uv source override.
Knowledge demo walkthrough and architecture documentation
docs/examples/knowledge_demo/README.md
Comprehensive guide covering HR Benefits Assistant scenario, agent-level vs session-level scope mechanics, SDK walkthrough with main.py usage and expected console output, UI workflow with four example prompts and outcomes, and architecture overview linking to knowledge system reference docs.
Knowledge demo SDK script and helper functions
docs/examples/knowledge_demo/main.py
Runnable demo script with reset_agent_scope(), ingest_all(), and print_hits() helpers, plus a main() flow that optionally resets documents, ingests agent-level HR documents, executes a RAG agent.invoke() query, searches both agent-scoped and session-scoped knowledge for a fixed employee thread, and ensures cleanup via agent.aclose().
Sample HR/benefits knowledge documents
docs/examples/knowledge_demo/sample_data/agent_level/*, session_level/*
Agent-level shared documents: Acme Corp Employee Handbook, 2026 health insurance plan with medical/HSA/dental/vision tiers, PTO accrual/carryover/payout policy, and 401(k) plan details. Session-level employee-specific documents for Sarah Chen: benefits enrollment confirmation, March 2026 paystub, and PTO balance statement.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • sami-marreed
  • gjt-prog

Poem

🐰 A demo blooms with knowledge bright,
Sarah Chen's benefits take flight—
From handbook to HSA funds,
Agent scope meets session runs,
RAG retrieval, search delight!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Docs/knowledge demo example' is vague and uses a generic pattern (Docs/) that doesn't convey the specific primary change. It lacks clarity about what the demo demonstrates or why it's valuable. Consider a more descriptive title like 'Add HR Benefits knowledge demo with agent and session scope examples' to better communicate the changeset's primary contribution.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/knowledge-demo-example

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/cuga/backend/knowledge/client.py (1)

1-1: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Run ruff format to fix the formatting issue.

The pipeline failure indicates this file needs formatting. Run ruff format src/cuga/backend/knowledge/client.py to resolve the issue.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cuga/backend/knowledge/client.py` at line 1, Run the code formatter on
the impacted module to fix styling errors: execute `ruff format
src/cuga/backend/knowledge/client.py`, review the resulting changes in
src/cuga/backend/knowledge/client.py, and commit the formatted file so the
pipeline passes; if you prefer, add ruff to pre-commit to prevent future
failures.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.gitignore:
- Line 91: Remove the unrelated .gitignore entry for
"docs/examples/demo_apps/file_system/build/" (it does not belong to the
knowledge demo changes); either delete that line from .gitignore or move it into
a separate maintenance PR so only files related to
"docs/examples/knowledge_demo/" remain in this PR.
- Around line 100-101: Remove the stale .gitignore entry "demo_knowledge_docs/"
since the project uses "docs/examples/knowledge_demo/" for the knowledge demo;
edit the .gitignore and delete the line containing demo_knowledge_docs/ so it no
longer ignores that directory name.

In `@docs/examples/knowledge_demo/main.py`:
- Line 1: Run the Python formatter ruff on the example to fix the formatting
issues: execute the command suggested (ruff format
docs/examples/knowledge_demo/main.py) or run ruff format on the repository/that
file, then stage the formatted changes; this will correct the formatting problem
reported by the pipeline.

In
`@docs/examples/knowledge_demo/sample_data/session_level/sarah_chen_benefits_enrollment.md`:
- Line 50: Update the vesting sentence for past-tense consistency: locate the
"Vesting Status:" line (the sentence starting "reaches 3-year cliff on
2025-03-14") and change "reaches" to "reached" so it reads that the 3-year cliff
was reached on 2025-03-14, matching the NOTE that the cliff is already past and
employer match is 100% vested.

In
`@docs/examples/knowledge_demo/sample_data/session_level/sarah_chen_pto_balance.md`:
- Line 14: The PTO used year-to-date value in the table row "| PTO used
year-to-date | 32.00 | 4.00 |" is inconsistent with the usage history (total
40.00 hours); update that row to 40.00 (5.00 days) and then recalculate and
update the related "current balance" values accordingly (use accrual 53.33 +
carried 40.00 - used 40.00 = 53.33 hours). Also apply the same corrections to
the other occurrences referenced in the comment (the block covering the repeated
summary lines around the same table) so all instances match the corrected 40.00
used and recalculated balance.
- Line 22: Update the "Projected end-of-year balance if no further PTO is used"
line (the text starting "Projected end-of-year balance if no further PTO is
used: **...**") to reflect the correct math: use Carryover 40 + Annual accrual
160 − Used YTD 32 = 168 hours (21 days); if you adopt Used YTD = 40 then show
160 hours (20 days); ensure the displayed hours and days match the chosen used
value and the inline calculation in the markdown is adjusted accordingly.
- Line 6: The displayed tenure line "**Tenure:** 3 years, 11 months (hire date:
March 14, 2022)" is wrong; update it to reflect the correct tenure of "4 years,
1 month (hire date: March 14, 2022)" and then review any derived values that
depend on tenure (accrual bracket logic or summary lines in this document) to
ensure those values are updated consistently; locate the tenure string in the
file (the "**Tenure:** ..." line) and adjust the text and any related accrual
descriptions accordingly.
- Around line 43-45: Update the recommendation narrative in the session_level
PTO markdown so the usage and projection reflect 40 hours used in 4 months:
change "32 hours used in 4 months" to "40 hours used in 4 months" and update the
projected annual pace from "96 hours (12 days)" to "120 hours (15 days)"; ensure
the surrounding sentence about exceeding the 40-hour carryover cap still reads
correctly given the new projection.

In `@pyproject.toml`:
- Line 49: Remove the unrelated core dependency addition "openlit>=1.40.1" from
pyproject.toml: revert the change that adds that package to the main
dependencies and either drop it entirely (since observability extra already
requires openlit>=1.40.3) or move it into the observability extra with the
correct minimum version (>=1.40.3) in a separate PR with justification; ensure
no other code references assume openlit is a core dependency.

---

Outside diff comments:
In `@src/cuga/backend/knowledge/client.py`:
- Line 1: Run the code formatter on the impacted module to fix styling errors:
execute `ruff format src/cuga/backend/knowledge/client.py`, review the resulting
changes in src/cuga/backend/knowledge/client.py, and commit the formatted file
so the pipeline passes; if you prefer, add ruff to pre-commit to prevent future
failures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 89a0a67d-5161-46b2-9806-4aa325ec9580

📥 Commits

Reviewing files that changed from the base of the PR and between 69b7e40 and 34db81d.

⛔ Files ignored due to path filters (1)
  • src/cuga/frontend/dist/main.d324b2cb4c846b9d6a2c.js is excluded by !**/dist/**
📒 Files selected for processing (16)
  • .gitignore
  • README.md
  • docs/examples/knowledge_demo/.env.example
  • docs/examples/knowledge_demo/.python-version
  • docs/examples/knowledge_demo/README.md
  • docs/examples/knowledge_demo/main.py
  • docs/examples/knowledge_demo/pyproject.toml
  • docs/examples/knowledge_demo/sample_data/agent_level/01_employee_handbook.md
  • docs/examples/knowledge_demo/sample_data/agent_level/02_health_insurance_plan.md
  • docs/examples/knowledge_demo/sample_data/agent_level/03_pto_policy.md
  • docs/examples/knowledge_demo/sample_data/agent_level/04_retirement_401k_plan.md
  • docs/examples/knowledge_demo/sample_data/session_level/sarah_chen_benefits_enrollment.md
  • docs/examples/knowledge_demo/sample_data/session_level/sarah_chen_paystub_march_2026.md
  • docs/examples/knowledge_demo/sample_data/session_level/sarah_chen_pto_balance.md
  • pyproject.toml
  • src/cuga/backend/knowledge/client.py

Comment thread .gitignore
deployment/helm/*.env
!deployment/helm/openshift.example.env
KNOWLEDGE_PIPELINE.md
docs/examples/demo_apps/file_system/build/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Revert unrelated .gitignore entry.

The reviewer identified this line as unrelated to the knowledge demo PR. The path docs/examples/demo_apps/file_system/build/ does not match the new demo at docs/examples/knowledge_demo/ and should be dropped or moved to a separate maintenance PR.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.gitignore at line 91, Remove the unrelated .gitignore entry for
"docs/examples/demo_apps/file_system/build/" (it does not belong to the
knowledge demo changes); either delete that line from .gitignore or move it into
a separate maintenance PR so only files related to
"docs/examples/knowledge_demo/" remain in this PR.

Comment thread .gitignore
Comment on lines +100 to +101
# Knowledge demo docs (local only)
demo_knowledge_docs/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for references to demo_knowledge_docs
rg -n 'demo_knowledge_docs' --type-add 'config:*.{toml,yaml,yml,json}' --type config --type py --type md

Repository: cuga-project/cuga-agent

Length of output: 49


🏁 Script executed:

#!/bin/bash
# Broader search for demo_knowledge_docs in all files
rg -n 'demo_knowledge_docs' --no-heading

Repository: cuga-project/cuga-agent

Length of output: 49


🏁 Script executed:

#!/bin/bash
# Check if README exists and search for demo-related content
if [ -f "README.md" ]; then
  echo "=== README.md content related to demo ==="
  cat README.md | grep -i demo -C 3
fi

Repository: cuga-project/cuga-agent

Length of output: 8263


🏁 Script executed:

#!/bin/bash
# Check for shell scripts that might create demo_knowledge_docs
find . -name "*.sh" -type f | head -20

Repository: cuga-project/cuga-agent

Length of output: 767


🏁 Script executed:

#!/bin/bash
# Check the .gitignore file itself to see context around line 100-101
if [ -f ".gitignore" ]; then
  echo "=== .gitignore around lines 100-101 ==="
  sed -n '95,105p' .gitignore
fi

Repository: cuga-project/cuga-agent

Length of output: 403


Remove the demo_knowledge_docs/ entry from .gitignore.

The directory demo_knowledge_docs/ is not referenced anywhere in the codebase. The actual knowledge demo uses docs/examples/knowledge_demo/ as documented in the README (cuga start demo_knowledge). This .gitignore entry appears to be a leftover from an earlier iteration and should be removed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.gitignore around lines 100 - 101, Remove the stale .gitignore entry
"demo_knowledge_docs/" since the project uses "docs/examples/knowledge_demo/"
for the knowledge demo; edit the .gitignore and delete the line containing
demo_knowledge_docs/ so it no longer ignores that directory name.

Comment thread docs/examples/knowledge_demo/main.py

**Traditional 401(k) Contribution:** 8% of eligible compensation
**Roth 401(k) Contribution:** 0%
**Vesting Status:** Not yet fully vested — reaches 3-year cliff on 2025-03-14. **NOTE:** already past cliff; employer match is 100% vested as of March 14, 2025.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix past-tense inconsistency in vesting note.

The text says "reaches 3-year cliff on 2025-03-14" but the context date is April 2026, so the cliff was reached in the past. Change "reaches" to "reached" for consistency with the NOTE that says "already past cliff."

📝 Proposed fix
-**Vesting Status:** Not yet fully vested — reaches 3-year cliff on 2025-03-14. **NOTE:** already past cliff; employer match is 100% vested as of March 14, 2025.
+**Vesting Status:** Fully vested — reached 3-year cliff on March 14, 2025. Employer match is 100% vested as of March 14, 2025.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
**Vesting Status:** Not yet fully vested — reaches 3-year cliff on 2025-03-14. **NOTE:** already past cliff; employer match is 100% vested as of March 14, 2025.
**Vesting Status:** Fully vested — reached 3-year cliff on March 14, 2025. Employer match is 100% vested as of March 14, 2025.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@docs/examples/knowledge_demo/sample_data/session_level/sarah_chen_benefits_enrollment.md`
at line 50, Update the vesting sentence for past-tense consistency: locate the
"Vesting Status:" line (the sentence starting "reaches 3-year cliff on
2025-03-14") and change "reaches" to "reached" so it reads that the 3-year cliff
was reached on 2025-03-14, matching the NOTE that the cliff is already past and
employer match is 100% vested.

**Employee:** Sarah Chen
**Employee ID:** E-48271
**Report Date:** April 10, 2026
**Tenure:** 3 years, 11 months (hire date: March 14, 2022)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Tenure calculation is incorrect.

The hire date is March 14, 2022, and the report date is April 10, 2026. The time elapsed is approximately 4 years and 1 month, not 3 years and 11 months as stated. This error propagates into the accrual bracket logic and could cause confusion during the demo.

📅 Proposed fix
-**Tenure:** 3 years, 11 months (hire date: March 14, 2022)
+**Tenure:** 4 years, 1 month (hire date: March 14, 2022)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
**Tenure:** 3 years, 11 months (hire date: March 14, 2022)
**Tenure:** 4 years, 1 month (hire date: March 14, 2022)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@docs/examples/knowledge_demo/sample_data/session_level/sarah_chen_pto_balance.md`
at line 6, The displayed tenure line "**Tenure:** 3 years, 11 months (hire date:
March 14, 2022)" is wrong; update it to reflect the correct tenure of "4 years,
1 month (hire date: March 14, 2022)" and then review any derived values that
depend on tenure (accrual bracket logic or summary lines in this document) to
ensure those values are updated consistently; locate the tenure string in the
file (the "**Tenure:** ..." line) and adjust the text and any related accrual
descriptions accordingly.

|---|---|---|
| PTO accrued year-to-date (Jan–Apr) | 53.33 | 6.67 |
| PTO carried over from 2025 | 40.00 | 5.00 |
| PTO used year-to-date | 32.00 | 4.00 |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

PTO used year-to-date does not match the usage history.

Line 14 states 32.00 hours (4.00 days) used year-to-date, but the usage history table shows:

  • Jan 19-20: 2 days = 16 hours
  • Feb 13: 1 day = 8 hours
  • Mar 30-31: 2 days = 16 hours
  • Total: 5 days = 40 hours

This 8-hour discrepancy will cause the current PTO balance calculation to be incorrect and lead to inconsistent agent responses when queried about Sarah's PTO usage.

🔢 Proposed fix

Update the used YTD to match the usage history:

-| PTO used year-to-date | 32.00 | 4.00 |
+| PTO used year-to-date | 40.00 | 5.00 |

And recalculate the current balance:

-| **Current PTO balance** | **61.33** | **7.67** |
+| **Current PTO balance** | **53.33** | **6.67** |

(Calculation: 53.33 accrued + 40.00 carried over - 40.00 used = 53.33 hours)

Also applies to: 29-33

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@docs/examples/knowledge_demo/sample_data/session_level/sarah_chen_pto_balance.md`
at line 14, The PTO used year-to-date value in the table row "| PTO used
year-to-date | 32.00 | 4.00 |" is inconsistent with the usage history (total
40.00 hours); update that row to 40.00 (5.00 days) and then recalculate and
update the related "current balance" values accordingly (use accrual 53.33 +
carried 40.00 - used 40.00 = 53.33 hours). Also apply the same corrections to
the other occurrences referenced in the comment (the block covering the repeated
summary lines around the same table) so all instances match the corrected 40.00
used and recalculated balance.

Based on tenure (3–5 years bracket): **13.33 hours per month** (160 hours / 20 days annually)

Next accrual: April 30, 2026 (+13.33 hours)
Projected end-of-year balance if no further PTO is used: **181.33 hours (22.67 days)**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Projected end-of-year balance calculation appears incorrect.

The projected balance of 181.33 hours does not align with the stated accrual rate and usage:

  • Carryover from 2025: 40 hours
  • Annual accrual (12 months × 13.33): 160 hours
  • Used YTD: 32 hours (or 40 hours per usage history)
  • Expected projection (no further use): 40 + 160 - 32 = 168 hours (or 160 hours if using 40)

The stated 181.33 hours is approximately 13-21 hours too high, which will mislead demo users about carryover risk.

🧮 Proposed fix

Assuming the corrected used amount is 40 hours:

-Projected end-of-year balance if no further PTO is used: **181.33 hours (22.67 days)**
+Projected end-of-year balance if no further PTO is used: **160.00 hours (20.00 days)**
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Projected end-of-year balance if no further PTO is used: **181.33 hours (22.67 days)**
Projected end-of-year balance if no further PTO is used: **160.00 hours (20.00 days)**
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@docs/examples/knowledge_demo/sample_data/session_level/sarah_chen_pto_balance.md`
at line 22, Update the "Projected end-of-year balance if no further PTO is used"
line (the text starting "Projected end-of-year balance if no further PTO is
used: **...**") to reflect the correct math: use Carryover 40 + Annual accrual
160 − Used YTD 32 = 168 hours (21 days); if you adopt Used YTD = 40 then show
160 hours (20 days); ensure the displayed hours and days match the chosen used
value and the inline calculation in the markdown is adjusted accordingly.

Comment on lines +43 to +45
At current pace (32 hours used in 4 months), Sarah is on track to use approximately
96 hours (12 days) of PTO in 2026. She will still exceed the 40-hour carryover cap
at year-end unless she plans additional time off.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Recommendation narrative is inconsistent with corrected usage data.

If the PTO used YTD is corrected to 40 hours (5 days) instead of 32 hours, the pace calculation and recommendation should be updated accordingly. Currently it states "32 hours used in 4 months" and projects 96 hours (12 days) annually, which would be low.

📝 Proposed fix
-At current pace (32 hours used in 4 months), Sarah is on track to use approximately
-96 hours (12 days) of PTO in 2026. She will still exceed the 40-hour carryover cap
-at year-end unless she plans additional time off.
+At current pace (40 hours used in 4 months), Sarah is on track to use approximately
+120 hours (15 days) of PTO in 2026. She will still exceed the 40-hour carryover cap
+at year-end unless she plans additional time off.

(Calculation: 40 hours in 4 months × 12 months / 4 months = 120 hours = 15 days)

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
At current pace (32 hours used in 4 months), Sarah is on track to use approximately
96 hours (12 days) of PTO in 2026. She will still exceed the 40-hour carryover cap
at year-end unless she plans additional time off.
At current pace (40 hours used in 4 months), Sarah is on track to use approximately
120 hours (15 days) of PTO in 2026. She will still exceed the 40-hour carryover cap
at year-end unless she plans additional time off.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@docs/examples/knowledge_demo/sample_data/session_level/sarah_chen_pto_balance.md`
around lines 43 - 45, Update the recommendation narrative in the session_level
PTO markdown so the usage and projection reflect 40 hours used in 4 months:
change "32 hours used in 4 months" to "40 hours used in 4 months" and update the
projected annual pace from "96 hours (12 days)" to "120 hours (15 days)"; ensure
the surrounding sentence about exceeding the 40-hour carryover cap still reads
correctly given the new projection.

Comment thread pyproject.toml
"cryptography>=46.0.7",
"hvac>=2.0.0",
"boto3>=1.34.0",
"openlit>=1.40.1",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove unrelated dependency addition.

The reviewer explicitly flagged this change: openlit>=1.40.1 is being added to core dependencies, but on main it is handled optionally via the observability extra (which already requires >=1.40.3). This change is unrelated to the knowledge demo and should be dropped or moved to a separate PR with clear rationale for why OpenLit must become a core dependency.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pyproject.toml` at line 49, Remove the unrelated core dependency addition
"openlit>=1.40.1" from pyproject.toml: revert the change that adds that package
to the main dependencies and either drop it entirely (since observability extra
already requires openlit>=1.40.3) or move it into the observability extra with
the correct minimum version (>=1.40.3) in a separate PR with justification;
ensure no other code references assume openlit is a core dependency.

dolev31 added 2 commits May 20, 2026 15:48
…tures

- Add Knowledge (RAG) row to the "Why CUGA?" capabilities table,
  matching the brief mechanism · pointers style of neighboring rows
- Add a Knowledge engine bullet under Key Features & Capabilities that
  calls out Docling-backed ingestion and the two scopes:
  agent-level (permanent) and session-level (per-thread)
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