Class AgentDefinitionAssembler

java.lang.Object
com.agentforge4j.config.loader.agent.AgentDefinitionAssembler

public final class AgentDefinitionAssembler extends Object
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".

  • Field Details

    • SYSTEM_PROMPT_FILE_NAME

      public static final String SYSTEM_PROMPT_FILE_NAME
      Sibling file name carrying the agent system prompt when not inlined.
      See Also:
    • BOUNDARIES_FILE_NAME

      public static final String BOUNDARIES_FILE_NAME
      Optional sibling file name appended to the system prompt.
      See Also:
  • Constructor Details

    • AgentDefinitionAssembler

      public AgentDefinitionAssembler()
  • Method Details

    • assemble

      Validates core fields and builds the definition, resolving the system prompt via the resolver.
      Parameters:
      file - parsed agent file; must not be null
      describedAs - label used in validation messages (bundle entry or artifact path)
      siblings - resolver for systemprompt.md / boundaries.md
      Returns:
      the loadable agent definition
      Throws:
      IllegalArgumentException - if a core field is invalid or the system prompt cannot be resolved
    • validate

      public void validate(AgentDefinitionFile file, String describedAs)
      Validates the core required fields shared by every loader.
      Parameters:
      file - parsed agent file
      describedAs - label used in validation messages