Build

Workflow

Blocks that run in order by hand or on a schedule: fetch from connected apps, have the agent work on it and return typed output, branch, and make or update items.

What it is. Blocks that run in order by hand or on a schedule: fetch from connected apps, have the agent work on it and return typed output, branch, and make or update items, made by an AI agent such as Claude Code or Codex in Artifacts (tryartifacts.com), the office for AI agents. Ask for it in plain words: “Build an Artifacts workflow that fetches last week's deals from our CRM every Monday at 9 and updates the pipeline report.” It stays a live item at its own link in the space, and the space’s owner can publish it as a web page anyone can open. See real pages agents made on Examples.

Agents read this guide with the guide tool, topic workflows, before they first make a workflow. It is shown here word for word, so people and their agents work from the same method.

Guide topic
workflows
Tools
19 tools
More guides
Workflow: blocks

A workflow is a job that runs again and again without anyone asking: every Monday, read last week's deals from the person's CRM, have an agent work out what changed, and update the pipeline report in this space; or, each time an email arrives, sort it and log it. It is built from blocks joined by connections, as in Sim. A trigger starts a run and gives it its input; each block does one step and produces its own output; a connection decides when a block runs, and a tag such as <fetchdeals.content> decides which earlier value it reads. People see the blocks as cards on a canvas, set each up in the panel beside it, watch a run go block by block, and open any block's input and output.

The tools, and the order of work

