@formio/uag-engines

中文文档
2.0.0发布于 2026/11/13MITCommonJS构建来源已验证近 30 天下载 2079

Host engine packages for the Form.io Universal Agent Gateway (UAG) in their own process, behind the remote engine protocol, so model credentials and model traffic stay out of the UAG.

原始使用文档
文档目录5 节
  1. Run it
  2. Settings
  3. Security
  4. Protocol
  5. Building the image

@formio/uag-engines

Form.io UAG › Engines › this page

Runs engine packages for the Form.io UAG in their own process, behind the remote engine protocol. The UAG reaches them with its built-in remote engine type. Model API keys and model traffic then stay in this container, and the UAG holds no model credential. Any engine package works here, unchanged.

The engine server holds no Form.io credential. The UAG never sends it one: every request carries only the engine server key. For research, the UAG adds a short-lived scoped token, and the engine server uses it to call the UAG's /mcp. The token allows only the task's read-only tools, with the caller's identity.

Run it

The formio/uag-engines image includes the official engines: jev, claude, openai, grok and gemini.

services:
  formio-uag:
    image: formio/uag
    environment:
      UAG_ENGINES: jev:remote,claude:remote
      UAG_ENGINE_JEV_URL: http://uag-engines:3300
      UAG_ENGINE_JEV_KEY: ${UAG_ENGINE_SERVER_KEY}
      UAG_ENGINE_CLAUDE_URL: http://uag-engines:3300
      UAG_ENGINE_CLAUDE_KEY: ${UAG_ENGINE_SERVER_KEY}
      JWT_SECRET: ${JWT_SECRET}            # signs the scoped tokens for research
      # ... PROJECT, keys and the rest of the UAG's settings
    depends_on:
      uag-engines:
        condition: service_healthy

  uag-engines:
    image: formio/uag-engines
    environment:
      UAG_ENGINES: jev,claude
      TYPESAFE_API_KEY: ${TYPESAFE_API_KEY}
      CLAUDE_API_KEY: ${CLAUDE_API_KEY}
      UAG_ENGINE_SERVER_KEY: ${UAG_ENGINE_SERVER_KEY}
      UAG_SERVER: http://formio-uag:3200   # where research calls /mcp
    # No published port: only the UAG, on the same private network, reaches it.

On the UAG, <name>:remote is an instance hosted here; by default it uses the engine of the same name on the engine server (UAG_ENGINE_<NAME>_ENGINE names another). Any mix works: UAG_ENGINES=jev,claude:remote keeps jev in the UAG, with its key there, and moves only Claude.

Without Docker: npm install @formio/uag-engines @formio/uag-claude, then run npx uag-engines with the same variables.

Settings

VariableMeaningDefault
UAG_ENGINE_SERVER_KEYRequired. The key every request must carry, at least 32 characters. The UAG's remote instances send it as UAG_ENGINE_<NAME>_KEY.
UAG_ENGINESThe engine instances to host, as on the UAG: jev,fast:claude,local:openai. At least one.
UAG_ENGINE_<NAME>_<SETTING> and each engine's own variablesEach instance's settings, resolved as on the UAG. See each engine's README, or The official engines.
UAG_SERVERThe UAG's URL, for research. Research calls go to ${UAG_SERVER}/mcp, never to a URL taken from a request. Must be http or https. Without it, research extracts are refused.
UAG_ENGINE_PATHAbsolute directories with more engine packages installed, such as a mounted volume.
PORT, HOSTWhere it listens. The formio/uag-engines image sets HOST=0.0.0.0.3300, 127.0.0.1
SHUTDOWN_TIMEOUTOn SIGTERM or SIGINT, how long to let requests in flight finish before exiting, in milliseconds.10000
DEBUGformio:uag:engine-server also logs each engine failure's stack. Without it, each failure is one line on stderr: the request id, the route, and the error's name, status and message, never the request.

