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.
Agents
Create an AI agent with a system prompt, tools, and memory. Route examples below use the default app router. Veryfront Code also supports mounting the same handlers underpages/api/** when router: "pages" is enabled.
For the normal path, omit model. Veryfront Code uses runtime conventions:
local inference by default, and Veryfront Cloud defaults when
VERYFRONT_API_TOKEN plus project context are available.
Prerequisites
- A Veryfront project running locally (see Quickstart).
- A provider configured for inference (see Providers).
- The
agents/directory exists. If you customisedai.agents.discovery.pathsin Configuration, use that directory instead.
Define an agent
Create a file inagents/:
id is how you reference the agent later with getAgent("assistant").
You can also define an agent with markdown when the agent only needs persona, model, and step configuration:
agents/support.md registers support and can be invoked through the same project runtime and control-plane surfaces as agents/support.ts.
Add tools
Agents call tools to take actions or fetch data. Reference tools by name: the framework resolves them from thetools/ directory:
maxSteps limits how many tool-call iterations the agent can perform per request. See Tools for how to define getWeather.
Enable skills
Skills are reusable instruction packs discovered from your project’sskills/ directory.
skills is enabled, the runtime automatically registers these skill tools:
load-skillload-skill-referenceexecute-skill-script
skills/ conventions and Configuration for discovery paths.
Skill execution flow
For skill-aware agents, the recommended flow is:- Call
load-skill({ skillId })to load the skill instructions and policy. - Optionally call
load-skill-reference(...)to read files fromreferences/orassets/. - Optionally call
execute-skill-script(...)to run scripts fromscripts/. - Continue with normal tool calls under the active skill policy.
load-skill when both are emitted in the same step.
Skill script execution
Skill scripts run in one of two modes, selected automatically:- Local (development): When no Veryfront Cloud sandbox credentials are available, scripts run as direct subprocesses on your machine via
runCommand(). No remote sandbox is needed. - Cloud (production): When
SANDBOX_AUTH_TOKEN,VERYFRONT_API_TOKEN, or request-scoped Veryfront credentials are available, scripts are uploaded to and executed inside a remote sandbox session.
Skill safety model
allowed-toolsinSKILL.mdis enforced at planning time and execution time (fail-closed).- Skill file reads are restricted to the skill root and allowed subdirectories.
- Symlinked paths are rejected for skill file access.
- Script execution timeout defaults to
60000ms and is capped at300000ms.
Connect to a route
UsecreateAgUiHandler() to expose a registered agent through an AG-UI stream:
useChat({ api: "/api/ag-ui" }) in browser UI code. If the route returns Agent not found, ensure the agent file is in agents/ and its id matches the value passed to createAgUiHandler().
Non-streaming response
For server-side generation (e.g., ingetServerData), use generate():
Dynamic system prompts
Thesystem property accepts a string, a function, or an async function:
resolveRuntimeState instead of relying on system() to run again mid-turn.
Agent configuration
| Property | Type | Description |
|---|---|---|
id | string | Unique identifier used with getAgent() |
name | string | Human-readable display name for listings |
description | string | Optional summary for listings |
model | string | Optional provider/model override. Omit or use "auto" for runtime defaults. |
system | string | () => string | Promise<string> | System prompt |
resolveRuntimeState | (request: RuntimeStateRequest) => ResolvedRuntimeState | Promise<ResolvedRuntimeState | undefined> | Refresh system/context before later model steps in the same run |
tools | Record<string, boolean | Tool> | Tools the agent can use |
maxSteps | number | Max tool-call iterations per request |
memory | MemoryConfig | Conversation memory settings |
streaming | boolean | Enable streaming (default: true) |
middleware | AgentMiddleware[] | Execution middleware |
allowedModels | string[] | Restrict runtime model overrides to these provider/model strings |
skills | true | string[] | Enable all skills (true) or only specific skill IDs |
Verify it worked
Save the agent file, restartveryfront dev, and hit the AG-UI route:
RunFinished event.
If the response is 404, the AG-UI route file is missing; if it is 500,
check the dev-server log for the agent registration or provider error.
Next
- Agent service runtime: run agents as separate services
- Tools: define the tools your agent calls
- Memory and streaming: add conversation memory
Related
veryfront/agent: agent API reference