agents/ that exports a system prompt, optional tools,
optional memory, and optional skills. The runtime auto-discovers it on startup
and exposes it via getAgent(id) or a route created with createAgUiHandler().
For the normal path, omit model and let runtime conventions choose: local
inference by default, Veryfront Cloud when VERYFRONT_API_TOKEN plus project
context are set.
Prerequisites
- A Veryfront project running locally (see Create project).
- 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 provider tools
Provider tools are executed by the selected model provider. They are not local tools and they are not MCP tools.Connect MCP servers
UsemcpServers for remote MCP-compatible tool servers. Put visibility policy
on the server that owns the tools. When tools is an explicit object, include
the remote MCP tool name in tools and authorize it with the server
toolPolicy.
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 flow is:- Call
load_skill({ skillId })to load the skill instructions and policy. - Optionally call
load_skill_reference(...)to read files fromreferences/,resources/, 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:
references/,resources/,assets/, andscripts/. - Symlinked paths are rejected for skill file access.
- Script execution timeout defaults to
60000ms and is capped at300000ms.
Connect to a route
Expose a registered agent throughcreateAgUiHandler() when a browser or
external client needs AG-UI streaming.
Use Create agent for the copyable
quick-start route. Use Chat UI to pair that route with
useChat().
If a 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 |
providerTools | string[] | Provider-executed tools such as web_search |
mcpServers | AgentMcpServerConfig[] | Remote MCP-compatible tool servers |
skills | true | string[] | Enable all skills (true) or selected skill IDs |
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 |
Verify it worked
Save the agent file, restartveryfront dev, and invoke it from server code:
RunFinished event.