# Class ExpertRegistry

Singleton registry for managing expert agents.

Provides thread-safe registration and lookup of experts. Supports querying by ID, role, and capabilities.

Implements IRegistry<Expert, RegistryError> for unified registry API.

#### Implements

- IRegistry<Expert, RegistryError>

- Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:68

##### Index

### Accessors

size
isEmpty

### Methods

getInstance
resetInstance
register
registerMany
unregister
get
has
getByCapability
getByRole
queryWithOptions
query
getAll
getAllIds
search
clear
getStats
findBestMatch

## Accessors

### size

- get size(): number

  Get the number of registered experts.

  #### Returns number

  Implementation of IRegistry.size

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:312

### isEmpty

- get isEmpty(): boolean

  Check if the registry is empty.

  #### Returns boolean

  Implementation of IRegistry.isEmpty

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:319

## Methods

### `Static` getInstance

- getInstance(): ExpertRegistry

  Get the singleton instance.

  #### Returns ExpertRegistry

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:79

### `Static` resetInstance

- resetInstance(): void

  Reset the singleton instance (for testing).

  #### Returns void

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:87

### register

- register(
  expert: Expert,
  options?: ExpertRegisterOptions,
  ): Result<void, RegistryError>

  Register an expert in the registry.

  #### Parameters

  - expert: Expert

    Expert to register

  - `Optional` options: ExpertRegisterOptions

    Registration options

  #### Returns Result<void, RegistryError>

  Result with void or RegistryError

  Implementation of IRegistry.register

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:101

### registerMany

- registerMany(
  experts: Expert[],
  options?: ExpertRegisterOptions,
  ): Result<void, RegistryError>

  Register multiple experts.

  #### Parameters

  - experts: Expert[]

    Experts to register

  - `Optional` options: ExpertRegisterOptions

    Registration options

  #### Returns Result<void, RegistryError>

  Result with void or first RegistryError

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:126

### unregister

- unregister(id: string): Result<Expert, RegistryError>

  Unregister an expert by ID.

  #### Parameters

  - id: string

    Expert ID to unregister

  #### Returns Result<Expert, RegistryError>

  Result with the removed Expert or RegistryError

  Implementation of IRegistry.unregister

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:142

### get

- get(id: string): Result<Expert, RegistryError>

  Get an expert by ID.

  #### Parameters

  - id: string

    Expert ID to retrieve

  #### Returns Result<Expert, RegistryError>

  Result with Expert or RegistryError

  Implementation of IRegistry.get

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:163

### has

- has(id: string): boolean

  Check if an expert is registered.

  #### Parameters

  - id: string

    Expert ID to check

  #### Returns boolean

  True if expert is registered

  Implementation of IRegistry.has

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:186

### getByCapability

- getByCapability(capability: AgentCapability): Expert[]

  Get experts by capability.

  Returns all experts that have the specified capability.

  #### Parameters

  - capability: AgentCapability

    Capability to search for

  #### Returns Expert[]

  Array of matching experts

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:198

### getByRole

- getByRole(role: string): Expert[]

  Get experts by role.

  #### Parameters

  - role: string

    Role to search for

  #### Returns Expert[]

  Array of matching experts

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:210

### queryWithOptions

- queryWithOptions(options: QueryOptions): Expert[]

  Query experts with multiple criteria. Domain-specific query with structured options.

  #### Parameters

  - options: QueryOptions

    Query options

  #### Returns Expert[]

  Array of matching experts

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:221

### query

- query(predicate: (item: Expert) => boolean): Expert[]

  Query experts with predicate function. IRegistry interface method.

  #### Parameters

  - predicate: (item: Expert) => boolean

    Function to test each expert

  #### Returns Expert[]

  Array of matching experts

  Implementation of IRegistry.query

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:260

### getAll

- getAll(): Expert[]

  Get all registered experts. IRegistry interface method.

  #### Returns Expert[]

  Array of all registered experts

  Implementation of IRegistry.getAll

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:274

### getAllIds

- getAllIds(): string[]

  Get all registered expert IDs. IRegistry interface method.

  #### Returns string[]

  Array of all registered expert IDs

  Implementation of IRegistry.getAllIds

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:284

### search

- search(searchTerm: string): Expert[]

  Search experts by text query. IRegistry interface method.

  Searches expert ID, name, role, and capabilities.

  #### Parameters

  - searchTerm: string

    Search term to match

  #### Returns Expert[]

  Array of matching experts

  Implementation of IRegistry.search

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:297

### clear

- clear(): void

  Clear all registered experts.

  #### Returns void

  Implementation of IRegistry.clear

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:326

### getStats

- getStats(): RegistryStats

  Get statistics about the registry. Returns IRegistryStats-compatible stats with domain-specific extensions.

  #### Returns RegistryStats

  Implementation of IRegistry.getStats

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:334

### findBestMatch

- findBestMatch(
  requiredCapabilities: AgentCapability[],
  ): Result<Expert, RegistryError>

  Find the best expert for a set of required capabilities.

  Returns the expert that matches the most capabilities.

  #### Parameters

  - requiredCapabilities: AgentCapability[]

    Capabilities needed

  #### Returns Result<Expert, RegistryError>

  Result with best Expert or RegistryError if none found

  - Defined in packages/nexus-agents/src/agents/experts/expert-registry.ts:363