java.lang.Object
com.agentforge4j.config.loader.AgentForgeLoader
Loads and validates agent and workflow configuration from filesystem and optional classpath
bundles.
-
Constructor Summary
ConstructorsConstructorDescriptionAgentForgeLoader(AgentLoader agentLoader, WorkflowDirectoryLoader workflowDirectoryLoader) -
Method Summary
Modifier and TypeMethodDescriptionload(Optional<Path> agentsDir, Optional<Path> workflowsDir, Optional<ClasspathAgentLoader> classpathAgentLoader, Optional<ClasspathWorkflowLoader> classpathWorkflowLoader) Loads configured agents and workflows from the provided sources and validates cross-references.Loads agent definitions from a filesystem directory.Loads workflows and workflow-bundled agents from a filesystem directory.loadWorkflows(Path dir) Loads workflow definitions from a filesystem directory.static voidmergeBundledAgentsStrict(Map<String, AgentDefinition> target, Map<String, AgentDefinition> additions, String additionsDescription) Mergesadditionsintotarget, failing if any agent id inadditionsis already present intarget.static voidmergeWorkflowsStrict(Map<String, WorkflowDefinition> target, Map<String, WorkflowDefinition> additions, String additionsDescription) Merges workflow definitions into an existing map while rejecting duplicate workflow ids.voidvalidate(Map<String, WorkflowDefinition> workflows, Map<String, AgentDefinition> agents) Runs the full workflow validation suite.
-
Constructor Details
-
AgentForgeLoader
-
-
Method Details
-
mergeBundledAgentsStrict
public static void mergeBundledAgentsStrict(Map<String, AgentDefinition> target, Map<String, AgentDefinition> additions, String additionsDescription) Mergesadditionsintotarget, failing if any agent id inadditionsis already present intarget.- Parameters:
target- destination map to updateadditions- agents to merge intotargetadditionsDescription- description used in duplicate-id errors- Throws:
DuplicateAgentIdException- when any id fromadditionsalready exists intarget
-
mergeWorkflowsStrict
public static void mergeWorkflowsStrict(Map<String, WorkflowDefinition> target, Map<String, WorkflowDefinition> additions, String additionsDescription) Merges workflow definitions into an existing map while rejecting duplicate workflow ids.- Parameters:
target- destination map to updateadditions- workflows to merge intotargetadditionsDescription- description used in duplicate-id errors- Throws:
DuplicateWorkflowIdException- when any id fromadditionsalready exists intarget
-
load
public LoadedConfiguration load(Optional<Path> agentsDir, Optional<Path> workflowsDir, Optional<ClasspathAgentLoader> classpathAgentLoader, Optional<ClasspathWorkflowLoader> classpathWorkflowLoader) Loads configured agents and workflows from the provided sources and validates cross-references.- Parameters:
agentsDir- presence opts in to filesystem agent loading; the directory is determined by the injectedAgentLoaderworkflowsDir- optional filesystem directory containing workflow bundlesclasspathAgentLoader- optional loader for shipped agentsclasspathWorkflowLoader- optional loader for shipped workflows- Returns:
- loaded and validated configuration snapshot
- Throws:
RuntimeException- when loading fails, duplicate ids are found, or validation fails
-
validate
Runs the full workflow validation suite.- Parameters:
workflows- workflows to validateagents- agents available to workflow steps- Throws:
RuntimeException- when any validation rule fails
-
loadAgents
Loads agent definitions from a filesystem directory.- Returns:
- loaded agents keyed by id
-
loadWorkflows
Loads workflow definitions from a filesystem directory.- Parameters:
dir- directory containing workflow bundles- Returns:
- loaded workflows keyed by id
-
loadWorkflowDirectory
Loads workflows and workflow-bundled agents from a filesystem directory.- Parameters:
dir- directory containing workflow bundles- Returns:
- loaded workflows together with bundled agents
-