calute.core.basics#
Basic utilities and registration system for Calute components.
This module provides a registration system for tracking and managing different Calute components including clients, agents, and calute instances. It also includes utility functions for pretty-printing and object serialization.
- calute.core.basics.AGENTS_REGISTRY: dict[str, Any] = {}#
Registry for agent instances.
- calute.core.basics.CALUTE_REGISTRY: dict[str, Any] = {}#
Registry for calute instances.
- calute.core.basics.CLIENT_REGISTRY: dict[str, Any] = {}#
Registry for client instances.
- calute.core.basics.REGISTRY: dict[str, dict[str, Any]] = {'agents': {}, 'calute': {}, 'client': {}}#
Master registry containing all component registries.
- calute.core.basics.basic_registry(register_type: Literal['calute', 'agents', 'client'], register_name: str) callable[source]#
Decorator for registering Calute components and adding utility methods.
This decorator registers a class in the appropriate registry and adds utility methods for serialization and string representation.
- Parameters
register_type – The type of component to register (‘calute’, ‘agents’, or ‘client’).
register_name – The name to register the component under.
- Returns
A decorator function that registers the class and adds utility methods.
- Raises
AssertionError – If register_type is not one of the valid options.
Example
>>> @basic_registry("agents", "my_agent") ... class MyAgent: ... def __init__(self, name): ... self.name = name >>> >>> agent = MyAgent("test") >>> print(agent.to_dict()) {'name': 'test'}