Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "veadk-python"
version = "0.5.23"
version = "0.5.24"
description = "Volcengine agent development kit, integrations with Volcengine cloud services."
readme = "README.md"
requires-python = ">=3.10"
Expand Down
6 changes: 5 additions & 1 deletion veadk/skills/check_skills_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ def reload_skills_from_config(skills_config: List[str]) -> Dict[str, Skill]:
for skill_dir in path.iterdir():
if skill_dir.is_dir():
skill = load_skill_from_directory(skill_dir)
all_skills[skill.name] = skill
# Only add skill if it loaded successfully
if skill is not None:
all_skills[skill.name] = skill
else:
logger.warning(f"Skipped failed skill from {skill_dir}")
except Exception as e:
logger.error(
f"Failed to reload skills from local directory {path}: {e}"
Expand Down
53 changes: 28 additions & 25 deletions veadk/skills/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,39 +85,41 @@ def init_skill_check_list(
return init_skill_check_list


def load_skill_from_directory(skill_directory: Path) -> Skill:
def load_skill_from_directory(skill_directory: Path) -> Optional[Skill]:
logger.info(f"Load skill from {skill_directory}")
skill_readme = skill_directory / "SKILL.md"
if not skill_readme.exists():
logger.error(f"Skill '{skill_directory}' has no SKILL.md file.")
raise ValueError(f"Skill '{skill_directory}' has no SKILL.md file")
return None

try:
skill = frontmatter.load(str(skill_readme))

skill = frontmatter.load(str(skill_readme))
skill_name = skill.get("name", "")
skill_description = skill.get("description", "")
checklist = skill.get("checklist", [])

skill_name = skill.get("name", "")
skill_description = skill.get("description", "")
checklist = skill.get("checklist", [])
if not skill_name or not skill_description:
logger.error(
f"Skill {skill_readme} is missing name or description. Please check the SKILL.md file."
)
return None

if not skill_name or not skill_description:
logger.error(
f"Skill {skill_readme} is missing name or description. Please check the SKILL.md file."
logger.info(
f"Successfully loaded skill {skill_name} locally from {skill_readme}, name={skill_name}, description={skill_description}"
)
raise ValueError(
f"Skill {skill_readme} is missing name or description. Please check the SKILL.md file."
if checklist:
logger.info(f"Skill {skill_name} checklist: {checklist}")

return Skill(
name=skill_name, # type: ignore
description=skill_description, # type: ignore
path=str(skill_directory),
checklist=checklist,
)

logger.info(
f"Successfully loaded skill {skill_name} locally from {skill_readme}, name={skill_name}, description={skill_description}"
)
if checklist:
logger.info(f"Skill {skill_name} checklist: {checklist}")

return Skill(
name=skill_name, # type: ignore
description=skill_description, # type: ignore
path=str(skill_directory),
checklist=checklist,
)
except Exception as e:
logger.error(f"Failed to load skill from {skill_directory}: {e}")
return None


def load_skills_from_directory(skills_directory: Path) -> list[Skill]:
Expand All @@ -126,7 +128,8 @@ def load_skills_from_directory(skills_directory: Path) -> list[Skill]:
for skill_directory in skills_directory.iterdir():
if skill_directory.is_dir():
skill = load_skill_from_directory(skill_directory)
skills.append(skill)
if skill is not None:
skills.append(skill)
return skills


Expand Down
2 changes: 1 addition & 1 deletion veadk/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

VERSION = "0.5.23"
VERSION = "0.5.24"