Skip to content

Class swarmauri_core.swarm_apis.IAgentRegistrationAPI.IAgentRegistrationAPI

swarmauri_core.swarm_apis.IAgentRegistrationAPI.IAgentRegistrationAPI

Bases: ABC

Interface for registering agents with the swarm, designed to support CRUD operations on IAgent instances.

register_agent abstractmethod

register_agent(agent)

Register a new agent with the swarm.

PARAMETER DESCRIPTION
agent

An instance of IAgent representing the agent to register.

TYPE: IAgent

RETURNS DESCRIPTION
bool

True if the registration succeeded; False otherwise.

TYPE: bool

Source code in swarmauri_core/swarm_apis/IAgentRegistrationAPI.py
11
12
13
14
15
16
17
18
19
20
21
22
@abstractmethod
def register_agent(self, agent: IAgent) -> bool:
    """
    Register a new agent with the swarm.

    Parameters:
        agent (IAgent): An instance of IAgent representing the agent to register.

    Returns:
        bool: True if the registration succeeded; False otherwise.
    """
    pass

update_agent abstractmethod

update_agent(agent_id, updated_agent)

Update the details of an existing agent. This could include changing the agent's configuration, task assignment, or any other mutable attribute.

PARAMETER DESCRIPTION
agent_id

The unique identifier for the agent.

TYPE: str

updated_agent

An updated IAgent instance to replace the existing one.

TYPE: IAgent

RETURNS DESCRIPTION
bool

True if the update was successful; False otherwise.

TYPE: bool

Source code in swarmauri_core/swarm_apis/IAgentRegistrationAPI.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
@abstractmethod
def update_agent(self, agent_id: str, updated_agent: IAgent) -> bool:
    """
    Update the details of an existing agent. This could include changing the agent's configuration,
    task assignment, or any other mutable attribute.

    Parameters:
        agent_id (str): The unique identifier for the agent.
        updated_agent (IAgent): An updated IAgent instance to replace the existing one.

    Returns:
        bool: True if the update was successful; False otherwise.
    """
    pass

remove_agent abstractmethod

remove_agent(agent_id)

Remove an agent from the swarm based on its unique identifier.

PARAMETER DESCRIPTION
agent_id

The unique identifier for the agent to be removed.

TYPE: str

RETURNS DESCRIPTION
bool

True if the removal was successful; False otherwise.

TYPE: bool

Source code in swarmauri_core/swarm_apis/IAgentRegistrationAPI.py
39
40
41
42
43
44
45
46
47
48
49
50
@abstractmethod
def remove_agent(self, agent_id: str) -> bool:
    """
    Remove an agent from the swarm based on its unique identifier.

    Parameters:
        agent_id (str): The unique identifier for the agent to be removed.

    Returns:
        bool: True if the removal was successful; False otherwise.
    """
    pass

get_agent abstractmethod

get_agent(agent_id)

Retrieve an agent's instance from its unique identifier.

PARAMETER DESCRIPTION
agent_id

The unique identifier for the agent of interest.

TYPE: str

RETURNS DESCRIPTION
Optional[IAgent]

Optional[IAgent]: The IAgent instance if found; None otherwise.

Source code in swarmauri_core/swarm_apis/IAgentRegistrationAPI.py
52
53
54
55
56
57
58
59
60
61
62
63
@abstractmethod
def get_agent(self, agent_id: str) -> Optional[IAgent]:
    """
    Retrieve an agent's instance from its unique identifier.

    Parameters:
        agent_id (str): The unique identifier for the agent of interest.

    Returns:
        Optional[IAgent]: The IAgent instance if found; None otherwise.
    """
    pass

list_agents abstractmethod

list_agents()

List all registered agents.

RETURNS DESCRIPTION
List[IAgent]

List[IAgent]: A list containing instances of all registered IAgents.

Source code in swarmauri_core/swarm_apis/IAgentRegistrationAPI.py
65
66
67
68
69
70
71
72
73
@abstractmethod
def list_agents(self) -> List[IAgent]:
    """
    List all registered agents.

    Returns:
        List[IAgent]: A list containing instances of all registered IAgents.
    """
    pass