from abc import ABC, abstractmethod from integrations.anthropic_client import AnthropicClient class BaseAgent(ABC): MARKDOWN_INSTRUCTIONS = ( "CRITICAL FORMATTING RULES:\n" "1. DATA PRESENTATION:\n" " - For SMALL datasets (2-3 rows/items) or simple summaries: Use a BULLETED LIST.\n" " - For LARGE datasets (4+ rows) or complex comparisons: Use a MARKDOWN TABLE.\n" "2. TABLE RULES (when used):\n" " - Include a BLANK LINE before and after every table.\n" " - Mandatory alignment row: MUST match the header column count (e.g., |---|---| for 2 columns).\n" " - One row per line. Never omit the | separators.\n" " - STRICTLY START A NEW LINE for each table row. Do not put multiple rows on the same line.\n" " - Ensure column counts match exactly between header and rows.\n" " - FORCE newlines between rows. Do not use '||' as a separator.\n" " - DO NOT use code blocks for tables. Use standard Markdown tables.\n" "3. Headers: Use ## and ### for sections.\n" "4. Clarity: Bold all key metrics and final recommendations." ) def __init__(self, client: AnthropicClient): self._client = client @property @abstractmethod def name(self) -> str: ... @property @abstractmethod def system_prompt(self) -> str: ... @abstractmethod def analyze(self, metrics: dict, extra_context: str = "") -> str: ...