@formio/uag-claude

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

Claude agent engine for the Form.io Universal Agent Gateway (UAG): structured extraction, with research over read-only tools, for the Agent API.

原始使用文档
文档目录6 节
  1. Settings
  2. Instances
  3. Choosing a model
  4. How it works
  5. Upgrading from 1.x
  6. Using it in your own server

@formio/uag-claude

Form.io UAG › Engines › this page

The Claude agent engine for the UAG Agent API. It extracts and generates open values (dates, amounts, names, free text) with structured outputs. When a task lists read-only tools in uagTools, it researches with them first.

It is included in the formio/uag Docker image. With the UAG installed from npm, install it next to it:

npm install @formio/uag-claude

Enable it by naming it, and set its key:

UAG_ENGINES=claude          # or jev,claude
CLAUDE_API_KEY=...

Its tasks are Agentic Formflow, so on a self-hosted project the UAG also needs a LICENSE_KEY that includes the UAG for the project's endpoint (see Licensing); a project on Form.io's hosted service needs none. A form's chat needs no license on Form.io Open Source or a hosted project.

Settings

SettingVariablesDefault
apiKeyUAG_ENGINE_<NAME>_API_KEY, CLAUDE_API_KEY, ANTHROPIC_API_KEYrequired (secret)
modelUAG_ENGINE_<NAME>_MODEL, CLAUDE_MODELclaude-opus-5-5
effortUAG_ENGINE_<NAME>_EFFORT, CLAUDE_EFFORTlow, for extraction
researchEffortUAG_ENGINE_<NAME>_RESEARCH_EFFORT, CLAUDE_RESEARCH_EFFORTmedium, for research with tools
fallbacksUAG_ENGINE_<NAME>_FALLBACKS, CLAUDE_FALLBACKSdefault; off disables
maxTokensUAG_ENGINE_<NAME>_MAX_TOKENS, CLAUDE_MAX_TOKENS16000; 1 to 128000

maxTokens bounds each request's output. A long value, such as a document transcribed into a rich text field, needs more than the default, and more time: raise the instance's routing timeout (routing.timeouts) with it, since the UAG abandons an engine at its timeout whatever it is producing.

<NAME> is the instance name, upper-cased with - as _. An instance's own variable wins over the shared one. effort and researchEffort take low, medium, high, xhigh or max.

Instances

Run a fast model for simple fields and a deeper one for the rest, sharing one key:

UAG_ENGINES=jev,fast:claude,deep:claude
CLAUDE_API_KEY=...
UAG_ENGINE_FAST_MODEL=claude-haiku-5-5
UAG_ENGINE_DEEP_MODEL=claude-opus-5-5
UAG_ENGINE_DEEP_RESEARCH_EFFORT=high

Routing lists, and a field's uagEngine property, name the instances, for example routing.value: ["fast", "deep"].

Choosing a model

Set model to a specific model ID rather than relying on the default. A new UAG release may change the default, and answers can differ between models, so compare them on your own labeled examples before changing it (uag-eval measures decision engines only).

Every request sends effort (or researchEffort), so the model must accept it:

  • The current models take all five levels: Claude Opus 5.5, Opus 5, Sonnet 5.5, Sonnet 5, Haiku 5.5, Opus 4.8 and Opus 4.7.
  • Claude Opus 4.6 and Sonnet 4.6 take every level except xhigh.
  • Claude Haiku 4.5 and Sonnet 4.5 refuse effort, so every request to them fails. Use a current model.

