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.
Chat UI
UseChat when you want a complete chat interface with one component. Use this guide for the preset path. Use Chat composition when you need layout control, Chat hooks when you need headless state, and Chat theming when you need visual customization.
Route examples below use the default app router. Veryfront Code also supports mounting the same handlers under pages/api/** when router: "pages" is enabled.
Prerequisites
- A Veryfront project with the
agents/directory available (see Quickstart). - A configured provider (see Providers).
Quick setup
In an app-owned route, create the agent and route below. In a Veryfront-hosted Studio context, the host can provide the AG-UI route and request-scoped runtime context, so you usually only configure the client that points at that route. Create an agent:createAgUiHandler validates the request and streams AG-UI SSE. useChat({ api: "/api/ag-ui" }) decodes that stream into Veryfront chat messages. The Chat component renders the input, message list, loading state, and scroll behavior.
Run veryfront dev, open http://localhost:3000, and send a message. To test the route without the UI:
Add request preprocessing
UsebeforeStream on createAgUiHandler when the route needs to add context, enforce authorization, or short-circuit a request before the agent runs:
useChat({ api: "/api/ag-ui" }) client setup. Veryfront wraps untrusted system-role messages returned from beforeStream before they reach the agent, so retrieved documents are treated as reference data rather than instructions.
Common preset props
Verify it worked
Runveryfront dev and open the page that renders Chat. Type a message
and submit:
- The composer should clear and a placeholder assistant message should appear with a typing indicator.
- Tokens should stream in. The final message should be a non-empty assistant reply.
- If you set
suggestions, clicking a suggestion should populate the input.
/api/ag-ui.
Next
- Chat composition: build a custom layout with
Chat.Rootand child components - Chat hooks: use
useChat,useAgent, anduseCompletion - Chat theming: customize themes, contexts, and visual behavior
Related
veryfront/chat: chat referenceveryfront/agent: agent API referenceveryfront/markdown: markdown rendering helpers