praval.core.registry
Agent and Tool Registry for Praval Framework.
Provides a global registry for tracking agents and tools across the system,
enabling better coordination and discovery in multi-agent applications.
Thread-safe for concurrent agent registration and lookup.
Functions
Classes
PravalRegistry()
|
Global registry for agents and tools in Praval applications. |
-
class praval.core.registry.PravalRegistry[source]
Bases: object
Global registry for agents and tools in Praval applications.
Thread-safe for concurrent agent registration and lookup.
Uses RLock to allow reentrant locking (same thread can acquire multiple times).
-
__init__()[source]
-
register_agent(agent)[source]
Register an agent in the global registry (thread-safe).
- Parameters:
agent (Agent) โ Agent instance to register
- Return type:
Agent
- Returns:
The registered agent
-
get_agent(name)[source]
Get an agent by name from the registry (thread-safe).
- Return type:
Optional[Agent]
- Parameters:
name (str)
-
get_all_agents()[source]
Get all registered agents (thread-safe, returns copy).
- Return type:
Dict[str, Agent]
-
get_tool(tool_name)[source]
Get a tool by name from the registry (thread-safe).
- Return type:
Optional[Dict[str, Any]]
- Parameters:
tool_name (str)
-
get_tools_by_agent(agent_name)[source]
Get all tools for a specific agent (thread-safe).
- Return type:
Dict[str, Dict[str, Any]]
- Parameters:
agent_name (str)
-
list_agents()[source]
List names of all registered agents (thread-safe).
- Return type:
List[str]
-
list_tools()[source]
List names of all registered tools (thread-safe).
- Return type:
List[str]
-
clear()[source]
Clear all registered agents and tools (thread-safe).
-
praval.core.registry.register_agent(agent)[source]
Register an agent in the global registry.
- Return type:
Agent
- Parameters:
agent (Agent)
-
praval.core.registry.get_registry()[source]
Get the global registry instance.
- Return type:
PravalRegistry
-
praval.core.registry.reset_registry()[source]
Reset the global registry to a clean state.
This is primarily used for testing to ensure test isolation.
- Return type:
None