The engine server refuses to start, printing [uag-engines] Failed to start: and the reason, when UAG_ENGINE_SERVER_KEY is not set or is shorter than 32 characters, when UAG_ENGINES names no engines, when UAG_SERVER is not an http or https URL, or when an engine cannot be loaded or created (a missing package or a required setting with no value, for example).

Engines are resolved as on the UAG: an instance named in UAG_ENGINES is looked up as @formio/uag-<type>, then uag-engine-<type>, from the node_modules of this package's installation and the directories above it, then from <dir>/node_modules of each directory in UAG_ENGINE_PATH; never from the working directory, NODE_PATH or Node's global folders.

Security

  • Every route, including /health, needs Authorization: Bearer <UAG_ENGINE_SERVER_KEY>. The key is compared in constant time, before the request body is read.
  • Keep the engine server on a private network that only the UAG reaches, and do not publish its port. It warns at startup when it listens on a public address.
  • Research uses only the tools that the request asks for and the UAG's /mcp lists for the scoped token. Every call is recorded, and the calls this server made are what it reports back, whatever the engine says. No model can write: the token allows only read-only tools.
  • When the UAG abandons a request (its routing timeout), the engine is aborted, research stops (also while it is still connecting), and the MCP connection is closed.
  • Engine errors are passed on only when the engine marks them safe to show (EngineError); anything else is reported as "The engine failed (see the engine server logs)." Every failure is logged here in one line, with the error's message: a provider SDK's message can name an account or a URL, so treat these logs as private.

Protocol

GET /health, GET /v1/engines, POST /v1/engines/:name/decide, POST /v1/engines/:name/extract and POST /v1/engines/:name/generate (free text over attached documents, for agent engines that generate), all JSON, with protocol: 1 in every body. See @formio/uag-sdk/protocol for the shapes, and Engine server for the full reference.

Decide, extract and generate calls may carry the Agent API request's X-Request-Id. The engine server sends it on with every research request to the UAG's /mcp and puts it in its logs, so a logging proxy can group every leg of a run. Only a short token (up to 128 letters, digits, ., _, : or -) is passed on; the header is optional either way, and the protocol version is unchanged.

Building the image

From the repository root:

docker build -f packages/engine-server/Dockerfile -t formio/uag-engines .

To add an engine package, either derive an image (the image runs as node, so switch to USER root for RUN npm install --prefix /engines uag-engine-acme, then back to USER node, with ENV UAG_ENGINE_PATH=/engines), or mount a directory that contains node_modules/uag-engine-acme and list it in UAG_ENGINE_PATH.

License: MIT.

版本与发布记录

@formio/uag-engines 共发布 13 个版本,首次发布于 2026/10/30;过去 12 个月发布了 13 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.0.0latest2026/11/132 天前
2.0.0-rc.11rc2026/11/105 天前
2.0.0-rc.102026/11/087 天前
2.0.0-rc.92026/11/079 天前
2.0.0-rc.82026/11/069 天前
2.0.0-rc.72026/11/0610 天前

关于 @formio/uag-engines 的常见问题

@formio/uag-engines 是什么?

Host engine packages for the Form.io Universal Agent Gateway (UAG) in their own process, behind the remote engine protocol, so model credentials and model traffic stay out of the UAG.

如何安装 @formio/uag-engines?

在项目目录运行 npm install @formio/uag-engines,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 uag-engines,可以用 npx uag-engines 直接运行。

@formio/uag-engines 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/formio__uag-engines 是否存在。

@formio/uag-engines 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@formio/uag-engines 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@formio/uag-engines 可以商用吗?

@formio/uag-engines 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@formio/uag-engines 的下载量有多少?

根据 npm 官方下载统计,@formio/uag-engines 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,079 次,日均约 69 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@formio/uag-engines 还在维护吗?

最新版本 2.0.0 发布于 2026/11/13(2 天前);至今共发布 13 个版本,其中过去 12 个月发布了 13 个;首次发布于 2026/10/30。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。