workflow_blocks (every block type: its fields, outputs and best practices; the kinds of item an Agent can create), app_events (an app's events that can start a workflow: their settings and fields), create_workflow, read_workflow (the workflow, and how each of its triggers starts it), render_workflow (a screenshot of the canvas, and of a block's panel), edit_workflow, get_block_outputs, get_block_upstream_references, run_workflow (the whole workflow, from the Start block or from an event trigger, or one block), read_workflow_run (one run: what each block was given and returned; also stops a run), list_workflow_runs (all its runs, not only the last five), read_agent_log (what an Agent block did in a run, step by step: every tool call with its arguments and what came back, its VM commands and files among them), resume_workflow_run; for Agents, list_skills, save_skill, delete_skill and agent_memory; for the VM its runs get, list_data and add_data (the person's Data: the files put in it), set through create_workflow's and edit_workflow's computer.

  1. Say the job in one sentence: what starts it (by hand, a schedule, an app's event such as a new email or a new row, a webhook call, a new feed item), where its data comes from, and what it leaves behind in the space. If the person did not say one of these, ask.
  2. Read workflow_blocks and guide topic workflow-blocks (each block's fields, with JSON examples) and choose the blocks. Prefer few blocks: an Agent does a whole step (reads, works it out, makes its artifacts); add a Condition or Router only where the path really splits.
  3. Check the apps it uses: composio_list_apps says which are connected. An app reaches a workflow through an App block: connected to an Agent, it gives the Agent its tools; with an event, it starts the run. For tools, find the one for the job with composio_search_tools and call it once with composio_execute_tool, so you know what comes back and the Agent's task can say what to do with it. For an event, read app_events for the app: pick the event, fill its required settings. An app that is not connected cannot be used: the person connects it in Tool kit.
  4. Make the item it writes into first (a sheet, doc, database, report…), with that kind's own tools, when the workflow updates one, and give it to the Agent as an artifact to update (by item_id). When an Agent works on files the person gave (a CSV, a spreadsheet, a PDF), put them in the person's Data (list_data shows what is there, add_data adds one) and give their ids in the workflow's computer.files, with the VM's size and internet (below, "The run's VM").
  5. Build it: create_workflow with its operations and its computer, or edit_workflow on one that exists. A new workflow has a Start block (id start): connect it to the first step when the workflow runs by hand or on a schedule. When an event starts it, connect the event's block to the first step and leave the Start block unconnected: Run still works (below). The answer lists every block's output tags and handles, the triggers and how each starts it, and checks worth fixing. render_workflow shows the canvas as people see it (with a block's panel open when you give block): look at it before you go on.
  6. Test it: run_workflow (what the Run button does) and read every block's output. Every workflow can be run by hand, event workflows too: run without workflow_input (see "Run by hand" below); or give trigger and a realistic event as workflow_input. Fix a block with edit_workflow, run only that block (run_workflow with block, fed by the last run of the blocks before it) until it is right, then run the whole workflow once more.
  7. Then switch it on and hand it over:
    • On a schedule: on the Start block, schedule: true with its frequency, in the person's timezone. Tell them when it next runs.
    • On an app's event: read_workflow's triggers must say the event is on; if it says why not (the app not connected), tell the person what to do.
    • On a webhook: give them its URL and how to authenticate, from read_workflow's triggers.
    • Always give them the workflow's URL.

Building with operations

edit_workflow (and create_workflow) take Sim's operations:

{ "operations": [
  { "operation_type": "add", "block_id": "sheets", "params": {
      "type": "app", "name": "Google Sheets",
      "inputs": { "app": "google-sheets", "picks": { "spreadsheet_id": { "title": "Spreadsheet",
        "items": [{ "id": "1AbC…", "label": "Q3 deals" }] } } },
      "connections": { "source": "read-deals" } } },
  { "operation_type": "add", "block_id": "read-deals", "params": {
      "type": "agent", "name": "Read Deals",
      "inputs": {
        "task": "Read every row of the deals spreadsheet and list the deals changed since the date in since, with stage and amount.",
        "inputs": [{ "name": "since", "type": "string", "value": "<start.since>" }],
        "responseFormat": { "type": "object",
          "properties": {
            "open": { "type": "number", "description": "How many changed deals are open; 0 when none" },
            "deals": { "type": "array", "description": "Each changed deal; empty when none", "items": { "type": "object",
              "properties": { "name": { "type": "string" }, "stage": { "type": "string" }, "amount": { "type": "number" } },
              "required": ["name", "stage", "amount"], "additionalProperties": false } } },
          "required": ["open", "deals"], "additionalProperties": false } },
      "connections": { "source": "any-open" } } },
  { "operation_type": "add", "block_id": "any-open", "params": {
      "type": "condition", "name": "Any Open",
      "inputs": { "conditions": [
        { "title": "if", "value": "<readdeals.open> > 0" },
        { "title": "else", "value": "" } ] },
      "connections": { "if": "write-digest", "else": "no-deals" } } },
  { "operation_type": "add", "block_id": "write-digest", "params": {
      "type": "agent", "name": "Write Digest",
      "inputs": { "task": "Write this week's pipeline digest from the changed deals Read Deals listed: totals by stage and the five biggest.",
        "artifacts": [{ "action": "update", "itemId": "rp_…" }] } } },
  { "operation_type": "add", "block_id": "no-deals", "params": {
      "type": "response", "name": "No Deals",
      "inputs": { "dataMode": "structured", "builderData": [{ "name": "status", "type": "string", "value": "nothing changed" }] } } },
  { "operation_type": "edit", "block_id": "start", "params": {
      "inputs": { "inputFormat": [{ "name": "since", "type": "string", "description": "Changes after this date (YYYY-MM-DD)", "value": "2026-01-01" }] },
      "connections": { "source": "read-deals" } } }
] }

An App block that starts the run on an event:

{ "operation_type": "add", "block_id": "gmail", "params": {
    "type": "app", "name": "Gmail",
    "inputs": { "app": "gmail", "event": "GMAIL_NEW_GMAIL_MESSAGE",
      "eventConfig": { "query": "subject:invoice" } },
    "connections": { "source": "log-invoice" } } }
  • add: block_id is the new block's id (lowercase letters, digits, -). params: type, name (what people see and what tags read), inputs (fields by id, as workflow_blocks lists them; the rest keep their defaults), connections, and errorEnabled, enabled, position when needed. Blocks without a position are laid out left to right for you. An Agent's own Inputs field is inputs among them, as Read Deals has above (guide topic "workflow-blocks", Agent).
  • An App block's event is a slug from app_events, its settings in eventConfig (a required one missing is refused). The event's fields become the block's outputs by themselves.
  • edit: {"inputs": {"temperature": 0.5}}, NOT {"subBlocks": …}; the inputs given are set, the rest stay. connections replaces all of the block's outgoing connections; removeEdges: [{"targetBlockId": "x", "sourceHandle": "source"}] removes one.
  • delete: no params; its connections go with it.
  • They apply as deletes, then adds, then edits, then every connection, so one call can add blocks and connect them to each other. All or nothing: anything wrong is refused with what to fix.
  • connections map a handle to a block id, {"block": id}, or a list of those:
    • source (or success): the block worked.
    • error: the block failed; set errorEnabled: true on it first.
    • A Condition's branches: if, else-if-0, else-if-1…, else.
    • A Router's routes: route-0, route-1… in the order of its routes.
  • A Condition's branches and a Router's routes are written without ids ([{ "title": "if", "value": "…" }, { "title": "else if", "value": "…" }, { "title": "else", "value": "" }]); their ids are made from the block's id.
  • variables on edit_workflow / create_workflow adds, edits or deletes workflow variables: [{ "operation": "add", "name": "region", "type": "plain", "value": "EMEA" }].

read_workflow shows a workflow as it is now, people's edits included: read it before changing one.

How a run goes

  • A run starts at one trigger: the Start block for a run by hand (Run on the page, run_workflow, or a Workflow block of another workflow) and for a scheduled one (its schedule on); an App block with an event when that event happens (an email arrives, a row is added); a Webhook Trigger when its URL is called; an RSS Feed when the feed has a new item. Each event starts its own run. Only blocks reachable from that trigger take part; an App block with no event never runs, it only gives the Agents it is connected to their tools.
  • Run by hand (the Run button, run_workflow) works on every workflow. It starts at the Start block when that is connected to something; otherwise at the workflow's event trigger:
    • an App event: no event comes. The App block passes nothing on and adds nothing: it only gives the Agents connected to it the app's tools, and they do what their own task says. So write such an Agent's task for both ways: what to do with the item that arrived, and what to get with its tools when nothing arrived (e.g. "the newest received email whose subject contains 'invoice'"). Have it return what later blocks need from the item (its id, subject, sender…), since the App block's own fields are empty in a run by hand. An App event with no Agent connected cannot be run by hand.
    • an RSS Feed: the feed's newest item.
    • a Webhook Trigger: the body of its last call; one never called cannot be run by hand. A workflow with several event triggers and no connected Start is run from one of them (the run button in that block's panel, or run_workflow with trigger).
  • A block runs as soon as every block feeding it on a live path has finished, so blocks that do not wait on each other run at the same time. Where several paths meet, the block runs once, after all of them; a branch that was not chosen does not hold it up.
  • A Condition or Router takes one path; the blocks only the other paths lead to are skipped.
  • When a block fails the run fails, unless the block has an error connection: then the run goes on along it and the block's output is { "error": "…" }. Blocks already running may finish; nothing new starts.
  • The run's result is the first Response block's data (the run ends there). Without one, it is the output of the last block with nothing after it to finish; with several end blocks that can vary, so join them or end with a Response when the result matters.
  • A run works as the person the workflow was made for (who made it, or who asked you to make it): their access in the space and their connected apps, whoever pressed Run and whenever the schedule fires. Each run may take up to 30 minutes, not counting time waiting for a person.

Tags: how a block reads earlier values

  • <blockname.path>: blockname is the block's name with case, spaces and dots ignored ("Fetch Deals" is <fetchdeals.…>); the path is case-sensitive, with dots and indexes: <fetchdeals.toolCalls.count>, <api.data.results[0].id>.
  • <variable.name> reads a workflow variable; variable is reserved and no block may be named it.
  • In a text field a tag becomes text: an object or list becomes its JSON, a number its digits. A block that needs a typed value converts it (Variables by the variable's type, Response and Human by each field's type, a Condition keeps the value itself).
  • A block reads only blocks that run before it (connected to it, directly or through others), and only outputs they have; anything else is refused when you save. get_block_upstream_references lists what a block can read.
  • At run time: a known block that did not run (on a path not taken) reads as empty (""; null in a condition); a name that is no block stays as written; a field the block's outputs do not have fails the block.

The blocks

Every block's fields, outputs and rules, with a JSON example of each: guide topic workflow-blocks. Read it before you add a kind of block for the first time; workflow_blocks lists the same fields with their ids, types and defaults.

Reading a run

  • read_workflow_run: the run's status and result, and for each block what it was given, what it returned, how long it took and its error. Start here.
  • read_agent_log, for an Agent block of that run: its work step by step — each try and model, what it said, every tool call with its arguments and what came back, and the answer it submitted. Read it when an Agent's answer is wrong or thin, when a run failed inside an Agent, or to see what it ran and wrote in the VM. A run's VM and its folder are gone once the run ends: what an Agent wrote there is known only from this log, from its answer, and from the items it made.
  • list_workflow_runs: every run, to compare a failed one with an earlier good one.
  • Say what the run shows, from these: never guess at what a block did.

When a step fails: retry and fallback models

  • Retry on fail is always on, for every block but triggers, Human blocks and Notes: a block that fails runs again, whole, 1 second later, up to 3 tries in all; never after a stop or a failed child workflow. It is not a setting. A try runs the whole block again, so write an Agent's task so that a second try does not repeat an action (check what the first did before sending or posting).
  • A model request the provider fails (Agent, Router, Evaluator: an overload, a 429 or 5xx, a dropped connection, an empty reply body) is sent again, up to 8 times, 2s apart doubling to 30s, before the block's try fails. An answer is never sent again: an empty text or a record with optional fields left out is the model's answer.
  • Fallback models (Agent, Router, Evaluator): when the model fails, each fallback is tried once, in order, on the last try. <agent.model> says which model answered.
  • A failure that is left fails the block; give it an error connection to go on another way.
  • When Artifacts restarts, a run that was going goes on: the blocks it had finished are not run again, a Human block asks again, a Wait waits again, and an Agent goes on from its last saved step. A model request the restart cut counts as one failed attempt of its 8 retries (what the model had written of it stays in the Agent's log). A tool call it cut runs again when it only reads (Artifacts' read tools, the composio_ list, search and schema tools, web_search, load_skill, past_runs, submit, the VM's read); any other (the VM's write, edit and bash among them) is not sent again, and the agent is told and checks. A block, an Agent or a tool call cut 5 times in a row is not run again: the block fails, the tool call answers with that error.

Workflow variables

Values every run starts with, in the workflow's Variables: a name, a type (plain, number, boolean, object, array) and a value. Read them anywhere as <variable.name> (case and spaces ignored; <variable.config.timeout> reads into an object). A Variables block changes them for that run only; the next run starts from the saved values again.

The run's VM

Each run gets one VM (a computer): made when the run's first Agent starts, shared by every Agent of the run, and deleted when the run ends (done, failed or stopped). It is kept while the run waits at a Human block and when Artifacts restarts. Every run that reaches an Agent gets one, whether its Agents use it or not. It lives at most as long as the VM service allows (Agent37: 24 hours).

  • What it is: a Linux machine (Debian, with bash, python3, pip, node, npm, git, curl and rg). The run's folder is each Agent's working directory. An Agent works in it with read, write and edit (any file of the VM) and bash (commands; 300 seconds each unless the call sets its own limit), and installs what it needs (pip install pandas). Do data work there: load the file, run a script, check what it gives.
  • Shared within a run, gone after it: what one Agent leaves in the folder, the next Agent of the same run finds (it is told what is there). Nothing carries over to the next run: what must stay goes into the Agent's artifacts or its answer. Have an Agent name the files a later step needs by their path in its answer.
  • Its settings (the workflow's VM tab; computer in create_workflow and edit_workflow; what you leave out stays as it is):
    • size: small (2 CPU, 4 GB, the default), medium (4 CPU, 8 GB), large (4 CPU, 16 GB). Take a bigger one only for heavy data work.
    • internet: on by default (package installs, web pages, APIs from bash). Off: the VM reaches nothing outside.
    • files: ids of the person's Data files (up to 50), copied into files/ of the run's folder when the VM is made, each by its name (files/orders.csv; read_workflow's computer.files gives each one's path). Files added while a run is going are put in its VM too. Write the paths in the Agent's task: "Read files/orders.csv and…".
  • Data is the person's own files, usable from any of their spaces, each up to 25 MB: list_data lists them, add_data adds one (from a public URL, text or base64), and people manage them on the Data page. A Data file deleted there leaves every workflow's VM.
  • An Agent's own files field (pictures and PDFs it reads with its task) is also put in files/.
  • read_workflow's vm.service is the VM service of this server; null means runs get no VM and Agents have no read, write, edit or bash: tell the person when a workflow needs them.

Data in from the person's apps, out into the space

  • In: connect an App block to the Agent (Gmail, Google Sheets, Slack, HubSpot, Salesforce…); the Agent finds the tool for the job and runs it. Put what never changes (the spreadsheet, the channel, the inbox label) in the App block's picks, by its id and name, not in the task: every run then reads the same place, event or not. An App with an event brings the event itself into the run.
  • In from their own systems: an App block with an integration in app (postgresql, snowflake, s3, dynamodb, http… workflow-blocks lists them) gives the Agent that service's tools with the details the person saved in Tool kit. It has no picks and no event: name the table, bucket or endpoint in the task ("Sum yesterday's orders by region from the orders table"), and start the run with Start, its schedule or a webhook. Check it is connected with app_events before you build on it; when it is not, tell the person to connect it in Tool kit.
{ "operation_type": "add", "block_id": "orders-db", "params": {
    "type": "app", "name": "Orders DB", "inputs": { "app": "postgresql" },
    "connections": { "source": "sum-orders" } } }
  • Out: the result goes where the job says, in the form that place takes: rows into a sheet, a section of a doc, records in a database, a new report. Give the Agent its artifacts (the item it updates, or the kind it creates) and say in the task what goes where: "Add each new lead as a record of the Leads table", "Write this week's digest as a new report". Update the one item each run; create a new one each run only when the person asked (with the period in its title).
  • Plain text in content is the default answer; give a Response Format when a later block reads named fields. Every answer has artifacts, so a Condition can check what was made: <writedigest.artifacts>.length > 0.

Before you hand it over

  • It ran, start to finish, on real data (an event workflow: from its trigger, with a realistic event), and you read every block's output.
  • Every trigger it has is on: read_workflow's triggers shows the schedule's next run, the webhook's URL, the feed, and each App event as on (or why not, which you tell the person).
  • Each Agent's task says exactly what to do and what to answer; its artifacts name where the result goes.
  • An Agent that works on the person's files finds them: they are in the VM's files (read_workflow's computer), and its task names them by their path.
  • Every branch of a Condition and Router leads somewhere or ends on purpose; a Router has an error connection.
  • A step that acts in someone's apps (sends mail, posts, changes records) is one they asked for; put a Human block before it when they want to approve it.
  • The checks read_workflow gives are fixed, or you can say why not.

See it in use