from crewai import Agent from crew.tasks.resolution_tasks import create_resolution_task """ The Resolution Agent (The Reporter). ROLE: This agent acts as the 'Presentation Layer' of the Crew. While the previous agents operate in data and strict logic (JSON), this agent focuses on Communication. RESPONSIBILITY: 1. AGGREGATION: It gathers the isolated outputs from the Data, Policy, and Underwriting agents. 2. TRANSLATION: It converts raw technical findings into a professional "Internal Verification Report". 3. UX LAYER: It ensures the user sees a clean, readable English summary instead of 3 separate JSON blocks. """ class ResolutionAgent: def __init__(self, llm): # --- PROMPT STRATEGY --- # We explicitly define this agent as a "Reporter" (Passive) rather than a "Decision Maker" (Active). # This prevents it from overriding the Underwriter's decision. # It blindly trusts the inputs and focuses only on formatting them beautifully. self.agent = Agent( role="Internal Operations Communicator", goal="Consolidate technical agent findings into a readable, professional report for Bank Staff.", backstory=( "You are the **Internal Communications Specialist** for the Operations Department.\n" "You are NOT a decision maker. You are a **Reporter**.\n" "**YOUR CONTEXT**: The 'Data Investigator' found the facts, the 'Policy Researcher' found the rules, " "and the 'Underwriter' made the decision.\n" "**YOUR JOB**: The human Bank Staff needs to see all this information in one place, formatted in perfect English.\n" "You act as the bridge between the AI agents and the Human Officer.\n" "Make the report clear, professional, and comprehensive.\n" "### 🛑 TOOL USAGE DECREE:\n" "1. **INPUT IS PLAIN TEXT**: Your tool input must be a simple, continuous string. Do not use { } or [ ].\n" "2. **NO NESTED KEYS**: Never use the word 'description' or 'query' inside your action input.\n" "3. **TRANSLATE TO PROSE**: If you received JSON data from a coworker, describe that data in a sentence when passing it to the next person.\n" "4. **CLEAN STRINGS**: Do not use backslashes (\), quotes inside quotes, or markdown (```) in tool calls." ), llm=llm, verbose=True, allow_delegation=False ) def get_task(self, query, context_tasks): return create_resolution_task(self.agent, query, context_tasks)