Core Concepts
Understand flows, nodes, actions, and how execution works.
Flows
A flow is a directed graph of nodes connected by edges. Each flow has one or more versions — when you edit a flow in the visual editor, you're editing a new version. You can pin a programmatic execution to a specific version number, or always run the latest.
Flows are stored in the database. You can create, update, and delete flows through the API or programmatically via the Invect core class.
Nodes
Nodes are the building blocks of a flow. Each node has a type (an action ID like core.model or gmail.send_message), parameters (configuration for that node), and a position in the visual editor.
Every node can optionally be configured with loop-over to execute once per item in an array.
Node Types
- Trigger — Entry point. Every flow starts with a trigger: manual, cron, or webhook. See Triggers.
- Model (
core.model) — Calls an LLM (OpenAI, Anthropic) with a prompt. - If/Else (
core.if_else) — Conditional branching. - JQ (
core.jq) — Transforms JSON data using JQ syntax. - HTTP Request (
http.request) — Makes HTTP calls to external APIs. - Template String (
core.template_string) — Generates text from templates. - Agent — Runs an AI agent with iterative tool-calling loops. See AI Agents.
- Integration actions — Gmail, Slack, GitHub, Google Drive, Linear, Postgres, and more. See Actions.
Actions
Actions are the primary way to define node types. Each action is a self-contained definition with an ID, a parameter schema, and an execute function. Every action automatically works as both a flow node and an agent tool.
See Actions for the built-in action reference and how to create custom actions.
Execution Model
Input data
When a node executes, it receives an input data object built from all upstream node outputs. Keys are the upstream node's slug (its referenceId, or label converted to snake_case), and values are the outputs:
{
"fetch_users": [{ "id": 1, "name": "Alice" }],
"get_config": { "env": "production" }
}Template resolution
Node parameters can use Nunjucks templates to reference upstream data. Templates are resolved before the node executes:
Process {{ fetch_users.length }} users in {{ get_config.env }}Execution order
Nodes execute in topological order — a node only runs after all its upstream dependencies have completed. If/else branches skip the inactive path; skipped nodes pass their input data unchanged to any downstream nodes.
Batch processing
core.model nodes support batch processing via the OpenAI and Anthropic batch APIs. When enabled, instead of calling the API synchronously the flow pauses with status PAUSED_FOR_BATCH. Invect polls for batch completion in the background and resumes the flow automatically — at 50% of the normal API cost.
Enable batch processing when starting a flow:
await core.startFlowRun(flowId, inputs, { useBatchProcessing: true });Credentials
Credentials are stored encrypted (AES-256-GCM) in the database. The system supports:
- API keys — Simple key/value pairs for services like OpenAI.
- OAuth2 — Full OAuth2 flow with automatic token refresh for Google, GitHub, Slack, etc.
Nodes access credentials via context.credential in their execute function. See Credentials.