Files
windmill/openflow.openapi.yaml
T
c1b59f70dd feat(ai-agent): add compaction memory that summarizes older context (#10928)
* feat(ai-agent): add autocompacted memory that summarizes older context

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): compact on final-answer turns and count what a turn appended

Address the pre-push review findings on the compaction path:

- A turn the model answers without a tool call left the agent loop on its first
  iteration, so a chat-shaped step never compacted and reloaded the whole
  conversation on every later turn. Compaction now also runs after the loop.
- The trigger measured only the last request, so a single large tool result
  could carry the next one past the window without ever crossing 80%.
- The summarization call re-sent the usage-tracking request shape on endpoints
  the loop had already learned to drop it for.
- The flat 8000-token summary reserve swallowed the whole target on a small
  context window, leaving one message in the tail and summarizing the rest.
- A response cut off inside the <analysis> scratchpad was accepted as a summary.
- The chat-mode memory default was a shared object the step form edited in place.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): keep Anthropic prompt counts and compact once per response

Address the first CI review round on the compaction path:

- Anthropic's streaming parser dropped `message_start`, the only event carrying
  the prompt-side counts, so a native Anthropic run reported no input tokens at
  all and compaction fell back to a character estimate.
- A loop that exits without issuing another request — a structured-output turn
  does — reached the post-loop pass still holding the previous measurement and
  compacted a second time, or retried a failure with nothing changed.
- The summarization call inherited the step's `max_completion_tokens`; a low one
  truncates the summary inside its scratchpad, which counts as a failure and
  disables compaction after three of them.
- A fired trigger that found nothing to summarize said nothing.
- Memory already over the window — a lowered `context_window`, or a step moved
  over from `auto` — had no way back, since compaction only ran after an
  accepted request. It now also runs once before the first one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): state the summary's own completion cap and drop the pre-flight pass

- The summarization call asked for no completion cap at all, which is "uncapped"
  only on the OpenAI-shaped providers: Anthropic substitutes 64000, over several
  Claude models' output ceiling, and Bedrock leaves the model's own small default,
  short enough to cut the response off inside its scratchpad. It now asks for the
  reserve the split already set aside, raised to the step's cap when that is larger.
- Compaction no longer runs before the first request. The fallbacks the loop learns
  from a rejection are not known that early, so on exactly the endpoints that need
  them the summarization was malformed by construction: it failed, spent a strike,
  and the first agent request still carried the oversized conversation. A memory
  already past the window is repaired on the turn after a request the endpoint
  accepts, rather than by a pass that cannot succeed there.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): ask the summary for exactly the room the split reserved

The split scales its reserve down on a small window while the request asked for
a flat 8000, so the two diverged below an 80k window: on a 4k/8k model the cap
alone exceeded the window and every summarization was refused, and on a 20k one
a full-length summary could land the conversation back over the trigger and
compact its own previous summary on the next response. Both now read one
`summary_reserve_tokens`.

The call also no longer inherits the step's reasoning effort. Every provider
counts thinking against that same budget, so a high-effort model could spend the
whole reserve before writing anything and return a summary cut off inside its
scratchpad; the compaction prompt asks for an `<analysis>` block, which is the
reasoning this call needs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): charge the compaction budget for tools and the system prompt

The tail budget was the whole target, but a request also carries the system
prompt compaction keeps and the tool definitions, which are not in the message
list at all. On a small window those are most of it: a tail sized to the full
target left the next request back over the trigger, compacting again every
response, and the no-usage estimate missed the tool schemas entirely so it could
fail to trigger at all. Both now account for them.

The reserve also gains a floor. It is the summary's output cap as well as the
room the split leaves, and scaled down without one a small window gave a
structured nine-section summary a few hundred tokens — truncated inside its
scratchpad every time, which is discarded, which switches the mode off after
three.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): count Gemini's tool-use prompt tokens in an agent step's usage

Gemini splits a tool-using turn's input across `promptTokenCount` and a disjoint
`toolUsePromptTokenCount`, and its thinking apart from `candidatesTokenCount`.
The agent step's parser read only the headline fields, so every tool-using turn
under-reported both — and the compaction trigger, which runs off the reported
prompt, could not see the tool results that grew it. It now goes through the same
helpers the proxy path already used.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): calibrate the compaction estimate against the measured prompt

Two rounds running, the finding was "the character estimate cannot see input X"
— tool schemas, then S3 attachments, which are short paths in the message list
and whole images by the time a provider counts them. Enumerating those is a list
that only grows, so the estimate is now scaled to the one number that is ground
truth: what the provider charged for the last request. Attachments, tokenizer
drift and whatever comes next fall out of that, because the estimate is only
ever used relative to itself.

Also stop the Gemini helpers turning an absent count into `Some(0)`. Downstream,
absent means "fall back to estimating the conversation" while zero reads as an
empty prompt and would hold the trigger below its threshold for the whole run.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): charge attachments what they cost and let a heavy short prefix compact

The calibration conserved the conversation's total cost but spread it by
character count, so an attachment — a short S3 path in the message list, a whole
image or PDF once a provider expands it — was charged to the text messages around
it and stayed nearly free in the split. It now carries a nominal cost of its own,
which the calibration corrects a residual on rather than the whole gap.

The four-message minimum also refused exactly the case that fix is for: an
attachment arriving on the first or second turn can pass the trigger before four
removable messages exist, and summarizing even one of them saves most of the
prompt. A prefix worth a quarter of the window is now enough on its own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): never summarize a prefix holding only a previous summary

The message-count floor was carrying a second job: a fresh summary sits in a one
or two message prefix, so requiring four declined it. The share threshold added
last commit admits it, and a summary is reserve-sized by construction — so the
post-compaction shape could spend one summarization per response swapping a
summary for another the same size, shrinking nothing and losing fidelity each
time. A previous summary no longer counts towards that threshold.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): take the context window from the model and drop the estimate calibration

Brings compaction in line with how the AI session does the same job, which had
already answered these three questions.

- The window is looked up from the model. `MODEL_CONTEXT_WINDOWS` in
  `windmill-ai/src/model_context.rs` mirrors the session's table in
  `copilot/modelConfig.ts`, entry for entry and with the same matching rules;
  each side points at the other, since a model added to one and not the other
  compacts at two different sizes. A step's `context_window` becomes the
  override for what the lookup cannot serve, and chat mode writes none.
