Overview
TheAgentLoader class provides a unified interface for instantiating Agent objects from on-disk definitions. It supports three file formats and dispatches automatically based on the file extension.
Use this when you want agent definitions to live as data — checked into git, edited by humans, generated by tools — rather than hard-coded in Python.
Installation
Constructor
bool
default:"True"
Default for concurrent loading when multiple files are passed. Individual
load_* methods accept their own concurrent override.Methods
auto()
Dispatch to the right loader based on file extension. The simplest entry point.file_path(str): Path to.md,.yaml, or.csvfile.*args,**kwargs: Forwarded to the underlying loader.
List[Agent]
Raises: ValueError if the file extension is not .md, .yaml, or .csv.
load_single_agent()
Alias forauto() — loads a single file by dispatching on extension.
load_multiple_agents()
Applyauto() to a list of files. Each file may be a different format.
file_paths(List[str]): Paths to agent definition files.
load_agent_from_markdown()
Load a single agent from a Markdown file.load_agents_from_markdown()
Load multiple agents from one or more Markdown files.Union[str, List[str]]
Single path or list of paths to Markdown agent files.
bool
default:"True"
Load files in parallel.
float
default:"10.0"
Files above this size are skipped.
load_agents_from_yaml()
Load agents from a single YAML file.str
Path to the YAML definitions file.
ReturnTypes
default:"\"auto\""
Controls the return shape from the underlying YAML loader.
load_many_agents_from_yaml()
Load agents from a list of YAML files with per-file return type control.load_agents_from_csv()
Load agents from a CSV file viaCSVAgentLoader.
parse_markdown_file()
Lower-level: parse a Markdown file viaMarkdownAgentLoader directly, using the host’s CPU count as worker count.
Usage Examples
Auto-Dispatch on Extension
The shortest path — letauto() figure out the format.