# Function loadTemplatesFromDirectory

Workflows exports - Workflow engine with parallel execution Split from index.ts for file size compliance (Issue #285)

- loadTemplatesFromDirectory(
  directoryPath: string,
  ): Promise<
  { templates: ParsedTemplate[]; errors: (SecurityError | ParseError)[] },
  >

  Load all templates from a directory. Validates each file path to prevent path traversal attacks.

  #### Parameters

  - directoryPath: string

    Path to directory containing YAML templates

  #### Returns Promise<{ templates: ParsedTemplate[]; errors: (SecurityError | ParseError)[] }>

  Array of successfully loaded templates and any errors

  - Defined in packages/nexus-agents/src/workflows/template-loader.ts:225