// `support` agent — EXECUTOR (server-only).
//
// `defineAgentExecutor` binds the behaviour to the descriptor: the system
// prompt, the tools the model may call, the per-agent model, and the
// max LLM↔tool round-trips. Default-exported; the framework pairs it with
// `support.agent.tsx` by basename at boot.
//
// MODEL + KEY: we DON'T hardcode a model or key here. Omitting `model`
// makes the agent inherit the provider from env — `AI_PROVIDER` /
// `AI_MODEL` and the provider's standard key var (OPENAI_API_KEY /
// ANTHROPIC_API_KEY / AI_API_KEY). That keeps the secret server-side and
// lets the same template run against any provider via `.env`. See README.

import { defineAgentExecutor } from '@voltro/ai'
import { support } from './support.agent'
import { searchDocs } from '../tools/searchDocs.tool'

export default defineAgentExecutor(support, {
  system: (input) =>
    [
      'You are a friendly, precise support agent for this product.',
      'Answer ONLY from the knowledge base. ALWAYS call the `searchDocs`',
      'tool first to retrieve relevant docs, then answer using their',
      'content. If the docs do not cover the question, say so plainly',
      'instead of guessing.',
      `Reply in this locale: ${input.locale ?? 'en'}.`,
    ].join(' '),
  tools:    { searchDocs },
  // No `model` → inherit AI_PROVIDER / AI_MODEL + the key var from env.
  maxSteps: 6,
})
