Full-stack Amazon AI Transcreation Platform with: - FastAPI backend (async, PostgreSQL, Redis, Celery) with 11 DB tables - JWT auth (SSO-ready abstract provider pattern) - 6-agent pipeline orchestrator with deterministic modules - Next.js 14 frontend with Amazon branding (Ember fonts, orange/dark theme) - Job wizard, monitoring HUD, output review, admin screens - 154 TM/reference files imported, 12 locales configured - Docker Compose for all services Agents 2-5 (TM retrieval, ranker, transcreator, compliance) are stubs pending Phase 3 LLM integration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
62 lines
1.8 KiB
Python
62 lines
1.8 KiB
Python
"""Base agent abstract class for the transcreation pipeline."""
|
|
|
|
from abc import ABC, abstractmethod
|
|
from typing import Any
|
|
|
|
from app.pipeline.contracts import PipelineContext
|
|
|
|
|
|
class BaseAgent(ABC):
|
|
"""Abstract base class for pipeline agents.
|
|
|
|
Each agent in the pipeline implements this interface:
|
|
1. get_system_prompt() - Returns the system prompt for the LLM
|
|
2. build_user_message() - Builds the user message from pipeline context
|
|
3. parse_response() - Parses the LLM response into structured data
|
|
4. run() - Orchestrates the agent's execution
|
|
"""
|
|
|
|
name: str = "base_agent"
|
|
description: str = ""
|
|
|
|
@abstractmethod
|
|
def get_system_prompt(self) -> str:
|
|
"""Return the system prompt for this agent's LLM call."""
|
|
...
|
|
|
|
@abstractmethod
|
|
def build_user_message(self, context: PipelineContext) -> str:
|
|
"""Build the user message from pipeline context.
|
|
|
|
Args:
|
|
context: The current pipeline context.
|
|
|
|
Returns:
|
|
The user message string to send to the LLM.
|
|
"""
|
|
...
|
|
|
|
@abstractmethod
|
|
def parse_response(self, response: str, context: PipelineContext) -> Any:
|
|
"""Parse the LLM response into structured data.
|
|
|
|
Args:
|
|
response: The raw LLM response text.
|
|
context: The current pipeline context.
|
|
|
|
Returns:
|
|
Structured data appropriate for this agent's output.
|
|
"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def run(self, context: PipelineContext) -> PipelineContext:
|
|
"""Execute this agent and return the updated pipeline context.
|
|
|
|
Args:
|
|
context: The current pipeline context.
|
|
|
|
Returns:
|
|
Updated pipeline context with this agent's results.
|
|
"""
|
|
...
|