Component Registry
Relevant source files
The following files were used as context for generating this wiki page:
The Component Registry serves as the central orchestration hub for the WIREDUP system, facilitating the registration, discovery, and lifecycle management of all system modules. It operates in tandem with the Service Registry to provide a unified infrastructure for managing pluggable elements such as AI agents, tools, and skills. By maintaining detailed metadata and dependency graphs, the registry ensures that components are initialized in the correct order and remain accessible throughout the application lifecycle.
Within the broader project architecture, the registry is a foundational layer utilized by the Auto-Wiring Engine to resolve dependencies and inject services into AI agents. It provides the necessary abstractions to support dynamic scaling and modular extensibility, allowing developers to register custom factories and manage component states (enabled/disabled) at runtime.
Sources: src/core/registry.py:5-10, DEPLOYMENT_STATUS.md:15-22
Core Architecture
The registry system is divided into two primary sub-registries: the ServiceRegistry and the ComponentRegistry. While the ServiceRegistry focuses on active service instances and health monitoring, the ComponentRegistry manages the metadata, factories, and dependency relationships of pluggable modules.
Component Structure
Each component is represented by the ComponentInfo data structure, which tracks its identifying characteristics and operational requirements:
| Field | Type | Description |
|---|---|---|
name | str | Unique identifier for the component. |
component_type | str | Category (e.g., 'agent', 'tool', 'skill'). |
factory | Callable | Function used to instantiate the component. |
dependencies | List[str] | Names of other components required for initialization. |
priority | int | Execution/loading priority (higher values load earlier). |
enabled | bool | Current operational status of the component. |
Sources: src/core/registry.py:34-42, src/cli.py:165-175
Registry Relationships
The following diagram illustrates how the AutoWire core interacts with the registries to manage the system's modular ecosystem:
This diagram shows the hierarchical relationship where the Auto-Wiring Core orchestrates both Service and Component registries to manage system-wide dependencies.
Sources: README.md:25-45, AGENT.md:32-50
Service Management
The ServiceRegistry provides thread-safe storage and discovery for active service instances. It implements indexing by service type and capabilities to allow for efficient lookup during the dependency injection process.
Service Registration Logic
Services are registered with comprehensive metadata, including versioning and descriptions. The registry maintains a _type_index and a _capability_index to support polymorphic service discovery.
The sequence of steps involved in adding a new service to the registry, including index updates for discovery.
Sources: src/core/registry.py:45-80, src/cli.py:88-95
Health Monitoring
The ServiceRegistry includes built-in support for health checks. Services can provide an optional health_check callable upon registration, which the registry can invoke to verify operational status across the entire system.
check_health(name): Executes the specific health check for a named service.check_all_health(): Aggregates health status for every registered service into a dictionary.
Sources: src/core/registry.py:117-135
Component Lifecycle and Dependency Resolution
The ComponentRegistry handles the more complex logic of factory-based instantiation and dependency ordering. It is specifically designed to manage pluggable elements that may have strict requirements on the presence of other modules.
Dependency Resolution Order
To prevent initialization errors, the registry implements Kahn's algorithm for topological sorting. This ensures that if Component A depends on Component B, Component B is always listed first in the resolution order.
The logical flow of the topological sort used to determine the correct order for component initialization.
Sources: src/core/registry.py:255-290
Component Creation
The create method allows the system to instantiate components on-demand using their registered factories. It performs validation to ensure the component is both registered and enabled before attempting instantiation.
def create(self, name: str, **kwargs) -> Any:
with self._lock:
info = self._components.get(name)
if not info:
raise ValueError(f"Component '{name}' not found")
if not info.enabled:
raise ValueError(f"Component '{name}' is disabled")
return info.factory(**kwargs)
Sources: src/core/registry.py:211-222
CLI Integration and Status Reporting
The WIREDUP CLI (src/cli.py) provides administrative commands to interact with the Component Registry, allowing users to inspect the state of the system and verify component registration.
status: Queries theAutoWireengine to display registered dependencies and their initialization status (e.g., initialized vs. pending).list-components: Iterates through theComponentRegistryto display all modules, filtered by category, including their scope, tags, and dependencies.
Sources: src/cli.py:113-132, src/cli.py:155-180
CLI Status Table
The CLI presents component information in a structured format:
| Component | Status | Scope | Dependencies |
|---|---|---|---|
config_loader | ✅ | SINGLETON | None |
mcp_protocol | ✅ | SINGLETON | None |
ssh_manager | ⏳ | SINGLETON | None |
research_agent | ✅ | PROTOTYPE | config_loader, web_search |
Sources: src/cli.py:120-130, AGENT.md:120-135
Conclusion
The Component Registry is the backbone of the WIREDUP modular architecture, providing a thread-safe, metadata-rich environment for managing system services and pluggable components. By implementing robust indexing, health monitoring, and topological dependency resolution, it enables the Auto-Wiring System to reliably manage complex AI agent configurations and infrastructure services.
Sources: src/core/registry.py:5-10, src/init.py:1-15