Class AgentSpecLoader

java.lang.Object
com.alibaba.cloud.ai.graph.agent.tools.task.AgentSpecLoader

public final class AgentSpecLoader extends Object
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 Details

    • loadFromDirectory

      public static List<AgentSpec> loadFromDirectory(String directoryPath) throws IOException
      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

      public static List<AgentSpec> loadFromDirectory(Path rootPath) throws IOException
      Load agent specs from a directory (recursively scans for .md files).
      Throws:
      IOException
    • loadFromFile

      public static AgentSpec loadFromFile(Path filePath) throws IOException
      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

      public static AgentSpec parse(String markdown)
      Parse markdown content with YAML front matter into AgentSpec.