// Backend app for the {{projectName}} project. Read by `voltro dev`. // // This is the AI template: a RAG support agent over a docs knowledge // base. It demonstrates the framework's AI surface end-to-end — // `vectorEmbedding()` auto-embedding on the `docs` table, a `defineTool` // the agent calls to retrieve docs, a real `defineAgent` / // `defineAgentExecutor` model loop, and a `generateObject` action for // structured output. // // `store: 'memory'` is the dev-friendly default — fast startup, no // docker. The app BOOTS and DISCOVERS every primitive with zero infra // and zero AI key. To actually RUN the agent / the summarize action you // need a provider key (see README): AI_PROVIDER / AI_MODEL + the // provider's key var (OPENAI_API_KEY / ANTHROPIC_API_KEY / …). // // NOTE on memory store: the `vector` column is stored but ANN falls back // to a sequential scan (correct, just unindexed). Switch to `'postgres'` // for a real pgvector HNSW index. import { defineEnv, envVar } from '@voltro/env' // Typed environment — declare your env once; it's validated at boot (fail-fast) // and read on the server via `serverEnv` / `getSecret` from '@voltro/env/server'. // `access` is required: 'public' (browser-safe) or 'secret' (server-only, never // bundled). Run `voltro env` to see the manifest. See the Environment docs. // // The AI provider is read by `@voltro/ai` from the standard env vars // below. They're declared here purely so they show up in `voltro env` // and `.env.example`; `@voltro/ai` reads its own values at call time. // All optional — the app boots without them; only RUNNING the model needs them. export const env = defineEnv({ LOG_LEVEL: envVar.enum(['debug', 'info', 'warn', 'error'], { access: 'public', default: 'info' }), AI_PROVIDER: envVar.string({ access: 'public', optional: true, description: "AI provider id, e.g. 'openai' | 'anthropic'. Falls back to the @voltro/ai default.", example: 'openai', }), AI_MODEL: envVar.string({ access: 'public', optional: true, description: "Model id, e.g. 'gpt-4o-mini' | 'claude-3-5-haiku-latest'.", example: 'gpt-4o-mini', }), AI_API_KEY: envVar.string({ access: 'secret', optional: true, description: "Provider API key. @voltro/ai also accepts the provider-standard var (OPENAI_API_KEY / ANTHROPIC_API_KEY).", }), }) export default { type: 'api' as const, name: '{{capProjectName}}{{capAppName}}', store: 'memory' as const, env, }