Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/geremyjampiersalasgarcia-eng/Caso_Practico_Semillero_IA/llms.txt

Use this file to discover all available pages before exploring further.

The Policies Agent (agente_politicas) is the authority on Patito S.A.’s commercial rules. When the LangGraph classifier detects the intent politicas_comerciales, it routes the query to this agent. The agent retrieves the most relevant chunks from the col_politicas ChromaDB collection — populated from 02_Politicas_Comerciales_Descuentos_Credito.txt — builds a prompt that includes the retrieved context, and generates a structured answer that always specifies the applicable authorization level alongside every discount figure it mentions.

Agent properties

PropertyValue
nameagente_politicas
collection_namecol_politicas
system_prompt_pathbackend/app/prompts/politicas_prompt.md
Knowledge document02_Politicas_Comerciales_Descuentos_Credito.txt
Intent triggerpoliticas_comerciales

Source class

from app.agents.base_agent import BaseAgent
import os


class PoliticasAgent(BaseAgent):
    """
    Agente de Políticas Comerciales.
    Responsable de responder sobre descuentos autorizados,
    condiciones de crédito, garantías y devoluciones.
    """

    @property
    def name(self) -> str:
        return "agente_politicas"

    @property
    def description(self) -> str:
        return (
            "Responde consultas sobre descuentos autorizados, condiciones "
            "de crédito, garantías y devoluciones de Patito S.A."
        )

    @property
    def collection_name(self) -> str:
        return "col_politicas"

    @property
    def system_prompt_path(self) -> str:
        return os.path.join(
            os.path.dirname(__file__), "..", "prompts", "politicas_prompt.md"
        )
PoliticasAgent relies entirely on the BaseAgent RAG pipeline; the four abstract properties are the only required implementation.

Example queries

1. Maximum self-authorized discount
¿Qué descuento máximo puedo ofrecer a un cliente nuevo sin aprobación del gerente?
Expected answer: up to 10% — the vendor can authorize this directly. Discounts above 10% require the commercial manager’s approval. 2. Credit eligibility for new clients
¿Pueden los clientes nuevos comprar a crédito en su primera compra?
Expected answer: new clients typically pay cash on their first purchase. Credit approval requires prior evaluation and is generally extended after the first successful transaction. 3. Credit terms and payment periods
¿Qué plazos de crédito están disponibles para clientes con línea aprobada?
Expected answer: 30, 60, or 90 days, depending on the approved credit line. 4. Warranty and returns
¿Cuál es la política de garantía y devoluciones para los productos Patito?
Expected answer: standard 12-month warranty on all products; return conditions and procedures as defined in 02_Politicas_Comerciales_Descuentos_Credito.txt.

Authorization levels

The system prompt hard-codes the following discount authorization ladder, which the agent is required to state every time it discusses discounts:
Discount rangeWho can approve
Up to 10%Vendor — no additional approval needed
More than 10% up to 20%Commercial manager approval required
More than 20% up to 30%Director-level approval required
More than 30%Not permitted unless explicitly approved by the director
This ensures that vendors never over-commit on discounts without the proper sign-off chain in place.
For mixed-intent queries (intent mixta), the orchestrator runs agente_politicas in parallel alongside agente_catalogo and agente_proceso_ventas. All three produce independent partial answers, which the consolidator merges into a single coherent response. A typical mixta trigger is a question that simultaneously asks for a product price, an applicable discount, and the CRM data needed to register the opportunity — for example: “A new client wants 50 units of Patito Pro 2026 on credit with a special discount. What price, discount, and credit terms can I offer, and what do I register in the CRM?”

Build docs developers (and LLMs) love