Added base agent

This commit is contained in:
2024-11-01 16:27:56 +01:00
parent a95c9676b4
commit f48b87f037
8 changed files with 322 additions and 62 deletions

41
sia/io_buffer.py Normal file
View File

@@ -0,0 +1,41 @@
from abc import ABC, abstractmethod
class IOBuffer(ABC):
"""
Abstract base class defining the interface for input/output operations.
This interface allows for different implementations of IO handling,
such as direct system IO or buffered web interface communication.
"""
@abstractmethod
def read(self) -> str:
"""
Read and return available input.
Should clear the input buffer after reading.
Returns:
str: Content from input buffer, or empty string if no input available
"""
pass
@abstractmethod
def write(self, content: str) -> None:
"""
Write content to output.
Args:
content: String content to write
"""
pass
@abstractmethod
def buffer_length(self) -> int:
"""
Get the current length of buffered input.
Returns:
int: Number of characters in the input buffer
"""
pass