- Provider usage is normalized where the provider's quirk is, not at the
  consumer. `TokenUsage::with_cache_beside_input` raises `input_tokens` to the
  whole prompt for Anthropic and Bedrock, which report their cached prefix
  beside it; the OpenAI shape already counts it inside. `prompt_tokens()` is
  then just `input_tokens`, rather than inferring the shape from whether a
  write count is present.
- The estimator is no longer calibrated against the measured prompt. The
  session uses the provider's count when it has one and a chars/4 estimate
  otherwise, with nothing in between, and a tail sized a little wrong only
  compacts again a turn later.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* feat(ai-agent): summarize memory down to what the database can store

Without an instance object store, memory is a 100KB database row cut
from its oldest message, the summary included, so compaction on a
mainstream model never got to keep anything across runs. A step that
persists there now runs its post-loop compaction pass against the
smaller of the model's window and the cap at chars/4, about 25k tokens:
the loop keeps the whole window, and what is written is a summary plus a
tail that fits. The run logs when that pass summarizes, and how many
messages the write dropped when one still overshoots.

The editor's storage warning on the option is removed: nothing exposes
the instance storage to it, so it keyed on the workspace S3 setting,
which is unrelated to where memory goes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): get a complete, billed summary out of every provider

Compaction against the real providers turned up four things the stub
could not: Gemini and OpenAI's reasoning models think by default and
bill it against the same cap the summary must fit in, so the
summarization request now asks them for their least (none, low); an
OpenAI Responses call that hits max_output_tokens ends in
response.incomplete, whose usage the parser dropped, so that
summarization went unbilled; a summary that quotes </summary> when it
describes its own instruction was cut off at the quote, on the agent
step and the AI session alike; and the prefix could end on an unanswered
user message, after which the instruction reads as part of that turn
(Anthropic merges the two outright). The tail now starts on a user
message, and both prompts tell the model the instruction is not part of
the conversation.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): compact down to half the window, on the agent step and the AI session

The gap between the 80% trigger and the target is what one compaction
buys, and every summarization request carries most of the window. At a
70% target a 128k model summarized about 13k tokens of prefix for a
summary of up to 8k, so each ~100k-token request bought a few turns of
room before the next one re-summarized the previous summary. At 50% the
same request frees about 30k.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): drop the workspace-S3 memory hint and state the database bound in the tooltip

The memory field warned that memory is kept in the database whenever the
workspace had no S3 storage. That setting has no bearing on where memory
goes: the instance object store decides, and nothing exposes it to the
editor. The field's tooltip now describes both memory kinds and states
the database bound unconditionally; the run log says what happened.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): send the summarizer its tool history as text

The summarization request carries no tool definitions, and Bedrock's
Converse API rejects toolUse/toolResult blocks that arrive without them,
so on Bedrock every summarization of a prefix holding a tool call failed
silently until the breaker tripped. The prefix's tool calls and results
now reach the summarizer rendered as text, on the agent step and in the
AI session's compaction, which goes through the same proxy.

Also drops the TokenUsage::prompt_tokens accessor, which had become a
plain read of the normalized input_tokens, and shortens the context
window field's description.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): price attachments from the provider count, bound storage in bytes, effort per pro model

Addresses two Codex rounds and a leftovers audit.

- Attachments were priced at a flat 1500 tokens in the split, so a
  multi-page PDF (tens of thousands of tokens to the provider, a short
  S3 path in the message list) could be kept in the tail or leave no
  prefix worth summarizing. They are now priced from the provider's
  count for the request that carried them, less that request's text,
  with the 1500 floor where nothing was counted.
- The database storage bound measured the provider's token count, but
  the 100KB cap is bytes and repetitive text packs several characters
  per token. The persist pass now measures the serialized conversation.
- The summarizer forced `low` on every reasoning model, which the pro
  variants reject (gpt-5-pro takes only high, gpt-5.2-pro starts at
  medium); they now get no effort.
- Dropped the unused prompt_tokens accessor and its orphaned assert, an
  unused PartialEq, a needlessly public lookup, and fully-qualified
  Gemini calls; refreshed stale comments and the memory_id schema doc;
  regenerated the flow schema artifacts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): evict a heavy attachment into the summarized prefix, not the tail

Pricing attachments from the provider count was not enough on its own: a
leading attachment is a user message, and the boundary rule pulled the
last unanswered user turn back into the kept tail to keep it with its
answer. For a heavy attachment that dragged it into the tail — or, at
the front, emptied the prefix — so it was never summarized and rode
every request. The boundary now moves forward instead, keeping that
user turn and its answer in the summarized prefix. Verified on the
running instance: a 25k-token PDF on a 30k window is summarized out on
the turn it overflows, and later turns drop from 26k to ~1.5k tokens.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): keep the forward boundary move off tool results and the prefix start

The forward move that keeps an unanswered user turn out of the tail had
two edges the third Codex round found: advancing past the user could
land the boundary on a tool result (its tool_calls then summarized away,
orphaning it), and with no system prompt the summarizable prefix starts
at 0, so a trigger firing while the tail estimate fit everything indexed
below the start and panicked the task. The forward scan now skips
tool-opening boundaries, and the move is guarded above the prefix start.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): drop the step temperature from the summary request

OpenAI's reasoning models (gpt-5-mini, gpt-5.1, gpt-5.2) reject
`temperature` alongside any reasoning effort but their own default, so a
step configured with a temperature made every summarization fail once
the summarizer forced a low effort — history then grew unchecked. The
internal summary call now omits the step's temperature: a structured
extraction does not need a set one, and omitting it sidesteps each
provider's temperature-versus-reasoning rules. Confirmed against the API
that low + temperature is refused on those models.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): compact an oversized loaded memory before the first request

Compaction was reactive, taken only after a request the endpoint
accepted, so the fallbacks the loop learns from a rejection are known
first. But a memory loaded from an earlier run can already exceed this
run's window — the step was switched to a smaller model, or a run under
a wider one persisted more than fits — and that first request then
overflows and fails the run, with every retry reloading the same
history and failing again. A pass is now taken up front, off the
character estimate, before the first request. It uses the default
request shape; an endpoint needing a fallback may reject this one
summary, which is non-fatal, and mainstream providers need none.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): under the storage bound, trigger on the max of bytes and model tokens

The storage-bound pass measured only the serialized row size, so an
attachment — a few bytes as an S3 path but nearly the whole model
context — read as tiny and the pass skipped a compaction the model
needed. It now takes the larger of the byte measure and the model's
token count, since repetitive text is few tokens but many bytes and an
attachment is the reverse; either being over must fire a pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): drop oldest turns when a summary cannot fit the window, as the AI session does

