Module agentforge4j.config.loader
Class AgentDefinitionAssembler
java.lang.Object
com.agentforge4j.config.loader.agent.AgentDefinitionAssembler
Shared production path that turns a parsed
AgentDefinitionFile into a loadable AgentDefinition:
core-field validation, system-prompt resolution (inline, else a systemprompt.md sibling optionally appended
with boundaries.md), and conversion via AgentDefinitionFile.toDefinition(String) (which applies the
record's own invariants).
Used by both BaseAgentLoader (resolving siblings from the bundle source) and the
generated-artifact validator (resolving siblings from the run's captured artifacts), so "valid" means literally
"loads as a valid AgentDefinition".
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceResolves a sibling file's content by name, returningnullwhen absent. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionassemble(AgentDefinitionFile file, String describedAs, AgentDefinitionAssembler.SiblingResolver siblings) Validates core fields and builds the definition, resolving the system prompt via the resolver.voidvalidate(AgentDefinitionFile file, String describedAs) Validates the core required fields shared by every loader.
-
Field Details
-
SYSTEM_PROMPT_FILE_NAME
Sibling file name carrying the agent system prompt when not inlined.- See Also:
-
BOUNDARIES_FILE_NAME
Optional sibling file name appended to the system prompt.- See Also:
-
-
Constructor Details
-
AgentDefinitionAssembler
public AgentDefinitionAssembler()
-
-
Method Details
-
assemble
public AgentDefinition assemble(AgentDefinitionFile file, String describedAs, AgentDefinitionAssembler.SiblingResolver siblings) Validates core fields and builds the definition, resolving the system prompt via the resolver.- Parameters:
file- parsed agent file; must not benulldescribedAs- label used in validation messages (bundle entry or artifact path)siblings- resolver forsystemprompt.md/boundaries.md- Returns:
- the loadable agent definition
- Throws:
IllegalArgumentException- if a core field is invalid or the system prompt cannot be resolved
-
validate
Validates the core required fields shared by every loader.- Parameters:
file- parsed agent filedescribedAs- label used in validation messages
-