veryfront serve
runtime instead. That runtime discovers all project agents and tools, then routes
each signed control-plane request by agentId. Projects on a managed dedicated
server do not require a service.ts entrypoint. Add one only when you
intentionally run the standalone Agent Service process described in this guide.
Prerequisites
- At least one agent in
agents/that the service should expose (see Agents). - A deployment target you can run a long-running Node process on.
- For Veryfront Cloud registration:
VERYFRONT_API_TOKEN,VERYFRONT_PROJECT_IDorVERYFRONT_PROJECT_SLUG, and a publicly reachableVERYFRONT_AGENT_SERVICE_URL. See Configuration for the full list. - Immutable deployment metadata for
runtimeSourcewhen the control plane invokes the service.
Create a service entrypoint
Create a process entrypoint that starts the default Veryfront Cloud agent service runtime:startNodeVeryfrontCloudAgentService() starts the runtime from the environment
that is already loaded. It does not load local .env files or initialize
process-wide telemetry. Load standalone service environment files through the
trusted deployment wrapper before it imports service.ts. Project modules
cannot mutate the shared process environment through the public agent API.
Initialize service-level OpenTelemetry in the trusted deployment wrapper before
it loads service.ts. Do not let project code select process-wide exporters,
trace hooks, or application-error reporters. The framework-owned
veryfront serve runtime owns this setup on shared and managed dedicated
servers.
The service discovers the same project primitives as the app runtime:
agents/tools/skills/resources/prompts/workflows/tasks/
/api/runs requests. Pass agentId when the service exposes
multiple agents and direct requests need a predictable default.
Keep agent behavior in project files
Define the agent inagents/ and keep service startup separate from agent
behavior:
veryfront.config.ts under ai.<primitive>.discovery.paths.
Configure registration
Control-plane registration is convention-first. Inauto mode, the service
registers only when VERYFRONT_API_TOKEN and
VERYFRONT_AGENT_SERVICE_URL are present. Registration also requires the
immutable runtimeSource binding described below.
VERYFRONT_AGENT_SERVICE_REGISTRATION=enabled when startup must fail if the
service cannot register. Use disabled when the service must run without
control-plane registration.
The service name resolves from VERYFRONT_AGENT_SERVICE_NAME, then the nearest
package.json or deno.json name, then veryfront-agent-service. Pass
serviceName only when code should override that convention.
Bind control-plane runs to the deployed source
A standalone agent service discovers one local project snapshot at startup. It cannot select another project branch or release for an individual request. Bind the service to deployment-owned immutable metadata when it accepts signed control-plane runtime invocations:agentSource
exactly matches runtimeSource. An unbound service returns
CONTROL_PLANE_AGENT_SOURCE_UNBOUND. A different release or environment
returns CONTROL_PLANE_AGENT_SOURCE_MISMATCH. Branch sources are mutable and
return CONTROL_PLANE_AGENT_SOURCE_UNSUPPORTED.
Do not resolve runtimeSource from the latest deployment at request time. Pass
the environment and release identifiers that produced the running service
artifact. Direct /api/runs requests do not select project source and do not
require this binding.
Add remote MCP tools
UsemcpServers when the service needs remote tools. Use
veryfrontApiMcpServer() and veryfrontStudioMcpServer() for
Veryfront-owned control-plane MCP servers and normal MCP server config objects
for third-party servers.
This service startup config uses endpoint and headers. Per-agent config in
agent({ mcpServers }) uses transport, auth, and toolPolicy.
mcpServers is omitted, the Veryfront Cloud preset includes
veryfrontApiMcpServer() by default. Pass mcpServers: [] to run without
remote MCP tools.
Reach trusted deployment-local MCP servers
The default remote MCP source uses guarded outbound networking. Keep that default for third-party, request-derived, and tenant-configured endpoints. A separately deployed agent service may need to reach a trusted MCP server on a private cluster address. In that case, capture the host transport and the exact allowed endpoints once at startup. Use the host transport only for those immutable endpoints and preserve the guarded source for everything else:http: is
appropriate only for private deployment-local networking; use https: for
public networks. Never put a callback endpoint or a per-request URL in the
trusted endpoint list.
Refresh runtime state
UseresolveRuntimeState when a long-lived service run must refresh
instructions, context, or available tools at a model step boundary.
fetchDefaultAgentServiceProjectSteering() for the initial fetch and
createDefaultAgentServiceProjectSteeringRefresh() for step-boundary refresh.
Keep inference authority separate
Signed runtime invocations may include an optionalcredentials.inferenceAuthToken alongside the broader
credentials.authToken. The inference credential is bound to the exact run and
agent and is intended only for attributed Veryfront Cloud model requests. It is
size-bounded to 16 KB, uses visible ASCII token characters, and remains optional
so existing producers and consumers stay compatible.
Treat this as trusted-host authority. Do not copy it into project context,
tools, logs, durable request payloads, or a general API client. Framework-managed
agent services bind it only after the signed invocation and run-event credential
have been verified, bypass project model overrides for Veryfront Cloud models,
and send it only to an HTTPS (or loopback development) gateway. Custom runtime
adapters should follow the same boundary: use authToken for project and
control-plane operations, and expose inferenceAuthToken only to the model
subprocess’s Veryfront Cloud gateway configuration.
Use lower-level helpers
UsestartNodeVeryfrontCloudAgentService() for the standard service shape.
Use lower-level helpers only when the service needs a custom server adapter,
custom execution preparation, or custom infrastructure.
Migrate custom durable child event writers
This migration applies to custom hosted runtimes that call the lower-level durable child helpers. Framework-managedstartNodeVeryfrontCloudAgentService() runtimes create and scope writer
capabilities internally.
Raw authToken, apiUrl, and runEventAppendToken fields no longer grant
durable child event-writer authority. The parsed hosted request also excludes
the writer credential. Keep the credential inside trusted ingress and replace
the removed fields with an opaque HostedRunEventWriterCapability.
Apply the change at every integration point your custom runtime implements:
The generated
veryfront/agent reference
lists the complete properties for these contracts.
-
After trusted ingress verifies an exact root-run append credential, create
the root capability. Do not pass a general user API token.
-
Pass that exact-parent capability to helpers that own child persistence and
capability delegation. Do not pre-mint for these helpers.
-
For lower-level helpers that receive an already-persisted
durableChildRun, mint and pass an exact-child capability: -
Update detached starter callbacks to accept the isolated request:
Verify it worked
Start the service entrypoint and call the run route directly. The default port is3001; override with PORT if needed.
VERYFRONT_AGENT_SERVICE_HEARTBEAT_INTERVAL_MS).