Added base agent
This commit is contained in:
41
sia/io_buffer.py
Normal file
41
sia/io_buffer.py
Normal 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
|
||||
Reference in New Issue
Block a user