Skip to main content

BaseToolkit

class BaseToolkit:
Base class for toolkits. Parameters:
  • timeout (Optional[float]): The timeout for the toolkit.

init

def __init__(self, timeout: Optional[float] = Constants.TIMEOUT_THRESHOLD):

init_subclass

def __init_subclass__(cls, **kwargs):

get_tools

def get_tools(self):
Returns: List[FunctionTool]: A list of FunctionTool objects representing the functions in the toolkit.

run_mcp_server

def run_mcp_server(self, mode: Literal['stdio', 'sse', 'streamable-http']):
Run the MCP server in the specified mode. Parameters:
  • mode (Literal["stdio", "sse", "streamable-http"]): The mode to run the MCP server in.

RegisteredAgentToolkit

class RegisteredAgentToolkit:
Mixin class for toolkits that need to register a ChatAgent. This mixin provides a standard interface for toolkits that require a reference to a ChatAgent instance. The ChatAgent will check if a toolkit has this mixin and automatically register itself.

init

def __init__(self):

agent

def agent(self):
Returns: Optional[ChatAgent]: The registered agent, or None if not registered. Note: If None is returned, it means the toolkit has not been registered with a ChatAgent yet. Make sure to pass this toolkit to a ChatAgent via the toolkits parameter during initialization.

register_agent

def register_agent(self, agent: 'ChatAgent'):
Register a ChatAgent with this toolkit. This method allows registering an agent after initialization. The ChatAgent will automatically call this method if the toolkit to register inherits from RegisteredAgentToolkit. Parameters:
  • agent (ChatAgent): The ChatAgent instance to register.