How it works

  • Extraction uses structured outputs (output_config.format) with a JSON schema the UAG derives from the form. Answers are valid JSON for exactly the requested fields. Values from this engine are always reported as suggested.
  • Research: when a task lists read-only tools, Claude may call them first, up to agentApi.research.maxIterations turns. Every call goes back through the UAG with the caller's identity. Claude then answers with the same structured output, with tools turned off. It never writes: the UAG validates the values and saves them itself.
  • Refusals: with fallbacks at default, the API re-runs a refused request on a fallback model server-side, for the models that have one (such as Claude Opus 5.5 and Sonnet 5.5). Claude Haiku 5.5 has none, so its refusals stand. A refusal that stands is reported as an engine failure, and the UAG falls back to the next engine.
  • Streaming: every request streams, so a long answer needs no request timeout of its own; the UAG's timeout still aborts it through its signal.
  • Documents (generate): Claude reads text and PDFs (accepts: ['text', 'pdf']). Document plugins' requests send each PDF as a base64 document block and each text as a text document block, titled with its label, before the instructions; the last document is marked cache_control: ephemeral, so a plugin's retry with the same documents reads them from the prompt cache. Progress is reported as the answer streams, and an answer cut off at the output limit is returned with stopReason: 'max_tokens'. Keep the UAG's document limits within Claude's (32 MB per request, and its current PDF page limit).
  • Token limit: each answer may use up to maxTokens (16,000 by default). A research turn or an extraction cut off at that limit is an engine failure, and the UAG falls back to the next engine.
  • Aborts: the routing timeout (for research, agentApi.research.timeout) aborts the request, and research stops before its next call.

Upgrading from 1.x

@formio/uag-claude 1.x was a different program: the Claude integration, a standalone server (uag-claude, the formio/uag-claude image) that ran its own MCP client against the UAG. 2.0 is an engine: a library the UAG loads, with no server and no command to run. Installing 2.0 where 1.x ran gives a package that does nothing on its own.

  • To keep the 1.x integration, pin @formio/uag-claude@^1 (or the formio/uag-claude:1.3 image). 1.3.x keeps working against UAG 2.0, and gets security fixes only.
  • To move to 2.0, turn the engine on in the UAG (UAG_ENGINES=claude, CLAUDE_API_KEY), or in a formio/uag-engines container next to it, and remove the integration container. See Migrating to 2.0 for what replaces its webhooks and commands.
1.x setting2.0
CLAUDE_API_KEYUnchanged; ANTHROPIC_API_KEY also works.
CLAUDE_MODELUnchanged, but the model must accept effort (see Choosing a model).
CLAUDE_MAX_TOKENSUnchanged: the maxTokens setting (16,000 by default; see Settings). CLAUDE_EFFORT and CLAUDE_RESEARCH_EFFORT also trade depth for cost.
CLAUDE_MAX_ITERATIONSThe UAG's agentApi.research.maxIterations.
PROJECT, PROJECT_KEY, ADMIN_KEY, BASE_URL, PORTNot engine settings: the engine runs inside the UAG (or on the engine server), and the UAG calls it.
UAG_SERVERNot an engine setting either. On the engine server it is the UAG's URL, which research calls back into (/mcp); inside the UAG it is not needed.
A webhook to /agent/claude/agent_provide_dataAn "Agent: Run task" action on the form.
POST /agent/claude/collect_field_dataPOST {form}/agent/extract on the UAG.
POST /agent/claude (a free-form command)No Agent API equivalent: an engine answers a form's task. Connect an MCP client to the UAG's /mcp instead, where Form.io permissions apply to every tool call.

Using it in your own server

Name it in configuration instead of UAG_ENGINES, with options that take precedence over the environment:

const server = new UAGServer({
    engines: [{ name: 'deep', type: 'claude', options: { model: 'claude-opus-5-5', researchEffort: 'high' } }],
});

License: MIT.

版本与发布记录

@formio/uag-claude 共发布 13 个版本,首次发布于 2026/07/29;过去 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-claude 的常见问题

@formio/uag-claude 是什么?

Claude agent engine for the Form.io Universal Agent Gateway (UAG): structured extraction, with research over read-only tools, for the Agent API.

如何安装 @formio/uag-claude?

在项目目录运行 npm install @formio/uag-claude,或使用 pnpm add / yarn add / bun add。

@formio/uag-claude 支持 TypeScript 吗?

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

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

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

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

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

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

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

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

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

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

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