Documentation Index
Fetch the complete documentation index at: https://veryfront.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Create an agent
Define an AI agent in a fresh Veryfront project, send it a message, and read back the response. This guide is the smallest end-to-end agent you can build with Veryfront; deeper topics — tools, memory, skills, hosting, streaming — live in Agents and the AI guides that follow it.Prerequisites
- Veryfront installed and a project created with Quickstart. The
ai-agenttemplate gives you the file layout below by default. - An
agents/directory in the project root. If you started from theminimaltemplate, create one:mkdir agents. - A provider configured for inference. The simplest path is to set
OPENAI_API_KEYorANTHROPIC_API_KEYin.env; the framework picks the matching provider automatically. See Providers for other options.
Define the agent
Createagents/assistant.ts:
agents/ at startup, so there is nothing else to register.
For a one-shot persona without TypeScript, you can write the same agent as agents/assistant.md:
assistant id and are interchangeable from the call sites below.
Invoke the agent
From any server-side context (an API route,getServerData, a workflow step, a CLI command), resolve the agent by id and call generate:
Request directly. If you prefer the pages router, the same route lives at pages/api/ask.ts and receives an APIContext (ctx.request.json(), ctx.json(...)); see API routes.
generate returns the full response. Use stream when you want to send chunks back over Server-Sent Events; the Memory and streaming guide covers that path.
Run it
Start the dev server:Verify it worked
You should see a JSON response whoseanswer is a short paragraph from the model. The usage object reports input and output tokens. If the dev server logs an error mentioning a missing provider, recheck that OPENAI_API_KEY (or your provider’s variable) is exported in the shell that runs veryfront dev.