An oversized loaded memory (a step switched to a smaller model, or an
object-store run that persisted more than a later model's window holds)
left a prefix larger than the summarizer's own window, so the summary
request overflowed and failed, the memory was untouched, and every
retry failed the same way. The AI session handles this by falling back
from summarization to dropping the oldest turns down to the target;
compaction here now does the same. When a summary cannot run — it
failed, the breaker is tripped, or nothing is worth folding — the oldest
turns are dropped until the conversation fits and opens on a user
message, keeping the newest turn. The next request then always fits.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): drop whole turns only, keep the storage pass to bytes, refresh the count after a rewrite

Three edges the seventh Codex round found, all in the drop-oldest
fallback and the storage-bound measure:

- drop_oldest_to_fit dropped to any point that freed enough, which could
  strand a tool result whose tool_calls went with the messages before
  it. It now drops whole turns only, always landing the boundary on a
  user message and never splitting the newest turn; a lone turn too big
  for the window is left whole rather than broken.
- The storage-bound pass measured the whole model prompt against the
  shrunk 25k window, so a large tool roster and the system prompt —
  neither written to the row — tripped it on a conversation the row
  easily held. It measures the serialized bytes alone now; the model's
  own window is enforced by the in-loop passes and the pre-first-request
  pass, so the persisted size is all this pass is for.
- A compaction rewrites the message list, so the provider's count for
  the request that produced it no longer lines up. The count is now
  cleared after any pass that rewrites the conversation, so a later pass
  measures the estimate over the actual messages instead of a stale,
  larger prompt (which could decline a summary that already fit and then
  drop it). The step temperature, no longer sent to the summarizer on
  any path, is dropped from the request struct.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): measure only the persisted messages against the storage cap

Persistence strips the system prompt before writing the memory row, but
the storage pass was serializing every message including it, so a large
system prompt with a tiny conversation reported far over the storage
trigger, and the fallback dropped the one real turn, run after run. The
storage measure now serializes only the non-system messages, matching
what the row actually holds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix(ai-agent): run the model-window pass before the storage-bytes pass post-loop

A turn the model answered without a tool call broke before the in-loop
compaction check, so on database-backed memory its only pass was the
storage one, which measures bytes. An attachment fills the model context
but is a few bytes in the row, so that turn never compacted and a
follow-up could overflow the model. The post-loop now runs a
model-window pass first, off the provider's count, then the
storage-bytes pass when the row is smaller than the model — both limits
enforced for a chat-shaped step, not just the one that happens to bind.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix: simplify agent compaction and preserve execution history

* fix: remove unused compaction history setting

* fix: preserve answers and recover rejected agent context

* refactor: make agent compaction transactional

* fix: skip agent summaries that cannot fit retained context

* fix: explain skipped agent context compaction

* fix: retain recent agent memory when storage compaction cannot fit

* fix: start retained agent memory at a user turn

* fix: reject unsafe agent memory truncation on storage fallback

* docs: clarify agent context window override scope

* fix: keep recent turns verbatim when compaction memory outgrows storage

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix: keep the compaction summary out of the agent's answers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* fix: shorten the agent context window help text

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ViJyjUmidDYV2m6ifQdLeH

* chore: update ee-repo-ref to 942d4013f36edac1fc9a9addbdb02198db1c7a05

This commit updates the EE repository reference after PR #812 was merged in windmill-ee-private.

Previous ee-repo-ref: 8ca1682ce6106ba6ea96894fbe606dac64102eb6

New ee-repo-ref: 942d4013f36edac1fc9a9addbdb02198db1c7a05

Automated by sync-ee-ref workflow.

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
2026-09-29 19:01:53 +02:00

1417 lines
53 KiB
YAML

