Skip to content

latent.registry.agents

Agent registry with caching for CLI discovery and chat.

Provides auto-discovery of @agent-decorated BaseAgent subclasses, an in-memory registry with disk caching, and AST pre-scan for broad glob patterns.

Classes

AgentEntry

AgentEntry(name: str, module_path: str, class_name: str, description: str = '', parameters: list[ParameterInfo] = list(), _agent_cls: type | None = None)

Metadata for a registered agent.

AgentRegistry

AgentRegistry()

In-memory registry of discovered @agent-decorated classes.

Functions

agent

agent(name: str, description: str = '') -> Callable[[type], type]

Register a BaseAgent subclass in the AgentRegistry.

Args: name: Unique agent name used for CLI lookup. description: Optional human-readable description. Falls back to the class docstring first line.

discover_and_register_agents

discover_and_register_agents(force_import: bool = False) -> dict[str, AgentEntry]

Discover all agents from configured scan paths.

Uses cached registry when possible. Set force_import=True for commands that need the actual _agent_cls references (like latent chat).

Methods

AgentRegistry.all

all() -> dict[str, AgentEntry]

AgentRegistry.clear

clear() -> None

AgentRegistry.get

get(name: str) -> AgentEntry | None

AgentRegistry.register

register(name: str, entry: AgentEntry) -> None

Attributes

AGENT_CACHE_DIR

AGENT_CACHE_FILE

EXCLUDED_DIRS