π€AI Workers
from abc import ABC, abstractmethod
class AIWorker(ABC):
"""Base interface for all marketplace agents.
Defines the core lifecycle and interaction methods for AI workers.
"""
@abstractmethod
def start(self) -> None:
"""Initialize the agent and its required resources.
- Load models/configurations
- Establish service connections
- Initialize internal state
- Allocate resources
"""
@abstractmethod
def stop(self) -> None:
"""Cleanup and release resources.
- Close connections
- Free memory/compute resources
- Save persistent state
- Perform general cleanup
"""
@abstractmethod
def call(self, message: str) -> str:
"""Process an input message and return a response.
Args:
message: Input message/query.
Returns:
str: Agent's response.
"""Worker Templates
Last updated