<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Workflow Automation - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Workflow Automation - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Fri, 24 Jul 2026 22:39:35 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/workflow-automation/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ What to Do if You've Outgrown Your Cron Job Scheduler ]]>
                </title>
                <description>
                    <![CDATA[ Most developers begin their automation journey similarly. They create a script that performs a helpful task, such as pulling data from an API, resizing a batch of images, or emailing a report, and the ]]>
                </description>
                <link>https://www.freecodecamp.org/news/what-to-do-if-you-ve-outgrown-your-cron-job-scheduler/</link>
                <guid isPermaLink="false">6a63cd4ce956973f287e1685</guid>
                
                    <category>
                        <![CDATA[ Workflow Automation ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Orchestration ]]>
                    </category>
                
                    <category>
                        <![CDATA[ orchestration-platform ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Python automation ]]>
                    </category>
                
                    <category>
                        <![CDATA[ it automation tools ]]>
                    </category>
                
                    <category>
                        <![CDATA[ cron ]]>
                    </category>
                
                    <category>
                        <![CDATA[ cronjob ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cron Job Scheduling ]]>
                    </category>
                
                    <category>
                        <![CDATA[ AI-automation ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Rob Walters ]]>
                </dc:creator>
                <pubDate>Fri, 24 Jul 2026 20:38:36 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/uploads/covers/5e1e335a7a1d3fcc59028c64/af95f928-4ab0-4e7d-99c9-fae3fb328a83.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Most developers begin their automation journey similarly. They create a script that performs a helpful task, such as pulling data from an API, resizing a batch of images, or emailing a report, and then schedule it to run each morning.</p>
