feat(mysql): add MysqlSkillRepository and associated tests for skill …#600
feat(mysql): add MysqlSkillRepository and associated tests for skill …#600jianjun159 wants to merge 15 commits intoagentscope-ai:mainfrom
Conversation
Summary of ChangesHello @jianjun159, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant enhancement to the AgentScope-Java framework by integrating MySQL as a persistent storage solution for agent skills. It provides a robust and secure mechanism for managing skill metadata and associated resources, allowing for scalable and reliable skill management within AgentScope applications. This addition expands the data persistence options available for AgentScope components. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a MysqlSkillRepository for persisting agent skills in a MySQL database. The implementation is robust, with good practices like using a builder pattern, transaction management, and validation to prevent SQL injection. The accompanying unit tests are comprehensive and well-structured.
I've identified a few areas for improvement, primarily concerning data integrity, performance, and transactional behavior. My key recommendations are:
- Enforcing data integrity by adding the documented foreign key constraint to the database schema.
- Optimizing the
getAllSkillsmethod to resolve an N+1 query issue. - Revisiting the transaction logic in the
savemethod to handle lists of skills more predictably. - A minor performance enhancement in resource insertion and a correction in the corresponding unit test.
Overall, this is a solid contribution. Addressing these points will make the repository more performant and resilient.
...repository/src/main/java/io/agentscope/core/skill/repository/mysql/MysqlSkillRepository.java
Show resolved
Hide resolved
...repository/src/main/java/io/agentscope/core/skill/repository/mysql/MysqlSkillRepository.java
Show resolved
Hide resolved
...kill-mysql/src/main/java/io/agentscope/core/skill/repository/mysql/MysqlSkillRepository.java
Outdated
Show resolved
Hide resolved
...repository/src/main/java/io/agentscope/core/skill/repository/mysql/MysqlSkillRepository.java
Outdated
Show resolved
Hide resolved
...-mysql/src/test/java/io/agentscope/core/skill/repository/mysql/MysqlSkillRepositoryTest.java
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
👌 |
agentscope-extensions/agentscope-extensions-skill-mysql/pom.xml
Outdated
Show resolved
Hide resolved
# Conflicts: # docs/en/task/agent-skill.md # docs/zh/task/agent-skill.md
fang-tech
left a comment
There was a problem hiding this comment.
LGTM, tks for your contribution!
|
|
||
| Bind Tools to Skills for on-demand activation. Avoids context pollution from pre-registering all Tools, only passing relevant Tools to LLM when the Skill is actively used. | ||
|
|
||
| **Lifecycle of Progressively Disclosed Tools**: Tool lifecycle remains consistent with Skill lifecycle. Once a Skill is activated, Tools remain available throughout the entire session, avoiding the call failures caused by Tool deactivation after each conversation round in the old mechanism. |
There was a problem hiding this comment.
do not change this statement
There was a problem hiding this comment.
update here, do not change this
...repository/src/main/java/io/agentscope/core/skill/repository/mysql/MysqlSkillRepository.java
Outdated
Show resolved
Hide resolved
...repository/src/main/java/io/agentscope/core/skill/repository/mysql/MysqlSkillRepository.java
Outdated
Show resolved
Hide resolved
...repository/src/main/java/io/agentscope/core/skill/repository/mysql/MysqlSkillRepository.java
Outdated
Show resolved
Hide resolved
...repository/src/main/java/io/agentscope/core/skill/repository/mysql/MysqlSkillRepository.java
Outdated
Show resolved
Hide resolved
...repository/src/main/java/io/agentscope/core/skill/repository/mysql/MysqlSkillRepository.java
Outdated
Show resolved
Hide resolved
...repository/src/main/java/io/agentscope/core/skill/repository/mysql/MysqlSkillRepository.java
Outdated
Show resolved
Hide resolved
...repository/src/main/java/io/agentscope/core/skill/repository/mysql/MysqlSkillRepository.java
Outdated
Show resolved
Hide resolved
...repository/src/main/java/io/agentscope/core/skill/repository/mysql/MysqlSkillRepository.java
Outdated
Show resolved
Hide resolved
...repository/src/main/java/io/agentscope/core/skill/repository/mysql/MysqlSkillRepository.java
Show resolved
Hide resolved
|
Update the unnecessary modifications in the English document |
…disclosure of tools
Ok. Now the content of the Chinese document and the English document is consistent |
|
@AlbumenJ help to merge |
| * | ||
| * @return the number of skills deleted | ||
| */ | ||
| public int clearAllSkills() { |
There was a problem hiding this comment.
clearAllSkills() currently does not check the writeable flag. Given that both save() and delete() enforce this check to prevent write operations in read-only mode, is it intentional that clearAllSkills() bypasses it?
There was a problem hiding this comment.
It's not the case. This check really needs to be conducted. It was overlooked.
# Conflicts: # agentscope-distribution/agentscope-all/pom.xml
|
Please ensure all review comments are resolved before we proceed. Kindly take another look. |
All the review comments have been resolved. Thank you for your review |


…management
AgentScope-Java Version
[The version of AgentScope-Java you are working on, e.g. 1.0.7, check your pom.xml dependency version or run
mvn dependency:tree | grep agentscope-parent:pom(only mac/linux)]version: 1.0.7
Description
[Please describe the background, purpose, changes made, and how to test this PR]
feat(mysql): add MysqlSkillRepository and associated tests for skill management #599
Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)