"""BaseAgent — abstract agent interface for CogniGraph nodes."""

from __future__ import annotations

from abc import ABC, abstractmethod
from typing import Any

from cognigraph.core.message import Message
from cognigraph.core.types import ModelBackend


class BaseAgent(ABC):
    """Abstract base class for node agents.

    Agents wrap model backends with domain-specific behavior.
    The simplest agent just forwards to the backend, but specialized
    agents can add tool use, structured output, or custom reasoning.
    """

    def __init__(self, backend: ModelBackend, **kwargs: Any) -> None:
        self.backend = backend

    @abstractmethod
    async def reason(
        self, query: str, context: list[Message], node_info: dict[str, Any]
    ) -> str:
        """Produce reasoning given query, neighbor messages, and node metadata."""
        ...

    @property
    def name(self) -> str:
        return self.__class__.__name__
