AS AgentScopeAPI 手册 / API Reference

AgentSkillRepository

public interface AgentSkillRepository extends AutoCloseable
源码Source io/agentscope/core/skill/repository/AgentSkillRepository.java:35–133

定义智能体技能仓库契约的接口。位于 io.agentscope.core.skill.repository 包,实现 AutoCloseable。核心成员包括 getSkill、getAllSkillNames、getAllSkills、save、delete、skillExists。

Repository interface for AgentSkill persistence operations.

This interface follows the Repository Pattern and Dependency Inversion Principle, allowing different storage stores (filesystem, database, remote APIs, etc.) to be used interchangeably.

Example usage:

`AgentSkillRepository repo = new GitHubSkillRepository("owner/repo");
AgentSkill skill = repo.getByName("calculate").orElseThrow();
`

方法摘要Method Summary

方法Method说明Description
public AgentSkill getSkill(String name)
获取技能。
Gets a skill by its name.
public List<String> getAllSkillNames()
获取 `getAllSkillNames`。
Lists all available skill IDs in the repository.
public List<AgentSkill> getAllSkills()
获取所有技能来自仓库。
Gets all skills from the repository.
public boolean save(List<AgentSkill> skills, boolean force)
保存数据到持久化存储。
Saves or updates a skill in the repository.
public boolean delete(String skillName)
删除数据。
Deletes a skill by its skill name.
public boolean skillExists(String skillName)
设置该参数。
Checks if a skill exists in the repository.
public AgentSkillRepositoryInfo getRepositoryInfo()
获取仓库信息。
Gets metadata about this repository.
public String getSource()
获取来源。
Gets the source identifier of this repository.
public void setWriteable(boolean writeable)
设置 `setWriteable`。
Sets the writeable flag for this repository.
public boolean isWriteable()
判断是否 `isWriteable`。
Checks if the repository supports write operations.
default public void close()
default
关闭连接并释放相关资源。
Cleans up any resources used by this repository.

方法详情Method Detail

getSkill

public AgentSkill getSkill(String name)

获取技能。

Gets a skill by its name.

参数Parameters
名称Name类型Type说明Description
nameString技能名称。The skill name
返回Returns AgentSkill
返回AgentSkill。The skill matching the name
抛出Throws
  • IllegalArgumentException 当if 名称或版本是无效时抛出 `IllegalArgumentException`。if name or version is invalid
源码Source io/agentscope/core/skill/repository/AgentSkillRepository.java:44

getAllSkillNames

public List<String> getAllSkillNames()

获取 getAllSkillNames。

Lists all available skill IDs in the repository.

返回Returns List<String>
返回列出。List of all skill IDs (never null, may be empty)
源码Source io/agentscope/core/skill/repository/AgentSkillRepository.java:53

getAllSkills

public List<AgentSkill> getAllSkills()

获取所有技能来自仓库。

Gets all skills from the repository.

返回Returns List<AgentSkill>
返回列出。List of all skills (never null, may be empty)
源码Source io/agentscope/core/skill/repository/AgentSkillRepository.java:60

save

public boolean save(List<AgentSkill> skills, boolean force)

保存数据到持久化存储。

Saves or updates a skill in the repository.

参数Parameters
名称Name类型Type说明Description
skillsList<AgentSkill>技能到保存。The skills to save
forcebooleanforce(类型 `boolean`)。Whether to force save even if the skill already exists
返回Returns boolean
返回布尔值,表示判断结果。`true` if save succeeded, `false` otherwise
源码Source io/agentscope/core/skill/repository/AgentSkillRepository.java:73

delete

public boolean delete(String skillName)

删除数据。

Deletes a skill by its skill name.

参数Parameters
名称Name类型Type说明Description
skillNameString技能名称(类型 `String`)。The skill name (never null)
返回Returns boolean
返回布尔值,表示判断结果。`true` if deletion succeeded, `false` if skill not found
源码Source io/agentscope/core/skill/repository/AgentSkillRepository.java:81

skillExists

public boolean skillExists(String skillName)

设置该参数。

Checks if a skill exists in the repository.

参数Parameters
名称Name类型Type说明Description
skillNameString技能名称(类型 `String`)。The skill name (never null)
返回Returns boolean
返回布尔值,表示判断结果。`true` if the skill exists, `false` otherwise
源码Source io/agentscope/core/skill/repository/AgentSkillRepository.java:89

getRepositoryInfo

public AgentSkillRepositoryInfo getRepositoryInfo()

获取仓库信息。

Gets metadata about this repository.

返回Returns AgentSkillRepositoryInfo
返回AgentSkillRepositoryInfo。Repository information (never null)
源码Source io/agentscope/core/skill/repository/AgentSkillRepository.java:98

getSource

public String getSource()

获取来源。

Gets the source identifier of this repository.

返回Returns String
返回字符串结果。The source identifier (never null)
源码Source io/agentscope/core/skill/repository/AgentSkillRepository.java:107

setWriteable

public void setWriteable(boolean writeable)

设置 setWriteable。

Sets the writeable flag for this repository.

参数Parameters
名称Name类型Type说明Description
writeablebooleanwriteable(类型 `boolean`)。Whether the repository supports write operations
源码Source io/agentscope/core/skill/repository/AgentSkillRepository.java:114

isWriteable

public boolean isWriteable()

判断是否 isWriteable。

Checks if the repository supports write operations.

返回Returns boolean
返回布尔值,表示判断结果。`true` if writable, `false` otherwise
源码Source io/agentscope/core/skill/repository/AgentSkillRepository.java:121

close

default public void close()
default

关闭连接并释放相关资源。

Cleans up any resources used by this repository.

源码Source io/agentscope/core/skill/repository/AgentSkillRepository.java:129–132
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.