Skip to content

Class swarmauri_core.agent_apis.IAgentCommands.IAgentCommands

swarmauri_core.agent_apis.IAgentCommands.IAgentCommands

Bases: ABC

Interface for the API object that enables a SwarmAgent to host various API routes.

invoke abstractmethod

invoke(request)

Handles invocation requests synchronously.

PARAMETER DESCRIPTION
request

The incoming request payload.

TYPE: Any

RETURNS DESCRIPTION
Any

The response payload.

TYPE: Any

Source code in swarmauri_core/agent_apis/IAgentCommands.py
10
11
12
13
14
15
16
17
18
19
20
21
@abstractmethod
def invoke(self, request: Any) -> Any:
    """
    Handles invocation requests synchronously.

    Parameters:
        request (Any): The incoming request payload.

    Returns:
        Any: The response payload.
    """
    pass

ainvoke abstractmethod async

ainvoke(request)

Handles invocation requests asynchronously.

PARAMETER DESCRIPTION
request

The incoming request payload.

TYPE: Any

RETURNS DESCRIPTION
Any

The response payload.

TYPE: Any

Source code in swarmauri_core/agent_apis/IAgentCommands.py
23
24
25
26
27
28
29
30
31
32
33
34
@abstractmethod
async def ainvoke(self, request: Any) -> Any:
    """
    Handles invocation requests asynchronously.

    Parameters:
        request (Any): The incoming request payload.

    Returns:
        Any: The response payload.
    """
    pass

batch abstractmethod

batch(requests)

Handles batched invocation requests synchronously.

PARAMETER DESCRIPTION
requests

A list of incoming request payloads.

TYPE: List[Any]

RETURNS DESCRIPTION
List[Any]

List[Any]: A list of responses.

Source code in swarmauri_core/agent_apis/IAgentCommands.py
36
37
38
39
40
41
42
43
44
45
46
47
@abstractmethod
def batch(self, requests: List[Any]) -> List[Any]:
    """
    Handles batched invocation requests synchronously.

    Parameters:
        requests (List[Any]): A list of incoming request payloads.

    Returns:
        List[Any]: A list of responses.
    """
    pass

abatch abstractmethod async

abatch(requests)

Handles batched invocation requests asynchronously.

PARAMETER DESCRIPTION
requests

A list of incoming request payloads.

TYPE: List[Any]

RETURNS DESCRIPTION
List[Any]

List[Any]: A list of responses.

Source code in swarmauri_core/agent_apis/IAgentCommands.py
49
50
51
52
53
54
55
56
57
58
59
60
@abstractmethod
async def abatch(self, requests: List[Any]) -> List[Any]:
    """
    Handles batched invocation requests asynchronously.

    Parameters:
        requests (List[Any]): A list of incoming request payloads.

    Returns:
        List[Any]: A list of responses.
    """
    pass

stream abstractmethod

stream(request)

Handles streaming requests.

PARAMETER DESCRIPTION
request

The incoming request payload.

TYPE: Any

RETURNS DESCRIPTION
Any

A streaming response.

TYPE: Any

Source code in swarmauri_core/agent_apis/IAgentCommands.py
62
63
64
65
66
67
68
69
70
71
72
73
@abstractmethod
def stream(self, request: Any) -> Any:
    """
    Handles streaming requests.

    Parameters:
        request (Any): The incoming request payload.

    Returns:
        Any: A streaming response.
    """
    pass

get_schema_config abstractmethod

get_schema_config()

Retrieves the schema configuration for the API.

RETURNS DESCRIPTION
dict

The schema configuration.

TYPE: dict

Source code in swarmauri_core/agent_apis/IAgentCommands.py
75
76
77
78
79
80
81
82
83
@abstractmethod
def get_schema_config(self) -> dict:
    """
    Retrieves the schema configuration for the API.

    Returns:
        dict: The schema configuration.
    """
    pass