<p>This leads them to add a line to their crontab, which gives them a sense of control. Now, their computer runs the script automatically while they sleep.</p>
<p>For a while, that's enough. Then it isn't.</p>
<p>Maybe the backup script failed silently at 3 a.m., and you didn't find out until you needed it later that day, or you developed the perfect script that ran smoothly in your terminal to find it failing when scheduled in cron.</p>
<p>If any of that sounds familiar, congratulations: you've outgrown cron. You're not alone, and this article aims to help you feel understood and ready for better solutions.</p>
<p>This article is about what comes next. We'll look at exactly where cron runs out of road, what 'workflow orchestration' actually means underneath the buzzword, and then build a real workflow step by step so the concepts stick.</p>
<p>By the end, you'll feel more confident and empowered to choose the right tools for complex scheduling challenges.</p>
<h2 id="heading-what-cron-is-and-what-its-genuinely-good-at">What Cron is, and What it's Genuinely Good at</h2>
<p><strong>Cron</strong> is the system background service (daemon) that runs scheduled tasks. Crontab (cron table) is the configuration file or command utility used to write and manage those task schedules' time-based job scheduler that has shipped with Unix-like systems since the 1970s. It's available on today’s Linux distributions as well as on Macs.</p>
<p>With cron, you specify a schedule and a command, and it runs the command at that time. The schedule uses the famous five-field syntax:</p>
<pre><code class="language-plaintext">┌───────────── minute (0–59)
│ ┌───────────── hour (0–23)
│ │ ┌───────────── day of month (1–31)
│ │ │ ┌───────────── month (1–12)
│ │ │ │ ┌───────────── day of week (0–6)
│ │ │ │ │
0  9  *  1 5  /usr/bin/python3 /home/me/daily_report.py
</code></pre>
<p>Note: The line <code>0 9 * 1 5&nbsp; /usr/bin/python3 /home/me/daily_report.py</code> means "run daily_report.py at 9:00 a.m. on weekdays." The syntax is terse, ubiquitous, and (credit where it's due) rock-solid for what it does.</p>
<p>And here's the important part: <strong>cron is not bad.</strong> For a single, self-contained, failure-tolerant task on one machine, it's the right tool. But for more complex workflows, a purpose-built orchestration tool can provide the reliability and visibility you need, helping you feel more in control of your automation.</p>
<h2 id="heading-the-four-walls-youll-hit-with-cron"><strong>The Four Walls You'll Hit with Cron</strong></h2>
<p>The trouble with cron starts when your automation stops being a single self-contained task. As your scripts grow, they form more complex systems where you run into the same four limitations, more or less in this order.</p>
<h3 id="heading-wall-1-dependencies-between-steps">Wall 1: Dependencies Between Steps</h3>
<p>Your morning routine grows from one script into three. Consider an ETL scenario with three scripts:</p>
<ol>
<li><p><strong>extract.py</strong> pulls yesterday's orders from an API.</p>
</li>
<li><p><strong>transform.py</strong> cleans the data and computes totals.</p>
</li>
<li><p><strong>load.py</strong> writes the result into the analytics database.</p>
</li>
</ol>
<p>Each step depends on the one before it. The obvious cron approach is to guess at the timing:</p>
<pre><code class="language-plaintext">0 2 * * *  python extract.py
0 3 * * *  python transform.py
0 4 * * *  python load.py
</code></pre>
<p>You're now hoping the extract finishes within an hour, so that the transform has something to work with. On the day the API is slow, and extract takes 70 minutes, transform runs against stale or missing data and quietly produces garbage. Cron has no concept of "run B only after A succeeds." It only knows wall-clock time.</p>
<h3 id="heading-wall-2-failure-handling-and-retries">Wall 2: Failure Handling and Retries</h3>
<p>Networks blip. APIs return 503 status codes (Service Unavailable). Databases drop connections. A robust job needs to detect a failure and retry. Maybe three times, or with increasing delays between attempts, so you don't hammer a struggling service.</p>
<p>With cron, retry logic is your problem. You end up bolting it onto every script by hand: try/except blocks, sleep calls, a counter, and a flag file so the next cron tick knows whether the previous one finished. Multiply that across a dozen jobs, and you've written a small, buggy, undocumented orchestration engine.</p>
<h3 id="heading-wall-3-visibility">Wall 3: Visibility</h3>
<p>Ask yourself, did your jobs run last night? Which ones succeeded? How long did each take? Is the slowdown in the extract step or the load step?</p>
<p>With cron, the honest answer is "I'd have to go read some log files, if the script even wrote any." The first task is finding the cron job log files themselves.</p>
<p>Finding them can be complicated: cron's logs can be in /var/log/syslog on one system and /var/log/cron on another, assuming logging is enabled. Meanwhile, your script's output only exists if you explicitly redirect stdout and stderr. As a result, you have to search through system logs to verify the job ran, then locate any separate output files that captured its print statements.</p>
<p>When a job fails, identifying the issue is even harder, as you must sift through interleaved logs from multiple runs, trying to determine which timestamp corresponds to the last execution and where it went wrong, often relying only on a non-zero exit code as a clue. There's no dashboard, no run history, no record of how long things took, and no alert when something breaks.</p>
<p>Failures are silent by default, the single most dangerous property a background job can have. You find out your pipeline has been broken for a week when someone downstream notices the numbers stopped updating.</p>
<h3 id="heading-wall-4-backfills-and-re-runs">Wall 4: Backfills and Re-runs</h3>
<p>Your analytics database has been live for two months when you discover a bug in <strong>transform.py</strong> that miscalculated totals. You've fixed the code. Now you need to rerun the pipeline for each day in those two months, processing its own slice of data.</p>
<p>This is a backfill, and with cron, it's a nightmare. Cron only ever runs "now." There's no built-in notion of "run this job as if it were March 14th, then March 15th, then..." So you write yet another throwaway script with a date loop, pray it's idempotent, and babysit it.</p>
<p>Notice the pattern across all four walls: each time, you end up reimplementing something poorly that a category of tools already solves well. That category is workflow orchestration.</p>
<h2 id="heading-can-workflow-orchestration-save-the-day"><strong>Can Workflow Orchestration Save the Day?</strong></h2>
<p>A workflow orchestrator manages workflows, which are sets of tasks with specific relationships, triggers, and failure protocols, along with observability for tracking outcomes.</p>
<p>While many solutions like Airflow, Dagster, Prefect, and Temporal are available, we'll focus on <a href="https://kestra.io">Kestra</a>, an open-source orchestrator. Kestra stands out from the pack by enabling developers to run, monitor, and manage workflows all from a single declarative layer compatible with any programming language and infrastructure, including public, private, or even air-gapped networks.</p>
<p>Kestra also provides enterprises with the control needed to ensure insights and regulatory compliance. With over 1,600 connectors available, you can build almost any data, infrastructure, or AI workflow you can imagine.</p>
<p>In this tutorial, we'll continue with the cron scheduler theme and build a simple ETL workflow that uses a cron-like schedule while addressing some of cron's shortcomings, such as execution sequence and error handling.</p>
<h2 id="heading-kestra-primer">Kestra Primer</h2>
<p>Kestra was born out of the engineering pain of creating Python code to achieve proper workflow orchestration.&nbsp;Rather than spend engineering hours crafting the right Python code for your Apache Airflow DAG, with Kestra, your workflow is a YAML file. Simply describe what should run in plain, declarative syntax. Store the file in Git, and deploy it like any other code.</p>
<p>There's no obscure UI logic building and no hidden state management. Just simple text that can be easily reviewed and diffed.&nbsp;The workflow you read is the workflow that runs.</p>
<p>The example YAML file in Figure 1 illustrates a scenario in which you want to move NoSQL data into an analytics-ready warehouse.</p>
<pre><code class="language-yaml">id: cassandra-to-bigquery
namespace: company.team

tasks:
  - id: query_cassandra
    type: io.kestra.plugin.cassandra.Query
    session:
      endpoints:
        - hostname: localhost
          port: 9042
      localDatacenter: datacenter1
    cql: |
      SELECT salary_id, work_year, experience_level, employment_type,
      job_title, salary, salary_currency, salary_in_usd, employee_residence,
      remote_ratio, company_location, company_size
      FROM test.salary
    fetchType: STORE

  - id: write_to_csv
    type: io.kestra.plugin.serdes.csv.IonToCsv
    from: "{{ outputs.query_cassandra.uri }}"

  - id: load_bigquery
    type: io.kestra.plugin.gcp.bigquery.Load
    from: "{{ outputs.write_to_csv.uri }}"
    destinationTable: my_project.my_dataset.my_table
    serviceAccount: "{{ secret('GCP_SERVICE_ACCOUNT_JSON') }}"
    projectId: my_project
    format: CSV
    csvOptions:
      fieldDelimiter: ","
      skipLeadingRows: 1
</code></pre>
<p>Figure 1: Cassandra to BigQuery Example</p>
<p>Without even knowing much about Kestra, the YAML file is simple and self-explanatory. Later in this post, we'll create a basic ETL flow and explain the significance of fields such as id and type. But first, let’s get an instance of Kestra running on your local machine.</p>
<h3 id="heading-how-to-set-up-kestra">How to Set Up Kestra</h3>
<p>Kestra is available as an open-source platform licensed under the Apache 2.0 license as well as an Enterprise offering <a href="https://kestra.io/docs/enterprise">additional features</a> and product support. In this tutorial, we'll use Docker to run Kestra locally using the latest version.</p>
<p>To spin up Kestra, run the following Docker command:</p>
<pre><code class="language-shell">docker run --pull=always --rm -it -p 8080:8080 
  --user=root \
  --name kestra \
  -v kestra_data:/app/storage \
  -v kestra_db:/app/data \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /tmp:/tmp \
  kestra/kestra:latest server local
</code></pre>
<p>For other platforms such as Windows and Linux check out <a href="https://kestra.io/get-started">https://kestra.io/get-started</a>.</p>
<p>Once the containers are loaded, navigate to the Kestra UI at <a href="http://localhost:8080">http://localhost:8080</a>. The welcome screen will ask you to create an administrator.&nbsp;Create the user and finish the initial launch wizard.</p>
<p>Once that's complete, navigate to the Flows tab in the left panel, then click the Create button at the top right of the page. This will create a new flow using a sample template, as shown in the following figure:</p>
<img src="https://cdn.hashnode.com/uploads/covers/67c9ccd99fc59c702c3edd73/0ed945f2-ae0b-4f4f-b274-a4f61d3fc255.png" alt="Kestra Flows showing Flow Code Editor" style="display:block;margin:0 auto" width="1734" height="814" loading="lazy">

<p>Figure 2: Flows page showing the new flow template</p>
<h3 id="heading-flows-in-kestra">Flows in Kestra</h3>
<p>In Kestra you define your workflow orchestration through Flows. You can create these Flows using YAML syntax in the UI, through a no-code editor in the UI, or programmatically through an API. In this tutorial, we'll create flows using YAML.</p>
<p>In Figure 2 above, you'll notice that a sample flow is already created to get you started.</p>
<p>The <strong>_id</strong>, <strong>namespace,</strong> and <strong>tasks</strong> are three required fields and are used to identify the flow within the Kestra environment and the task the flow should execute. Each flow lives in one namespace. Namespaces are like folders in a filesystem and are used to group flows and provide structure. Note that you can't change a flow’s namespace after creation.</p>
<h2 id="heading-how-to-use-kestra">How to Use Kestra</h2>
<h3 id="heading-step-1-a-simple-task-executed-on-a-schedule">Step 1: A Simple Task Executed on a Schedule</h3>
<p>Let's start by erasing the sample flow provided and replacing it with the following:</p>
<pre><code class="language-yaml">id: morning_report
namespace: tutorial

tasks:
  - id: say_hello
    type: io.kestra.plugin.core.log.Log
    message: "Good morning — the pipeline ran at {{ execution.startDate }}"
</code></pre>
<p>This example has the required id, namespace, and has one tasks field that logs a message. The message displayed uses a <a href="https://kestra.io/docs/expressions">pebble expression</a> (the command inside the&nbsp; {{ }} brackets) to show the startDate of the execution.</p>
<p>Pebble expressions are used to set values dynamically in flows. In this example, the start date of the execution will be inserted within the string.</p>
<p>To execute this flow, we need to first save it by clicking the Save button in the upper-right corner of the page. Once saved, click the Play button. You'll then be presented with the execute options page, as shown in Figure 3 below:</p>
<img src="https://cdn.hashnode.com/uploads/covers/67c9ccd99fc59c702c3edd73/9e31e532-f41b-4921-916f-e803c7bcc900.png" alt="Execute Flow input dialog" style="display:block;margin:0 auto" width="1058" height="490" loading="lazy">

<p>Figure 3: Execute flow options</p>
<p>If this workflow had inputs such as a filename or URL, you can manually enter them here to test your flow. The modal also provides the curl command if you’d like to run the flow via the API instead of the UI.&nbsp;Click the Execute button to run the flow:</p>
<img src="https://cdn.hashnode.com/uploads/covers/67c9ccd99fc59c702c3edd73/a7a2e91c-13f3-4c82-b704-3f2812348a09.png" alt="Flow execution log dialog" style="display:block;margin:0 auto" width="1592" height="940" loading="lazy">

<p>Figure 4: Flow execution log</p>
<p>The flow was simple and wrote the info message to the log file. If the flow had errors or warnings, you'd be able to see detailed execution logs on this page.</p>
<p>Now that we’ve created our first task, let’s schedule it with a cron mask. Add the following to the flow by clicking on the “Edit Flow” button at the top of the page.</p>
<p>Next, add the triggers section to the flow:</p>
<pre><code class="language-yaml">triggers:
  - id: every_minute
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "* * * * *"
</code></pre>
<p>Execute the flow.&nbsp; After a few minutes, check out the execution history by clicking on the “Execution” tab on the left side navbar.</p>
<img src="https://cdn.hashnode.com/uploads/covers/67c9ccd99fc59c702c3edd73/e421c8b1-5aac-4524-934a-f0cc70cb5f8a.png" alt="Flow execution page" style="display:block;margin:0 auto" width="2048" height="359" loading="lazy">

<p>Figure 5: Flow execution page</p>
<p>Our flow now behaves similarly to a single task cron job. The flow has a triggers block with a Schedule trigger whose cron field is the exact same five-field syntax you already know. That last point matters: you're not throwing away what you learned. You're wrapping it in something that can grow as your needs change.</p>
<p>Notice that even in this simple Kestra example, you’ve gained something cron didn't offer. Every time this runs, it's recorded as an execution with a timestamp, a duration, and a status, and all logs are visible in the UI. That's Wall 3 (visibility) handled before we've even done anything interesting.</p>
<h3 id="heading-step-2-real-work-and-a-dependency">Step 2: Real Work, and a Dependency</h3>
<p>Now let's replace the simple task with the three-step extract/transform/load and have the orchestrator enforce the ordering rather than timing offsets.</p>
<pre><code class="language-yaml">id: csv_to_parquet
namespace: company.team
description: Download orders CSV, transform it with a Python script, and write the result to a Parquet file.

tasks:
  # Download a public CSV file into Kestra's internal storage
  - id: download_csv
    type: io.kestra.plugin.core.http.Download
    uri: https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv

  # Transform the CSV with a simple Python script and write it out as Parquet
  - id: transform_to_parquet
    type: io.kestra.plugin.scripts.python.Script
    containerImage: ghcr.io/kestra-io/pydata:latest
    inputFiles:
      input.csv: "{{ outputs.download_csv.uri }}"
    outputFiles:
      - orders.parquet
    script: |
      import pandas as pd

      # Read the downloaded CSV
      df = pd.read_csv("input.csv")

      # --- simple transformation ---
      # Ensure numeric types and add a computed column
      df["total"] = df["quantity"] * df["price"]

      # Keep only orders above a small threshold as an example filter
      df = df[df["total"] &gt; 0]

      print(f"Rows after transform: {len(df)}")

      # Write the result to Parquet
      df.to_parquet("orders.parquet", index=False)

  # Log that the Parquet file was produced
  - id: log_output
    type: io.kestra.plugin.core.log.Log
    message: "Parquet file created: {{ outputs.transform_to_parquet.outputFiles['orders.parquet'] }}"
# Expose the Parquet file as a downloadable flow output.
# FILE-typed flow outputs appear on the execution's Overview tab with a download button.
outputs:
  - id: parquet_file
    type: FILE
    value: "{{ outputs.transform_to_parquet.outputFiles['orders.parquet'] }}"
</code></pre>
<p>Save the flow, then execute.</p>
<img src="https://cdn.hashnode.com/uploads/covers/67c9ccd99fc59c702c3edd73/cd4e0202-4769-4e83-bf1d-c1dec91bae8e.png" alt="Execution results" style="display:block;margin:0 auto" width="2048" height="928" loading="lazy">

<p>Figure 6: Execution results</p>
<p>Two things just happened. First, tasks listed in sequence run in sequence. Transform_to_parquet only starts after download_csv succeeds, and log_output only after transform_to_parquet succeeds.&nbsp;If a failure occurs, the execution stops, and transform_to_parquet never touches stale data. That's <strong>Wall 1 (dependencies)</strong> gone, with no guesswork about timing.</p>
<p>Second, notice the expression within the flow {{ outputs.download_csv.uri }}. Tasks can pass data and metadata to subsequent tasks using expressions like this. That wiring turns a list of scripts into an actual pipeline.</p>
<h3 id="heading-step-3-surviving-failure-with-retries">Step 3: Surviving Failure with Retries</h3>
<p>Now consider the scenario where the download_csv task encounters a network issue, and the flow is unable to download the latest data. Let's make that task resilient declaratively by adding a retry section to the download_csv task:</p>
<pre><code class="language-yaml">- id: download_csv
    type: io.kestra.plugin.core.http.Download
    uri: https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv
    retry:
      type: constant
      maxAttempts: 5
      interval: PT10S
</code></pre>
<p>That's the whole retry policy. If the download fails, Kestra waits and tries again up to 5 times, with a 10-second delay (PT10S is ISO-8601 for "10 seconds"). There are no counters, sleep calls, or flag files. <strong>Wall 2 (failure handling)</strong> is handled in 3 lines that read like a sentence.</p>
<p>To test this, drop the “s” from orders.csv and rerun the flow. You can see the execution showing retrying.</p>
<img src="https://cdn.hashnode.com/uploads/covers/67c9ccd99fc59c702c3edd73/4ab1a70c-9ada-4c99-aec0-5f5ccc48975a.png" alt="Execution dialog showing retry" style="display:block;margin:0 auto" width="2048" height="552" loading="lazy">

<p>Figure 7: Execution showing retry</p>
<p>If all attempts fail, you'll probably want to be notified. Let’s add a flow-level error handler that runs only when something in the workflow fails:</p>
<pre><code class="language-yaml">errors:
  - id: notify_failure
    type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
    url: "{{ secret('SLACK_WEBHOOK') }}"
    payload: |
      {"text": "orders_pipeline failed on execution {{ execution.id }}"}
</code></pre>
<p>Now a broken pipeline pings a Slack channel instead of failing silently at 3 a.m. Note that secrets are protected within flows via the <a href="https://kestra.io/docs/how-to-guides/secrets">secret</a> expression.</p>
<h3 id="heading-step-4-triggering-on-events-not-just-time">Step 4: Triggering on Events, Not Just Time</h3>
<p>Schedules are only one kind of trigger. Suppose orders don't arrive on a fixed timetable. Instead, a file lands in cloud storage whenever an upstream system feels like it.</p>
<p>Polling on a cron schedule ("check every 5 minutes, exit if nothing's there") is wasteful and laggy. Event triggers are the better model: run the workflow when the thing happens.</p>
<p>Conceptually, instead of adding a scheduled trigger similar to the one added in the previous example:</p>
<pre><code class="language-yaml">triggers:
  - id: every_minute
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "* * * * *"
</code></pre>
<p>You can add a trigger that fires when a new object appears in an S3 bucket:</p>
<pre><code class="language-yaml">triggers:
  - id: new_s3_object
    type: io.kestra.plugin.aws.s3.Trigger
    interval: "PT1M"
    accessKeyId: "{{ secret('AWS_ACCESS_KEY_ID') }}"
    secretKeyId: "{{ secret('AWS_SECRET_KEY_ID') }}"
    region: "eu-central-1"
    bucket: "my-bucket"
    prefix: "incoming/"
    on: CREATE
    action: NONE
</code></pre>
<p>Alternatively, you could have a trigger that exposes a webhook URL you can POST to start execution, or <a href="https://kestra.io/docs/how-to-guides/realtime-triggers">real-time triggers</a> that listen to streaming services such as Kafka queues. In any of these trigger scenarios, the workflow body stays identical. Your automation can now respond to the world rather than just watching the clock.</p>
<h3 id="heading-step-5-backfilling-the-past">Step 5: Backfilling the Past</h3>
<p>Finally, consider the bug-in-transform scenario. You've fixed the calculation and need to re-run the pipeline for every day of the last two months.&nbsp;This would be painful in cron.</p>
<p>In an orchestrator, a <a href="https://kestra.io/docs/concepts/backfill">backfill</a> is a first-class operation on a scheduled workflow: you pick a start and end date, and it generates one execution per scheduled interval across that range. Each execution is aware of the date it represents, through an expression like {{ trigger.date }}. Your transform step can use that date to fetch and process the correct slice of data.</p>
<p>This is where idempotency stops being academic. Because a backfill re-runs days you may have already processed, your data load step should write with an "insert or replace" semantic keyed on the date, so running March 14th, for example, twice leaves the database in the same state as running it once.</p>
<p>Design for that and backfills become routine instead of terrifying. <strong>Wall 4 (backfills)</strong> is handled, but only if you've held up your end with idempotent tasks.</p>
<h2 id="heading-where-to-go-next"><strong>Where to Go Next</strong></h2>
<p>The best way to internalize all of this is to take an existing cron job and rebuild it as a proper workflow. Start with the one-task version, confirm it runs and appears in the run history, then add a second dependent task, a retry policy, and a failure alert.</p>
<p>Each step maps to one of the four walls, and you'll feel the difference immediately the first time a task fails, retries itself, and recovers without waking you up.</p>
<p>You don't need to write every line from scratch. Kestra provides a library of <strong>Blueprints</strong> that are hundreds of ready-made, copy-pasteable flows that you can browse at <a href="https://kestra.io/blueprints">kestra.io/blueprints</a> or access directly in your instance under the Blueprints tab.</p>
<p>Each Blueprint is a complete, executable example with an explanation of its functionality and how to extend it. This allows you to start with a close version of your goal and modify it rather than guessing at the syntax.</p>
<p>Cron showed that computers can operate while you're asleep. Orchestration takes it further, ensuring they do so reliably, in order, and visibly. This shift transforms the idea from merely writing a script to managing a full system.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Build AI Workflows with n8n ]]>
                </title>
                <description>
                    <![CDATA[ n8n is a visual, node-based automation platform that lets you automate tasks with drag-and-drop nodes. It’s popular for multi-step automations and AI chains thanks to built-in nodes for agents and app integrations. In this tutorial, you’ll build a sm... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-build-ai-workflows-with-n8n/</link>
                <guid isPermaLink="false">68ed22c02001907a6cb6d50a</guid>
                
                    <category>
                        <![CDATA[ AI ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Workflow Automation ]]>
                    </category>
                
                    <category>
                        <![CDATA[ n8n ]]>
                    </category>
                
                    <category>
                        <![CDATA[ n8n workflows ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Soham Mehta ]]>
                </dc:creator>
                <pubDate>Mon, 13 Oct 2025 16:03:12 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1760371342462/f8874220-238b-4819-a6f1-c35756b355bc.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>n8n is a visual, node-based automation platform that lets you automate tasks with drag-and-drop nodes. It’s popular for multi-step automations and AI chains thanks to built-in nodes for agents and app integrations.</p>
<p>In this tutorial, you’ll build a small personal calendar agent that listens to a chat message, extracts event details, and creates a Google Calendar entry. Along the way, you’ll learn how to set up n8n, add an AI Agent node, and pass structured data between nodes.</p>
<h2 id="heading-table-of-contents"><strong>Table of Contents</strong></h2>
<ol>
<li><p><a class="post-section-overview" href="#heading-prerequisites">Prerequisites</a></p>
<ul>
<li><a class="post-section-overview" href="#heading-how-to-set-up-your-n8n-account">How to Set Up Your n8n Account</a></li>
</ul>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-build-a-personal-calendar-agent">How to Build a Personal Calendar Agent</a></p>
<ul>
<li><p><a class="post-section-overview" href="#heading-step-1-set-up-the-chat-trigger">Step 1: Set Up the Chat Trigger</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-2-configure-the-ai-agent">Step 2: Configure the AI Agent</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-3-add-google-calendar-node">Step 3: Add Google Calendar Node</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-4-time-to-test">Step 4: Time to Test!</a></p>
</li>
</ul>
</li>
<li><p><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></p>
</li>
</ol>
<h2 id="heading-prerequisites">Prerequisites</h2>
<ul>
<li><p>n8n account – setup steps below.</p>
</li>
<li><p><a target="_blank" href="https://support.google.com/accounts/answer/27441">Google account</a> – you’ll create events in Google Calendar.</p>
</li>
</ul>
<h3 id="heading-how-to-set-up-your-n8n-account">How to Set Up Your n8n Account</h3>
<p>You can setup n8n either on the cloud or locally.</p>
<p>To set it up on the cloud (the easiest option), you can create a free trial account on the <a target="_blank" href="https://n8n.io/">n8n website</a>.</p>
<p>If you’d rather self-host via npm, you can install the free <a target="_blank" href="https://www.npmjs.com/package/n8n">n8n npm package</a> and run it on your localhost (here are the <a target="_blank" href="https://docs.n8n.io/hosting/installation/npm/">steps</a> for that).</p>
<p>You can also self-host via <a target="_blank" href="https://www.docker.com/">Docker</a> and run the n8n image on your machine. I’ll walk you through how to do that now.</p>
<p>First, download and install the <a target="_blank" href="https://www.docker.com/">Docker Desktop</a> application.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760074532772/e3987b3e-403c-4a96-b7a7-ed3347acbca0.png" alt="Screenshot of the Docker website showing navigation links and buttons for &quot;Download Docker Desktop&quot; and &quot;Learn about Docker for AI&quot; under the heading &quot;Develop Agents&quot;." class="image--center mx-auto" width="2524" height="690" loading="lazy"></p>
<p>Then click “Search Images” and select the <code>n8nio/n8n</code> image:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760074368306/eff04dd0-dcae-4c34-b5a1-f28c0db72373.png" alt="Docker Desktop interface showing a search for &quot;n8nio&quot; under Images. Several container images are listed with download and star counts. Options to Pull and Run the selected image are visible." class="image--center mx-auto" width="1542" height="452" loading="lazy"></p>
<p>Click <code>run</code> on the image and set your localhost port in the options.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1760076583465/5f0bea8c-8d9d-4703-9561-1ede643c852e.png" alt="Screenshot of a browser window showing a &quot;Set up owner account&quot; page for n8n, a workflow automation tool. The form requires email, first name, last name, and password." class="image--center mx-auto" width="1548" height="498" loading="lazy"></p>
<p>You should now be able to access n8n on your localhost.</p>
<h2 id="heading-how-to-build-a-personal-calendar-agent">How to Build a Personal Calendar Agent</h2>
<p>Now for the fun part! We’re going to build a workflow that listens for a chat message, uses an AI Agent to understand the user's request, and automatically creates a Google Calendar event. This simple workflow highlights n8n’s new AI capabilities.</p>
<p>Here’s a breakdown of the steps we’ll go through below:</p>
<ol>
<li><p>Add a Chat node to send a message to the agent.</p>
</li>
<li><p>Let the AI Agent parse the message and extract key details (title, location, times).</p>
</li>
<li><p>Create a Google calendar event with those details.</p>
</li>
</ol>
<h3 id="heading-step-1-set-up-the-chat-trigger">Step 1: Set Up the Chat Trigger</h3>
<p>Every workflow starts with a trigger. This is the event that kicks everything off. Use a chat trigger that listens for new messages.</p>
<ol>
<li><p>Visit the dashboard at <code>https://&lt;YOUR_USERNAME&gt;.app.n8n.cloud/home/workflows</code> and Click <code>Create Workflow</code>.</p>
</li>
<li><p>Click “Add first step..” and add <code>On chat message</code> as the trigger.</p>
</li>
<li><p>In the node's properties panel, Enable <code>Make Chat Publicly Available</code> (This will provide a URL which you can share with friends to book events on your calendar).</p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759649236134/c9ffc656-26b9-45a1-9c17-a6aa97a9e997.gif" alt="n8n workflow where you click &quot;On chat mesage&quot; as starting node" class="image--center mx-auto" width="2558" height="1024" loading="lazy"></p>
<h3 id="heading-step-2-configure-the-ai-agent">Step 2: Configure the AI Agent</h3>
<p>This node is the “brain” of the workflow. The AI Agent node can understand natural language, make decisions, and extract structured data. Each agent has 4 main modules: model, prompt, tools, and output.</p>
<h4 id="heading-1-setup-the-model">1. Setup the Model</h4>
<p>Click the <strong>+</strong> icon after the trigger node and add the <code>AI Agent</code> node. The AI Agent needs a model to power its reasoning. Click + below <code>Chat Model</code> and select <code>OpenAI Chat Model</code> node.</p>
<p>Then select <code>n8n free OpenAI API credits</code> as your credential for now**.** In the future, you can sign up on the <a target="_blank" href="https://platform.openai.com/">OpenAI Platform</a> website and navigate to the "API keys" section to create a new secret key</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759692503994/ac37a0bf-1d39-4fbe-9393-94fda82ea7a8.gif" alt="Click &quot;AI agent&quot; node and select the OpenAI chat model " class="image--center mx-auto" width="2558" height="1024" loading="lazy"></p>
<h4 id="heading-2-enable-date-time-tool">2. Enable date time tool</h4>
<p>A tool is a connected node the agent can call during execution to perform actions (like fetching data, formatting dates, or running code) rather than only reasoning in text. We will be using the “Date Time” tool to convert the user readable date into a <a target="_blank" href="https://help.clicksend.com/en/articles/44235-what-is-a-unix-timestamp">Unix Timestamp</a> before calling the Google calendar API.</p>
<p>Here are the steps to enable this tool:</p>
<ol>
<li><p>Click the + button below the AI Agent Tool</p>
</li>
<li><p>Find the Date &amp; Time tool</p>
</li>
<li><p>Set Operation as <code>Format a Date</code></p>
</li>
<li><p>Select Date as <code>Defined automatically by the model</code> (allow agent to pass date itself)</p>
</li>
<li><p>Select Format as <code>Unix Timestamp</code></p>
</li>
<li><p>Rename Output field name to <code>unixTime</code></p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759692990713/e59e5f3e-4898-4aeb-af3a-e7dffbb44615.gif" alt="n8n workflow where we click the Tool under AI agent and select the Date time tool and select &quot;Unix timestamp&quot; for format" class="image--center mx-auto" width="2558" height="1024" loading="lazy"></p>
<h4 id="heading-3-add-agent-prompt">3. Add agent prompt</h4>
<p>An agent prompt is the set of instructions and context you give an AI Agent that defines its behavior, goals, and how it should interpret or respond to user inputs.</p>
<ol>
<li><p>Double-click the AI Agent to edit the prompt.</p>
</li>
<li><p>Select Source for Prompt (User Message) as <code>Define below</code></p>
</li>
<li><p>Copy the following prompt in the Prompt (User Message)</p>
</li>
</ol>
<pre><code class="lang-plaintext">## Overview
You are an agent which helps parse the user message to identify the following details:
1. The title for the meeting
2. The location of the meeting
3. The meeting start and end Unix times.

Here is the User Message: {{ $json.chatInput }}

## Rules for event time identification:
- The current date time now is: {{ $now }}
- Resolve relative phrases like "tomorrow", "next Friday", "in 2 hours" relative to now.
- If duration given (e.g., "30 min" or "2 hours"), compute end_time from start_time.
- If only a start time given, default duration = 60 minutes.

## Getting event_start and event_end unix
- Use the "Date &amp; Time" tool to convert the computed event start and end time to unixtime.
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759693520456/df1a9a71-f790-42c3-9128-7289aaa35b22.gif" alt="User interface of the n8n workflow editor displaying a workflow named &quot;My workflow 2.&quot; The screen shows nodes including &quot;When chat message received,&quot; &quot;AI Agent,&quot; and connections to OpenAI Chat Model and Date &amp; Time. The user is interacting with the interface, and various menu options are visible on the left sidebar." class="image--center mx-auto" width="2558" height="1024" loading="lazy"></p>
<h4 id="heading-4-set-up-structured-output">4. Set up structured output</h4>
<ol>
<li><p>Enable the <code>Require Specific Output Format</code> switch in AI Agent</p>
</li>
<li><p>Click + below Output Parser and select <code>Structured Output Parser</code></p>
</li>
<li><p>Copy the following example JSON which we want to extract from user message</p>
</li>
</ol>
<pre><code class="lang-json">{
    <span class="hljs-attr">"meeting_title"</span>: <span class="hljs-string">"Learn Geometry"</span>,
    <span class="hljs-attr">"meeting_location"</span>: <span class="hljs-string">"Library"</span>,
    <span class="hljs-attr">"event_start"</span>: <span class="hljs-number">1759644763</span>,
    <span class="hljs-attr">"event_end"</span>: <span class="hljs-number">1759644764</span>
}
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759693798967/bc8ba49e-09f3-43ed-9278-1cd4ada54560.gif" alt="Screenshot of an AI agent interface with a dialogue box showing parameters such as source for the user message and options for enabling specific output format. The workspace also displays input and output sections with no data." class="image--center mx-auto" width="2558" height="1024" loading="lazy"></p>
<h3 id="heading-step-3-add-google-calendar-node">Step 3: Add Google Calendar Node</h3>
<p>The final step is to take the structured data from the AI Agent and create the calendar event.</p>
<ol>
<li><p>Click the <strong>+</strong> icon after the AI Agent node and search for the <strong>Google Calendar</strong> node.</p>
</li>
<li><p>Select Resource as <code>Event</code> and Operation as <code>Create</code></p>
</li>
<li><p>Create new OAuth2 credentials and sign in to your Google account. You'll be prompted to sign in to Google and grant N8N permission.</p>
</li>
</ol>
<p>Now, you’re going to map the data from the AI Agent to the fields in the Google Calendar node. This is where the magic happens.</p>
<ol>
<li><p>Select Start as <code>{{ DateTime.fromSeconds($json.output.event_start).toFormat("yyyy-MM-dd HH:mm:ss") }}</code></p>
</li>
<li><p>Select End as <code>{{ DateTime.fromSeconds($json.output.event_end).toFormat("yyyy-MM-dd HH:mm:ss") }}</code></p>
</li>
<li><p>Select Location as <code>{{ $json.output.meeting_location }}</code></p>
</li>
<li><p>Select Summary as <code>{{ $json.output.meeting_title }}</code></p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759696195078/a35054a9-5c3d-44e8-9a30-5539f3675525.gif" alt="Workflow automation interface displaying a chat message integration with an AI agent, using nodes for OpenAI Chat Model, Date &amp; Time, and Structured Output Parser. Sidebar shows options for AI, app actions, data transformation, and more. A save button and trial information are visible at the top. Add &quot;Google Calender&quot; create event node" class="image--center mx-auto" width="2558" height="1024" loading="lazy"></p>
<h3 id="heading-step-4-time-to-test">Step 4: Time to Test!</h3>
<p>That’s it! You now have an AI-powered workflow that creates events on your calendar. You can activate your workflow using the toggle at the top of the screen. Click “Open Chat” to initiate a chat conversation and send a message. You will see the entire workflow in action along with input and output of each node</p>
<p>You can also click on the Google calendar node to find the <code>htmlLink</code> column which will provide a URL where you can see your created event.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759696671635/a98acab0-2fa6-4c86-976e-996d5af00c59.gif" alt="A workflow automation setup in n8n showing a process where a chat message triggers an AI agent, which interacts with the OpenAI Chat Model and a Structured Output Parser to create an event. The interface includes various options like adding projects, templates, and accessing the admin panel." class="image--center mx-auto" width="2558" height="1024" loading="lazy"></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In this tutorial, you’ve learned how to build a simple, AI-driven automation workflow in n8n’s visual interface. The true power lies in creating personalized AI workflows by easily customizing your own agent, prompt, and tools to fit your exact needs.</p>
<p>n8n's ecosystem thrives on <a target="_blank" href="https://n8n.io/workflows/">community templates</a>, allowing you to utilize thousands of pre-built solutions or share your own creations with the community. If this guide helped you, try extending the workflow on your own and explore the n8n docs for more nodes. Happy coding!</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
