# Interface ITemplateRegistry

Template registry interface.

interface ITemplateRegistry {
getBuiltIn(): TemplateMetadata[];
getAll(): TemplateMetadata[];
getById(id: string): WorkflowDefinition | undefined;
register(
workflow: WorkflowDefinition,
metadata?: Partial<TemplateMetadata>,
): void;
unregister(id: string): boolean;
loadFromDirectory(directoryPath: string): Promise<number>;
search(query: string): TemplateMetadata[];
getByCategory(category: TemplateCategory): TemplateMetadata[];
}

#### Implemented by

- TemplateRegistry

- Defined in packages/nexus-agents/src/workflows/template-types.ts:37

##### Index

### Methods

getBuiltIn
getAll
getById
register
unregister
loadFromDirectory
search
getByCategory

## Methods

### getBuiltIn

- getBuiltIn(): TemplateMetadata[]

  Get all built-in templates.

  #### Returns TemplateMetadata[]

  Array of built-in template metadata

  - Defined in packages/nexus-agents/src/workflows/template-types.ts:42

### getAll

- getAll(): TemplateMetadata[]

  Get all registered templates (built-in + custom).

  #### Returns TemplateMetadata[]

  Array of all template metadata

  - Defined in packages/nexus-agents/src/workflows/template-types.ts:48

### getById

- getById(id: string): WorkflowDefinition | undefined

  Get a workflow definition by template ID.

  #### Parameters

  - id: string

    Template name/ID

  #### Returns WorkflowDefinition | undefined

  WorkflowDefinition or undefined if not found

  - Defined in packages/nexus-agents/src/workflows/template-types.ts:55

### register

- register(
  workflow: WorkflowDefinition,
  metadata?: Partial<TemplateMetadata>,
  ): void

  Register a custom workflow template.

  #### Parameters

  - workflow: WorkflowDefinition

    Workflow definition to register

  - `Optional` metadata: Partial<TemplateMetadata>

    Optional additional metadata

  #### Returns void

  - Defined in packages/nexus-agents/src/workflows/template-types.ts:62

### unregister

- unregister(id: string): boolean

  Unregister a custom template by ID.

  #### Parameters

  - id: string

    Template ID to unregister

  #### Returns boolean

  True if template was removed

  - Defined in packages/nexus-agents/src/workflows/template-types.ts:69

### loadFromDirectory

- loadFromDirectory(directoryPath: string): Promise<number>

  Load templates from a directory.

  #### Parameters

  - directoryPath: string

    Path to directory containing YAML templates

  #### Returns Promise<number>

  Number of templates loaded

  - Defined in packages/nexus-agents/src/workflows/template-types.ts:76

### search

- search(query: string): TemplateMetadata[]

  Search templates by keyword.

  #### Parameters

  - query: string

    Search query

  #### Returns TemplateMetadata[]

  Matching template metadata

  - Defined in packages/nexus-agents/src/workflows/template-types.ts:83

### getByCategory

- getByCategory(category: TemplateCategory): TemplateMetadata[]

  Get templates by category.

  #### Parameters

  - category: TemplateCategory

    Category to filter by

  #### Returns TemplateMetadata[]

  Templates in the category

  - Defined in packages/nexus-agents/src/workflows/template-types.ts:90