34 lines
658 B
Python
34 lines
658 B
Python
|
|
"""
|
||
|
|
Base Runtime
|
||
|
|
|
||
|
|
Abstract base class for all tool runtimes.
|
||
|
|
"""
|
||
|
|
|
||
|
|
from abc import ABC, abstractmethod
|
||
|
|
from typing import Any, Dict, Optional
|
||
|
|
|
||
|
|
|
||
|
|
class BaseRuntime(ABC):
|
||
|
|
"""Runtime abstract base class"""
|
||
|
|
|
||
|
|
@abstractmethod
|
||
|
|
async def execute(
|
||
|
|
self,
|
||
|
|
entry: str,
|
||
|
|
command: str,
|
||
|
|
parameters: Dict[str, Any],
|
||
|
|
timeout: int,
|
||
|
|
) -> Dict[str, Any]:
|
||
|
|
"""Execute a tool"""
|
||
|
|
pass
|
||
|
|
|
||
|
|
@abstractmethod
|
||
|
|
async def validate(self, entry: str) -> bool:
|
||
|
|
"""Validate if the tool is available"""
|
||
|
|
pass
|
||
|
|
|
||
|
|
@abstractmethod
|
||
|
|
def get_name(self) -> str:
|
||
|
|
"""Get runtime name"""
|
||
|
|
pass
|