openapi: '3.0.3'
info:
version: 1.819.0
title: OpenFlow Spec
contact:
name: Ruben Fiszel
email: ruben@windmill.dev
url: https://windmill.dev
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
paths: {}
externalDocs:
description: documentation portal
url: https://windmill.dev
components:
schemas:
OpenFlow:
type: object
description: Top-level flow definition containing metadata, configuration, and the flow structure
properties:
summary:
type: string
description: Short description of what this flow does
description:
type: string
description: Detailed documentation for this flow
value:
$ref: '#/components/schemas/FlowValue'
schema:
type: object
description: JSON Schema for flow inputs. Use this to define input parameters, their types, defaults, and validation. For resource inputs, set type to 'object' and format to 'resource-<type>' (e.g., 'resource-stripe')
on_behalf_of_email:
type: string
description: Address of the account the flow runs on behalf of. Derived from on_behalf_of on read; accepted on write, where it is resolved to the account it names.
on_behalf_of:
type: string
description: 'The flow runs with the permissions of this identity: u/{username}, g/{group}, or a bare email when the username is itself email-shaped. The only stored half of the identity; on_behalf_of_email is derived from it. Omit it when writing and it is resolved from that address instead.'
required:
- summary
- value
FlowValue:
type: object
description: The flow structure containing modules and optional preprocessor/failure handlers
properties:
modules:
type: array
description: Array of steps that execute in sequence. Each step can be a script, subflow, loop, or branch
items:
$ref: '#/components/schemas/FlowModule'
failure_module:
description: Special module that executes when the flow fails. Receives error object with message, name, stack, and step_id. Must have id 'failure'. Only supports script/rawscript types
$ref: '#/components/schemas/FlowModule'
preprocessor_module:
description: Special module that runs before the first step on external triggers. Must have id 'preprocessor'. Only supports script/rawscript types. Cannot reference other step results
$ref: '#/components/schemas/FlowModule'
same_worker:
type: boolean
description: If true, all steps run on the same worker for better performance
preserve_step_tags:
type: boolean
description: If true and the flow runs on a custom worker tag, steps that declare their own non-empty tag run on it instead of inheriting the flow tag. Steps without their own tag still inherit the flow tag.
concurrent_limit:
type: number
description: Maximum number of concurrent executions of this flow
concurrency_key:
type: string
description: Expression to group concurrent executions (e.g., by user ID)
concurrency_time_window_s:
type: number
description: Time window in seconds for concurrent_limit
debounce_delay_s:
type: integer
description: Delay in seconds to debounce flow executions
debounce_key:
type: string
description: Expression to group debounced executions
debounce_args_to_accumulate:
type: array
description: Arguments to accumulate across debounced executions
items:
type: string
max_total_debouncing_time:
type: integer
description: Maximum total time in seconds that a job can be debounced
max_total_debounces_amount:
type: integer
description: Maximum number of times a job can be debounced
skip_expr:
type: string
description: JavaScript expression to conditionally skip the entire flow
cache_ttl:
type: number
description: Cache duration in seconds for flow results
cache_ignore_s3_path:
type: boolean
delete_after_secs:
type: integer
description: If set, delete the flow job's args, result and logs after this many seconds following job completion
flow_env:
type: object
description: "Environment variables available to all steps. Values can be strings, JSON values, or special references: '$var:path' (workspace variable) or '$res:path' (resource)."
additionalProperties: {}
priority:
type: number
description: Execution priority (higher numbers run first)
early_return:
type: string
description: JavaScript expression to return early from the flow
chat_input_enabled:
type: boolean
description: Whether this flow accepts chat-style input
notes:
type: array
description: Sticky notes attached to the flow
items:
$ref: '#/components/schemas/FlowNote'
groups:
type: array
description: Semantic groups of modules for organizational purposes
items:
$ref: '#/components/schemas/FlowGroup'
required:
- modules
Retry:
type: object
description: Retry configuration for failed module executions
properties:
constant:
type: object
description: Retry with constant delay between attempts
properties:
attempts:
type: integer
description: Number of retry attempts
seconds:
type: integer
description: Seconds to wait between retries
exponential:
type: object
description: Retry with exponential backoff (delay doubles each time)
properties:
attempts:
type: integer
description: Number of retry attempts
multiplier:
type: integer
description: Multiplier for exponential backoff
seconds:
type: integer
minimum: 1
description: Initial delay in seconds
random_factor:
type: integer
minimum: 0
maximum: 100
description: Random jitter percentage (0-100) to avoid thundering herd
retry_if:
$ref: '#/components/schemas/RetryIf'
FlowNote:
type: object
description: A sticky note attached to a flow for documentation and annotation
properties:
id:
type: string
description: Unique identifier for the note
text:
type: string
description: Content of the note
position:
type: object
description: Position of the note in the flow editor
properties:
x:
type: number
description: X coordinate
y:
type: number
description: Y coordinate
required:
- x
- y
size:
type: object
description: Size of the note in the flow editor
properties:
width:
type: number
description: Width in pixels
height:
type: number
description: Height in pixels
required:
- width
- height
color:
type: string
description: "Color of the note, one of: yellow, blue, green, purple, pink, orange, red, cyan, lime, gray. Any other value renders unstyled."
type:
type: string
enum: [free, group]
description: Type of note - 'free' for standalone notes. 'group' notes are deprecated; segment a flow with FlowValue.groups instead.
locked:
type: boolean
default: false
description: Whether the note is locked and cannot be edited or moved
contained_node_ids:
type: array
items:
type: string
description: For group notes, the IDs of nodes contained within this group
required:
- id
- text
- color
- type
FlowGroup:
type: object
description: A semantic group of flow modules for organizational purposes. Does not affect execution — modules remain in their original position in the flow. Groups provide naming and collapsibility in the editor. Members are computed dynamically from all nodes on paths between start_id and end_id.
properties:
summary:
type: string
description: Display name for this group
note:
type: string
description: Markdown note shown below the group header
autocollapse:
type: boolean
default: false
description: If true, this group is collapsed by default in the flow editor. UI hint only.
start_id:
type: string
description: ID of the first flow module in this group (topological entry point)
end_id:
type: string
description: ID of the last flow module in this group (topological exit point)
color:
type: string
description: "Color for the group in the flow editor, one of: yellow, blue, green, purple, pink, orange, red, cyan, lime, gray. Omit it to let the editor pick one."
required:
- start_id
- end_id
RetryIf:
type: object
description: Conditional retry based on error or result
properties:
expr:
type: string
description: JavaScript expression that returns true to retry. Has access to 'result' and 'error' variables
required:
- expr
StopAfterIf:
type: object
description: Early termination condition for a module
properties:
skip_if_stopped:
type: boolean
description: If true, following steps are skipped when this condition triggers
expr:
type: string
description: JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop
error_message:
type: string
nullable: true
description: Custom error message when stopping with an error. Mutually exclusive with skip_if_stopped. If set to a non-empty string, the flow stops with this error. If empty string, a default error message is used. If null or omitted, no error is raised.
error_include_result:
type: boolean
description: "When stopping with an error (error_message set), embed the stopping step's own result inside the raised error object (as error.result) instead of discarding it. The top-level result stays { error }. Defaults to false."
required:
- expr
FlowModule:
type: object
description: A single step in a flow. Can be a script, subflow, loop, or branch
properties:
id:
type: string
description: Unique identifier for this step. Used to reference results via 'results.step_id'. Must be a valid identifier (alphanumeric, underscore, hyphen)
value:
$ref: '#/components/schemas/FlowModuleValue'
stop_after_if:
description: Early termination condition evaluated after this step completes
$ref: '#/components/schemas/StopAfterIf'
stop_after_all_iters_if:
description: For loops only - early termination condition evaluated after all iterations complete
$ref: '#/components/schemas/StopAfterIf'
skip_if:
type: object
description: Conditionally skip this step based on previous results or flow inputs
properties:
expr:
type: string
description: JavaScript expression that returns true to skip. Can use 'flow_input' or 'results.<step_id>'
required:
- expr
sleep:
description: Delay before executing this step (in seconds or as expression)
$ref: '#/components/schemas/InputTransform'
cache_ttl:
type: number
description: Cache duration in seconds for this step's results
cache_ignore_s3_path:
type: boolean
timeout:
description: Maximum execution time in seconds (static value or expression)
$ref: '#/components/schemas/InputTransform'
delete_after_secs:
type: integer
description: If set, delete the step's args, result and logs after this many seconds following job completion
summary:
type: string
description: Short description of what this step does
mock:
type: object
description: Mock configuration for testing without executing the actual step
properties:
enabled:
type: boolean
description: If true, return mock value instead of executing
return_value:
description: Value to return when mocked
suspend:
type: object
description: Configuration for approval/resume steps that wait for user input
properties:
required_events:
type: integer
description: Number of approvals required before continuing
timeout:
type: integer
description: Timeout in seconds before auto-continuing or canceling
resume_form:
type: object
description: Form schema for collecting input when resuming
properties:
schema:
type: object
description: JSON Schema for the resume form
user_auth_required:
type: boolean
description: If true, only authenticated users can approve
user_groups_required:
description: Expression or list of groups that can approve
$ref: '#/components/schemas/InputTransform'
self_approval_disabled:
type: boolean
description: If true, the user who started the flow cannot approve
hide_cancel:
type: boolean
description: If true, hide the cancel button on the approval form
continue_on_disapprove_timeout:
type: boolean
description: If true, continue flow on timeout instead of canceling
skin:
type: string
enum: [detailed, minimal]
description: >-
How the approval request is presented, on the approval page and in Slack/Teams
approval messages. 'detailed' (used when unset) shows the flow details
(arguments, graph, approvers); 'minimal' shows only the request: the step
description, form and approve/reject actions
priority:
type: number
description: Execution priority for this step (higher numbers run first)
continue_on_error:
type: boolean
description: If true, flow continues even if this step fails
retry:
description: Retry configuration if this step fails
$ref: '#/components/schemas/Retry'
debouncing:
description: "Debounce configuration for this step (EE only)"
type: object
properties:
debounce_delay_s:
type: integer
description: Delay in seconds to debounce this step's executions across flow runs
debounce_key:
type: string
description: "Expression to group debounced executions. Supports $workspace and $args[name]. Default: $workspace/flow/<flow_path>-<step_id>"
debounce_args_to_accumulate:
type: array
description: Array-type arguments to accumulate across debounced executions
items:
type: string
max_total_debouncing_time:
type: integer
description: Maximum total time in seconds before forced execution
max_total_debounces_amount:
type: integer
description: Maximum number of debounces before forced execution
required:
- value
- id
InputTransform:
description: Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs
oneOf:
- $ref: '#/components/schemas/StaticTransform'
- $ref: '#/components/schemas/JavascriptTransform'
- $ref: '#/components/schemas/AiTransform'
discriminator:
propertyName: type
mapping:
static: '#/components/schemas/StaticTransform'
javascript: '#/components/schemas/JavascriptTransform'
ai: '#/components/schemas/AiTransform'
StaticTransform:
type: object
description: Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'
properties:
value:
description: The static value. For resources, use format '$res:path/to/resource'
type:
type: string
enum:
- static
required:
- type
JavascriptTransform:
type: object
description: JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside for loops, use 'flow_input.iter.value' for the current iteration value (in while loops it equals 'flow_input.iter.index')
properties:
expr:
type: string
description: JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)
type:
type: string
enum:
- javascript
required:
- expr
- type
AiTransform:
type: object
description: Value resolved by the AI runtime for this input. The AI engine decides how to satisfy the parameter.
properties:
type:
type: string
enum:
- ai
required:
- type
# Provider configuration schemas
AIProviderKind:
type: string
description: Supported AI provider types
enum:
- openai
- azure_openai
- azure_foundry
- anthropic
- mistral
- deepseek
- googleai
- groq
- openrouter
- togetherai
- customai
- aws_bedrock
ProviderConfig:
type: object
description: Complete AI provider configuration with resource reference and model selection
properties:
kind:
$ref: '#/components/schemas/AIProviderKind'
resource:
type: string
description: Resource reference in format '$res:{resource_path}' pointing to provider credentials
model:
type: string
description: Model identifier (e.g., 'gpt-4', 'claude-3-opus-20240229', 'gemini-pro')
reasoning_effort:
type: string
description: Provider-native reasoning effort token (e.g. 'low', 'high', 'none') for models that support extended thinking. Optional; unset leaves the provider default.
required:
- kind
- resource
- model
StaticProviderTransform:
type: object
description: Static provider configuration passed directly to the AI agent
properties:
value:
$ref: '#/components/schemas/ProviderConfig'
type:
type: string
enum:
- static
required:
- type
- value
ProviderTransform:
description: Provider configuration - can be static (ProviderConfig), JavaScript expression, or AI-determined
oneOf:
- $ref: '#/components/schemas/StaticProviderTransform'
- $ref: '#/components/schemas/JavascriptTransform'
- $ref: '#/components/schemas/AiTransform'
discriminator:
propertyName: type
mapping:
static: '#/components/schemas/StaticProviderTransform'
javascript: '#/components/schemas/JavascriptTransform'
ai: '#/components/schemas/AiTransform'
# Memory configuration schemas
MemoryOff:
type: object
description: No conversation memory/context
properties:
kind:
type: string
enum:
- 'off'
required:
- kind
MemoryWindow:
type: object
description: |
Keeps the most recent messages of the memory named by the run's memory id (or the step's
`memory_id`). Without a memory id the agent runs without memory.
properties:
kind:
type: string
enum:
- window
context_length:
type: integer
description: Number of most recent messages to load and store. 0 turns memory off.
required:
- kind
- context_length
MemoryAuto:
type: object
deprecated: true
description: |
Deprecated, still read as it was written: the run's memory id, else the `memory_id` here.
The step's own `memory_id` is not read while this kind is set; switch the kind to `window`
to use it. Without a `context_length`, or with 0, it is `off` and reads `previous_messages`.
properties:
kind:
type: string
enum:
- auto
context_length:
type: integer
description: Maximum number of messages to retain in context
memory_id:
type: string
description: Identifier for persistent memory across agent invocations
required:
- kind
MemoryCompaction:
type: object
description: |
Keeps the whole memory named by the run's memory id (or the step's `memory_id`), replacing
its older part with a summary as the conversation approaches the model's context window.
Without a memory id the agent runs without memory, and compaction bounds the run's own loop.
properties:
kind:
type: string
enum:
- compaction
context_window:
type: integer
description: |
Overrides the context window looked up from the model, in tokens. Only a model
Windmill does not know needs one; those fall back to 128000.
required:
- kind
MemoryMessage:
type: object
description: A single message in conversation history
properties:
role:
type: string
enum:
- user
- assistant
- system
content:
type: string
required:
- role
- content
MemoryManual:
type: object
deprecated: true
description: Deprecated, still read as it was written. Move the step to `off` with `previous_messages` instead.
properties:
kind:
type: string
enum:
- manual
messages:
type: array
items:
$ref: '#/components/schemas/MemoryMessage'
required:
- kind
- messages
MemoryConfig:
description: Managed memory, stored by Windmill and replayed with each request. The memory is named by a memory id, see `memory_id`. While it is off, a step can supply its history in `previous_messages`.
oneOf:
- $ref: '#/components/schemas/MemoryOff'
- $ref: '#/components/schemas/MemoryWindow'
- $ref: '#/components/schemas/MemoryCompaction'
- $ref: '#/components/schemas/MemoryAuto'
- $ref: '#/components/schemas/MemoryManual'
discriminator:
propertyName: kind
mapping:
'off': '#/components/schemas/MemoryOff'
window: '#/components/schemas/MemoryWindow'
compaction: '#/components/schemas/MemoryCompaction'
auto: '#/components/schemas/MemoryAuto'
manual: '#/components/schemas/MemoryManual'
StaticMemoryTransform:
type: object
description: Static memory configuration passed directly to the AI agent
properties:
value:
$ref: '#/components/schemas/MemoryConfig'
type:
type: string
enum:
- static
required:
- type
- value
MemoryTransform:
description: Memory configuration - can be static (MemoryConfig), JavaScript expression, or AI-determined
oneOf:
- $ref: '#/components/schemas/StaticMemoryTransform'
- $ref: '#/components/schemas/JavascriptTransform'
- $ref: '#/components/schemas/AiTransform'
discriminator:
propertyName: type
mapping:
static: '#/components/schemas/StaticMemoryTransform'
javascript: '#/components/schemas/JavascriptTransform'
ai: '#/components/schemas/AiTransform'
FlowModuleValue:
description: The actual implementation of a flow step. Can be a script (inline or referenced), subflow, loop, branch, or special module type
oneOf:
- $ref: '#/components/schemas/RawScript'
- $ref: '#/components/schemas/PathScript'
- $ref: '#/components/schemas/PathFlow'
- $ref: '#/components/schemas/ForloopFlow'
- $ref: '#/components/schemas/WhileloopFlow'
- $ref: '#/components/schemas/BranchOne'
- $ref: '#/components/schemas/BranchAll'
- $ref: '#/components/schemas/Identity'
- $ref: '#/components/schemas/AiAgent'
discriminator:
propertyName: type
mapping:
rawscript: '#/components/schemas/RawScript'
script: '#/components/schemas/PathScript'
flow: '#/components/schemas/PathFlow'
forloopflow: '#/components/schemas/ForloopFlow'
whileloopflow: '#/components/schemas/WhileloopFlow'
branchone: '#/components/schemas/BranchOne'
branchall: '#/components/schemas/BranchAll'
identity: '#/components/schemas/Identity'
aiagent: '#/components/schemas/AiAgent'
RawScript:
type: object
description: Inline script with code defined directly in the flow. Use 'bun' as default language if unspecified. The script receives arguments from input_transforms
properties:
# to be made required once migration is over
input_transforms:
type: object
description: Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments
additionalProperties:
$ref: '#/components/schemas/InputTransform'
content:
type: string
description: The script source code. Should export a 'main' function
language:
type: string
description: Programming language for this script
enum:
- deno
- bun
- bunnative
- python3
- go
- bash
- powershell
- postgresql
- mysql
- bigquery
- snowflake
- mssql
- oracledb
- graphql
- nativets
- php
- rust
- ansible
- csharp
- nu
- java
- ruby
- rlang
- duckdb
# NOT dbt: a dbt script runs the project carried as its module
# bundle, which an inline snippet has none of, and the worker rejects
# inline execution — advertising it here would let such a flow
# validate and then always fail at runtime.
# for related places search: ADD_NEW_LANG
path:
type: string
description: Optional path for saving this script
lock:
type: string
description: Lock file content for dependencies
type:
type: string
enum:
- rawscript
tag:
type: string
description: Worker group tag for execution routing
concurrent_limit:
type: number
description: Maximum concurrent executions of this script
concurrency_time_window_s:
type: number
description: Time window for concurrent_limit
custom_concurrency_key:
type: string
description: Custom key for grouping concurrent executions
is_trigger:
type: boolean
description: If true, this script is a trigger that can start the flow
assets:
type: array
description: External resources this script accesses (S3 objects, resources, etc.)
items:
type: object
required:
- path
- kind
properties:
path:
type: string
description: Path to the asset
kind:
type: string
description: Type of asset
enum:
- s3object
- resource
- ducklake
- datatable
- volume
- dbt
access_type:
type: string
nullable: true
description: Access level for this asset
enum: [r, w, rw]
alt_access_type:
type: string
nullable: true
description: Alternative access level
enum: [r, w, rw]
required:
- type
- content
- language
- input_transforms
PathScript:
type: object
description: Reference to an existing script by path. Use this when calling a previously saved script instead of writing inline code
properties:
input_transforms:
type: object
description: Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments
additionalProperties:
$ref: '#/components/schemas/InputTransform'
path:
type: string
description: Path to the script in the workspace (e.g., 'f/scripts/send_email')
hash:
type: string
description: Optional specific version hash of the script to use
type:
type: string
enum:
- script
tag_override:
type: string
description: Override the script's default worker group tag
is_trigger:
type: boolean
description: If true, this script is a trigger that can start the flow
required:
- type
- path
- input_transforms
PathFlow:
type: object
description: Reference to an existing flow by path. Use this to call another flow as a subflow
properties:
input_transforms:
type: object
description: Map of parameter names to their values (static or JavaScript expressions). These become the subflow's input arguments
additionalProperties:
$ref: '#/components/schemas/InputTransform'
path:
type: string
description: Path to the flow in the workspace (e.g., 'f/flows/process_user')
type:
type: string
enum:
- flow
required:
- type
- path
- input_transforms
ForloopFlow:
type: object
description: Executes nested modules in a loop over an iterator. Inside the loop, use 'flow_input.iter.value' to access the current iteration value, and 'flow_input.iter.index' for the index. Supports parallel execution for better performance on I/O-bound operations
properties:
modules:
type: array
description: Steps to execute for each iteration. These can reference the iteration value via 'flow_input.iter.value'
items:
$ref: '#/components/schemas/FlowModule'
iterator:
description: JavaScript expression that returns an array to iterate over. Can reference 'results.step_id' or 'flow_input'
$ref: '#/components/schemas/InputTransform'
skip_failures:
type: boolean
description: If true, iteration failures don't stop the loop. Failed iterations return null
type:
type: string
enum:
- forloopflow
parallel:
type: boolean
description: If true, iterations run concurrently (faster for I/O-bound operations). Use with parallelism to control concurrency
parallelism:
description: Maximum number of concurrent iterations when parallel=true. Limits resource usage. Can be static number or expression
$ref: '#/components/schemas/InputTransform'
squash:
type: boolean
required:
- modules
- iterator
- skip_failures
- type
WhileloopFlow:
type: object
description: Executes nested modules repeatedly until stopped. The implicit iterator is the iteration counter, so 'flow_input.iter.value' equals 'flow_input.iter.index' (0, 1, 2, ...) and never carries state. To carry state across iterations, a step reads its own previous-iteration result via 'results.<its_own_id>' with a first-iteration fallback - the loop's stop_after_if must then be on that inner step (a plain single-step body with stop_after_if on the loop module does not resolve 'results' across iterations and never terminates); plain counters can instead be derived from 'flow_input.iter.index', which works in every configuration. stop_after_if is evaluated after each iteration - on the loop module 'result' is the last iteration's result
properties:
modules:
type: array
description: Steps to execute in each iteration
items:
$ref: '#/components/schemas/FlowModule'
skip_failures:
type: boolean
description: If true, iteration failures don't stop the loop. Failed iterations return null
type:
type: string
enum:
- whileloopflow
parallel:
type: boolean
description: If true, iterations run concurrently (use with caution in while loops)
parallelism:
description: Maximum number of concurrent iterations when parallel=true
$ref: '#/components/schemas/InputTransform'
squash:
type: boolean
required:
- modules
- skip_failures
- type
BranchOne:
type: object
description: Conditional branching where only the first matching branch executes. Branches are evaluated in order, and the first one with a true expression runs. If no branches match, the default branch executes
properties:
branches:
type: array
description: Array of branches to evaluate in order. The first branch with expr evaluating to true executes
items:
type: object
properties:
summary:
type: string
description: Short description of this branch condition
expr:
type: string
description: JavaScript expression that returns boolean. Can use 'results.step_id' or 'flow_input'. First true expr wins
modules:
type: array
description: Steps to execute if this branch's expr is true
items:
$ref: '#/components/schemas/FlowModule'
required:
- modules
- expr
default:
type: array
description: Steps to execute if no branch expressions match
items:
$ref: '#/components/schemas/FlowModule'
type:
type: string
enum:
- branchone
required:
- branches
- default
- type
BranchAll:
type: object
description: Parallel branching where all branches execute simultaneously. Unlike BranchOne, all branches run regardless of conditions. Useful for executing independent tasks concurrently
properties:
branches:
type: array
description: Array of branches that all execute (either in parallel or sequentially)
items:
type: object
properties:
summary:
type: string
description: Short description of this branch's purpose
skip_failure:
type: boolean
description: If true, failure in this branch doesn't fail the entire flow
modules:
type: array
description: Steps to execute in this branch
items:
$ref: '#/components/schemas/FlowModule'
required:
- modules
type:
type: string
enum:
- branchall
parallel:
type: boolean
description: If true, all branches execute concurrently. If false, they execute sequentially
required:
- branches
- type
AgentTool:
type: object
description: A tool available to an AI agent. Can be a flow module or an external MCP (Model Context Protocol) tool
properties:
id:
type: string
description: Unique identifier for this tool. Cannot contain spaces - use underscores instead (e.g., 'get_user_data' not 'get user data')
summary:
type: string
description: "The name the AI agent calls this tool by, not a human label. On a flowmodule tool it must match ^[a-zA-Z0-9_]+$ - letters, numbers and underscores only (e.g. 'search_documentation', not 'Search documentation') - and always be set; on an mcp or websearch tool it is a plain label. Put the human-readable explanation in 'description'."
description:
type: string
description: Free-text description of the tool given to the AI to decide when and how to call it. Overrides the description auto-derived from the underlying script.
value:
$ref: '#/components/schemas/ToolValue'
required:
- id
- value
ToolValue:
description: The implementation of a tool. Can be a flow module (script/flow) or an MCP tool reference
oneOf:
- $ref: '#/components/schemas/FlowModuleTool'
- $ref: '#/components/schemas/McpToolValue'
- $ref: '#/components/schemas/WebsearchToolValue'
discriminator:
propertyName: tool_type
mapping:
flowmodule: '#/components/schemas/FlowModuleTool'
mcp: '#/components/schemas/McpToolValue'
websearch: '#/components/schemas/WebsearchToolValue'
FlowModuleTool:
description: A tool implemented as a flow module (script, flow, etc.). The AI can call this like any other flow module
allOf:
- type: object
properties:
tool_type:
type: string
enum:
- flowmodule
required:
- tool_type
- $ref: '#/components/schemas/FlowModuleValue'
WebsearchToolValue:
type: object
description: A tool implemented as a websearch tool. The AI can call this like any other websearch tool
properties:
tool_type:
type: string
enum:
- websearch
required:
- tool_type
McpToolValue:
type: object
description: Reference to an external MCP (Model Context Protocol) tool. The AI can call tools from MCP servers
properties:
tool_type:
type: string
enum:
- mcp
resource_path:
type: string
description: Path to the MCP resource/server configuration
include_tools:
type: array
description: Whitelist of specific tools to include from this MCP server
items:
type: string
exclude_tools:
type: array
description: Blacklist of tools to exclude from this MCP server
items:
type: string
required:
- tool_type
- resource_path
AiAgent:
type: object
description: AI agent step that can use tools to accomplish tasks. The agent receives inputs and can call any of its configured tools to complete the task
properties:
input_transforms:
type: object
description: Input parameters for the AI agent mapped to their values
properties:
provider:
$ref: '#/components/schemas/ProviderTransform'
output_type:
allOf:
- $ref: '#/components/schemas/InputTransform'
description: |
Output format type.
Valid values: 'text' (default) - plain text response, 'image' - image generation
user_message:
allOf:
- $ref: '#/components/schemas/InputTransform'
description: |
The user's prompt/message to the AI agent. Supports variable interpolation with
flow.input syntax. Required unless memory is off and `previous_messages` supplies
the prompt; image output always needs it.
system_prompt:
allOf:
- $ref: '#/components/schemas/InputTransform'
description: System instructions that guide the AI's behavior, persona, and response style. Optional.
streaming:
allOf:
- $ref: '#/components/schemas/InputTransform'
description: |
Boolean. If true, stream the AI response incrementally.
Streaming events include: token_delta, reasoning_token_delta, tool_call, tool_call_arguments, tool_execution, tool_result
memory:
$ref: '#/components/schemas/MemoryTransform'
memory_id:
allOf:
- $ref: '#/components/schemas/InputTransform'
description: |
String. Names the memory this step reads and writes, overriding the memory id the run
was started with (the chat conversation, an app chat session or the `memory_id` run
parameter). Leave unset to use the run's memory id. A fixed value shares one memory
across every run; an expression such as `flow_input.customer_id` keeps one memory per
key. When it evaluates to an empty value the agent runs without memory. Read only
while `memory` is `window` or `compaction`: it is ignored when memory is off, and an
older `auto` or `manual` memory reads neither history input.
previous_messages:
allOf:
- $ref: '#/components/schemas/InputTransform'
description: |
Array of MemoryMessage. History supplied by the flow, sent between the system prompt
and the user message. Read only while `memory` is off or absent: managed memory
ignores it, and an older `auto` or `manual` memory reads neither history input.
output_schema:
allOf:
- $ref: '#/components/schemas/InputTransform'
description: |
JSON Schema object defining structured output format. Used when you need the AI to return data in a specific shape.
Supports standard JSON Schema properties: type, properties, required, items, enum, pattern, minLength, maxLength, minimum, maximum, etc.
Example: { type: 'object', properties: { name: { type: 'string' }, age: { type: 'integer' } }, required: ['name'] }
user_attachments:
allOf:
- $ref: '#/components/schemas/InputTransform'
description: |
Array of file references (images or PDFs) for the AI agent.
Format: Array<{ bucket: string, key: string }> - S3 object references
Example: [{ bucket: 'my-bucket', key: 'documents/report.pdf' }]
enabled_tools:
allOf:
- $ref: '#/components/schemas/InputTransform'
description: |
Array of strings naming which of the tools configured in `tools` the agent may call
this run. Leaving it unset carries every one of them; an empty array carries none.
A tool is named as the model is shown it. An entry the model is shown nothing of is
named by what identifies it instead: an MCP server by its resource path, carrying
every tool it exposes (which of them stays that entry's include_tools/exclude_tools),
and a websearch entry by the reserved name '__wm_web_search', whatever summary it carries
(no tool may take that name).
Example: ['get_user', 'u/admin/github_mcp', '__wm_web_search']
max_completion_tokens:
allOf:
- $ref: '#/components/schemas/InputTransform'
description: |
Integer. Maximum number of tokens the AI will generate in its response.
Range: 1 to 4,294,967,295. Typical values: 256-4096 for most use cases.
temperature:
allOf:
- $ref: '#/components/schemas/InputTransform'
description: |
Float. Controls randomness/creativity of responses.
Range: 0.0 to 2.0 (provider-dependent)
- 0.0 = deterministic, focused responses
- 0.7 = balanced (common default)
- 1.0+ = more creative/random
max_iterations:
allOf:
- $ref: '#/components/schemas/InputTransform'
description: |
Number. Limits how many times the agent can loop through reasoning and tool use.
Range: 1-1000.
# Only the flow-local inputs are always present: a step linked to an `ai_agent` resource
# (see `agent`) keeps just those and takes provider/output_type from the resource. Even
# `user_message` may be absent, when memory is off and `previous_messages` is the prompt.
tools:
type: array
description: Array of tools the agent can use. The agent decides which tools to call based on the task
items:
$ref: '#/components/schemas/AgentTool'
type:
type: string
enum:
- aiagent
tag:
type: string
description: Worker group tag for execution routing. If not set, the AI agent step runs on the flow's tag (default `flow`)
omit_output_from_conversation:
type: boolean
default: false
description: If true, this AI agent step does not persist its assistant or tool messages to the flow conversation when chat mode is enabled.
agent:
type: string
description: |
Path of a reusable `ai_agent` resource (hybrid linking). When set, the agent brain
config (provider/model/system prompt/etc.) and tool set are resolved at runtime from
that resource; the module's input_transforms then only carry the flow-local inputs
(user_message, user_attachments, enabled_tools and the history inputs memory_id and previous_messages).
tool_inputs:
type: object
description: |
Host-local wiring for an agent's tool inputs, keyed by tool id then input key. Binds the
referenced agent's tools to this flow's context (flow_input/results) without mutating the
shared resource; overlaid onto the tools' input_transforms at runtime — including when
`agent` is unset, since a step forked for editing keeps these overrides until it is saved
back or unlinked.
additionalProperties:
type: object
additionalProperties:
$ref: '#/components/schemas/InputTransform'
parallel:
type: boolean
description: If true, the agent can execute multiple tool calls in parallel
required:
- type
- input_transforms
Identity:
type: object
description: Pass-through module that returns its input unchanged. Useful for flow structure or as a placeholder
properties:
type:
type: string
enum:
- identity
flow:
type: boolean
description: If true, marks this as a flow identity (special handling)
required:
- type
FlowStatus:
type: object
properties:
step:
type: integer
modules:
type: array
items:
$ref: '#/components/schemas/FlowStatusModule'
user_states:
additionalProperties: true
preprocessor_module:
allOf:
- $ref: '#/components/schemas/FlowStatusModule'
failure_module:
allOf:
- $ref: '#/components/schemas/FlowStatusModule'
- type: object
properties:
parent_module:
type: string
retry:
type: object
properties:
fail_count:
type: integer
failed_jobs:
type: array
items:
type: string
format: uuid
required:
- step
- modules
- failure_module
FlowStatusModule:
type: object
properties:
type:
type: string
enum:
- WaitingForPriorSteps
- WaitingForEvents
- WaitingForExecutor
- InProgress
- Success
- Failure
id:
type: string
job:
type: string
format: uuid
count:
type: integer
progress:
type: integer
iterator:
type: object
properties:
index:
type: integer
itered:
type: array
items: {}
itered_len:
type: integer
args: {}
flow_jobs:
type: array
items:
type: string
flow_jobs_success:
type: array
items:
type: boolean
flow_jobs_duration:
type: object
properties:
started_at:
type: array
items:
type: string
duration_ms:
type: array
items:
type: integer
branch_chosen:
type: object
properties:
type:
type: string
enum: [branch, default]
branch:
type: integer
required:
- type
branchall:
type: object
properties:
branch:
type: integer
len:
type: integer
required:
- branch
- len
approvers:
type: array
items:
type: object
properties:
resume_id:
type: integer
approver:
type: string
required:
- resume_id
- approver
failed_retries:
type: array
items:
type: string
format: uuid
skipped:
type: boolean
agent_actions:
type: array
items:
type: object
oneOf:
- type: object
properties:
job_id:
type: string
format: uuid
function_name:
type: string
type:
type: string
enum: [tool_call]
module_id:
type: string
required:
- job_id
- function_name
- type
- module_id
- type: object
properties:
call_id:
type: string
format: uuid
function_name:
type: string
resource_path:
type: string
type:
type: string
enum: [mcp_tool_call]
arguments:
type: object
required:
- call_id
- function_name
- resource_path
- type
- type: object
properties:
type:
type: string
enum: [web_search]
required:
- type
- type: object
properties:
type:
type: string
enum: [message]
required:
- content
- type
agent_actions_success:
type: array
items:
type: boolean
required: [type]