File size: 1,479 Bytes
9fbb3f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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: ...