feat: add tools for agent skills#206
Open
kyteinsky wants to merge 2 commits into
Open
Conversation
Signed-off-by: kyteinsky <kyteinsky@gmail.com> Assisted-by: Github Copilot: claude-opus-4-7
Signed-off-by: kyteinsky <kyteinsky@gmail.com> Assisted-by: Github Copilot: claude-opus-4-6 Assisted-by: Github Copilot: qwen-35b-3-6
1 task
marcelklehr
reviewed
Jun 30, 2026
| # tool files during development requires a process restart, which is fine. | ||
| qualified = f'ex_app.lib.all_tools.{module_name}' | ||
| module = importlib.import_module(qualified) | ||
| spec = module.__spec__ |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds “skills” support to the Context Agent by introducing tools to load/store user skills from the Assistant app, and wiring the available skills list into the agent system prompt so the model can decide when to fetch skill bodies.
Changes:
- Switch tool-module loading to canonical package imports (intended to share module state via
sys.modules). - Add a new
Skillstool module withload_skill/store_skilland a cachedlist_skills_metadata. - Extend the agent system prompt generation to include available skills and memory-loading guidance.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| ex_app/lib/tools.py | Changes dynamic tool module loading strategy to use canonical imports. |
| ex_app/lib/all_tools/skills.py | Introduces skills endpoints integration and exposes load/store tools. |
| ex_app/lib/all_tools/lib/decorator.py | Adds cache invalidation support to timed_memoize for per-user caches. |
| ex_app/lib/agent.py | Injects available skills list and skill tool guidance into the system prompt. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+88
to
+92
| # SAME module object as the one we load here. Trade-off: hot-reloading | ||
| # tool files during development requires a process restart, which is fine. | ||
| qualified = f'ex_app.lib.all_tools.{module_name}' | ||
| module = importlib.import_module(qualified) | ||
| spec = module.__spec__ |
Comment on lines
+25
to
+28
| # skills are cached in the Assistant side for 24 hours backed by etags | ||
| # this cache interval is only a delay in cases where the skill is manually | ||
| # updated or added in the filesystem | ||
| SKILLS_CACHE_TTL = 5 * 60 |
| from nc_py_api import AsyncNextcloudApp | ||
| from nc_py_api._exceptions import NextcloudExceptionNotFound | ||
|
|
||
| from ex_app.lib.all_tools.lib.decorator import safe_tool, timed_memoize |
Comment on lines
+104
to
+105
| @tool | ||
| async def store_skill(skill_name: str, description: str, content: str): |
Comment on lines
152
to
+154
| if task['input'].get('memories', None) is not None and task['input'].get('memories', None) is not []: | ||
| system_prompt_text += "You can remember things from other conversations with the user. If relevant, take into account the following memories:\n\n" + "\n".join(task['input']['memories']) + "\n\n" | ||
| if tool_enabled("load_memory"): |
| if task['input'].get('memories', None) is not None and task['input'].get('memories', None) is not []: | ||
| system_prompt_text += "You can remember things from other conversations with the user. If relevant, take into account the following memories:\n\n" + "\n".join(task['input']['memories']) + "\n\n" | ||
| if tool_enabled("load_memory"): | ||
| system_prompt_text += "In addition to the above memories, there are also long-term memories stored on-demand from other conversations. List and load those memories if they are not present here and the user or the conversation points to something that should be rememebered.\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
required: nextcloud/assistant#594
resolves: #170
In the admin's filesystem:
After adding the global skills from alice's filesystem:
🤖 AI (if applicable)