"""
{{ name|capitalize }} agent definition
"""
from __future__ import annotations

import os
from evenage import Agent
from evenage.llms import gemini, openai

{% if is_coordinator %}# Coordinator-specific tool (placeholder)
from tools.communication_tools import delegate_task  # noqa: F401
TOOLS = [delegate_task]
{% else %}# Example web tools
from tools.web_tools import web_search, scrape_url, extract_links  # noqa: F401
TOOLS = [web_search, scrape_url, extract_links]
{% endif %}

{{ name }} = Agent(
    name="{{ name }}",
    role="{{ role }}",
    goal="{{ goal }}",
    backstory="""{{ backstory }}""",
    llm=gemini(
        model=os.getenv("{{ model_env }}", "{{ model }}"),
        temperature={{ temperature }}
    ),
    llm_fallbacks=[
        openai(model=os.getenv("{{ fallback_model_env }}", "{{ fallback_model }}"))
    ],
    tools=TOOLS,
    {% if is_coordinator %}is_coordinator=True,
    available_agents={{ available_agents }},
    {% endif %}max_retries={{ max_retries }},
    timeout={{ timeout }},
    instructions="""
{{ instructions }}
    """,
    # Artifact retrieval guidance:
    # - When delegating with wait_for_response=True, the 'response' typically contains the full result inline.
    # - Only use artifact retrieval tools when the response explicitly indicates data was stored and provides
    #   an artifact reference (e.g., artifact_id or bucket/key).
    # Tracing control: set trace_enabled=False to disable all traces for this agent
    # or use trace_mask to exclude specific event types like ["llm_call", "tool_result"]
    trace_enabled=True,
    trace_mask=[],  # Example: ["llm_call"] to skip LLM traces
)

