Resources
Env files and template resources attached to an integration.
Resources are files an integration imports alongside its config: .env-convention files that feed the environment, and template files that flows render. Declared under resources:, they load when the config loads, so a missing or malformed file fails at deployment.
Declaring resources
env:
- name: GREETING
required: true # supplied by the .env.dev resource below
resources:
env:
- .env.dev # merged into the runtime environment
templates:
- resource: templates/welcome.tmpl
as: welcome # short alias for blocks and CELResource paths resolve relative to the config directory.
Env resources
resources.env lists .env-convention files (KEY=VALUE lines, # comments) combined into the runtime environment in order: a later file overlays an earlier one, and all overlay the built-in ./.env chain. A missing env resource is skipped silently; a required variable it was supposed to supply still fails the load. See Environment and Configuration for the full precedence.
GREETING=Hello from .env.devTemplate resources
resources.templates declares the template files the config renders, each named by file (resource) and optionally by a short alias (as); without an alias the template is referenced by its path. Every declared template is parsed at load time. Templates are plain text with embedded {{ CEL }} expressions evaluated against the current message, with body, vars, env, and now available:
{{ env.GREETING }}, {{ body.name }}!A span is ordinary CEL, so every custom function works inside one, including templateResource, which lets a template pull in another:
{{ templateResource("header") }}
<p>{{ toJson(body) }}</p>Nesting is capped at 8 levels, so a template that renders itself fails with a clear error.
Rendering a template
There are two ways to render a declared template.
The template-resource block
The block renders a template against the current message and writes the result to a variable (target) or, when target is empty, to the message body:
flows:
- name: greet
process:
- type: template-resource
settings:
id: welcome # the `as` alias (or the resource path)
target: rendered # write to vars.rendered; empty replaces the bodyFor non-JSON output (HTML, XML, CSV) set rawBody: true and a contentType. The rendered text becomes a raw-content body {contentType, rawData}, which the HTTP source serves with that Content-Type instead of JSON:
resources:
templates:
- resource: templates/page.tmpl
as: page
flows:
- name: page
source:
connector: api
type: http
settings:
path: /page/{name} # {name} -> vars.name
process:
- type: template-resource
settings:
id: page
rawBody: true
contentType: text/html; charset=utf-8rawBody applies to the body only: when it is set, contentType is required and target must be empty.
The templateResource() CEL function
Inside any expression, templateResource("alias") renders the template against the current message and returns the text, for when the rendered string is one piece of a larger value:
- type: set-payload
settings:
value: |
{
"viaBlock": vars.rendered,
"viaCel": templateResource("welcome")
}Pick the block when the rendered text is the output, and the function when composing it into something else.
Where templates show up next
An ai-agent's skills and an mcp-router's resources and prompts are also declared template resources. On the platform, resources are managed per integration; see Resources and Secrets.