swarmauri.core.swarm_apis.IAgentRegistrationAPI module

class swarmauri.core.swarm_apis.IAgentRegistrationAPI.IAgentRegistrationAPI[source]

Bases: ABC

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

abstract get_agent(agent_id)[source]

Retrieve an agent’s instance from its unique identifier.

Parameters:

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

Returns:

The IAgent instance if found; None otherwise.

Return type:

Optional[IAgent]

abstract list_agents()[source]

List all registered agents.

Returns:

A list containing instances of all registered IAgents.

Return type:

List[IAgent]

abstract register_agent(agent)[source]

Register a new agent with the swarm.

Parameters:

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

Returns:

True if the registration succeeded; False otherwise.

Return type:

bool

abstract remove_agent(agent_id)[source]

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:

True if the removal was successful; False otherwise.

Return type:

bool

abstract update_agent(agent_id, updated_agent)[source]

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:

True if the update was successful; False otherwise.

Return type:

bool