Class AgentSpecLoader
java.lang.Object
com.alibaba.cloud.ai.graph.agent.tools.task.AgentSpecLoader
Loads agent specs from Markdown files with YAML front matter.
File format (compatible with spring ai):
--- name: Explore description: Fast agent for exploring codebases... tools: Read, Grep, Glob # optional, comma-separated model: sonnet # optional --- # System prompt (markdown body) You are a file search specialist...
- Author:
- Spring AI Alibaba
-
Method Summary
Modifier and TypeMethodDescriptionloadFromDirectory(String directoryPath) Load agent specs from a directory (recursively scans for .md files).loadFromDirectory(Path rootPath) Load agent specs from a directory (recursively scans for .md files).static AgentSpecloadFromFile(Path filePath) Load a single agent spec from a file.static AgentSpecloadFromResource(org.springframework.core.io.Resource resource) Load agent spec from a Spring Resource.static AgentSpecParse markdown content with YAML front matter into AgentSpec.
-
Method Details
-
loadFromDirectory
Load agent specs from a directory (recursively scans for .md files).- Parameters:
directoryPath- path to directory containing agent spec files- Returns:
- list of parsed specs
- Throws:
IOException
-
loadFromDirectory
Load agent specs from a directory (recursively scans for .md files).- Throws:
IOException
-
loadFromFile
Load a single agent spec from a file.- Throws:
IOException
-
loadFromResource
public static AgentSpec loadFromResource(org.springframework.core.io.Resource resource) throws IOException Load agent spec from a Spring Resource.- Throws:
IOException
-
parse
Parse markdown content with YAML front matter into AgentSpec.
-