Files
barsic/src/homeagent/agent/base.py
T
2026-11-07 22:34:12 +03:00

32 lines
966 B
Python

"""Base agent interface for HomeAgent."""
from abc import ABC, abstractmethod
from typing import Any, Awaitable, Callable, Optional
class BaseAgent(ABC):
"""Abstract base class for all LLM agents."""
@abstractmethod
async def chat(
self,
chat_id: int,
thread_id: Optional[int],
user_message: str,
max_tool_iterations: int = 8,
on_progress: Optional[Callable[[str], Awaitable[None]]] = None,
) -> str:
"""Process user message within chat topic and execute tools as needed.
Args:
chat_id: Telegram Chat ID
thread_id: Optional Telegram Forum Topic ID
user_message: Incoming user prompt
max_tool_iterations: Safety cap on consecutive tool call loops
on_progress: Optional async callback for reporting status updates to the user
Returns:
Final markdown response text for the user
"""
pass