Code automations

When notifications, emails, and webhooks aren't enough, write the logic yourself. The Code action runs a Python script as an automation step — against your data, in a secure, isolated sandbox. What the script does is up to you: the possibilities are as wide as code.

Three ways to write the code

  • Describe it in the Agent Chat — the agent writes the script, wires the trigger, stores the Secrets, tests it, and deploys. This is the vibecoded path: automation in minutes, no developer required.
  • Let your own LLM write it — any agent connected over MCP can create and edit code automations the same way.
  • Write it by hand — a code editor in the automation's settings, for developers who want full control.

How a Code step works

def main(input):
    # your logic — work with the record that triggered the run,
    # call an external API, compute, decide…
    return {"status": "processed"}
  • Inputs are detected from your code — reference what you need and the editor picks it up.
  • The output schema comes from a test run — run the step once and its output becomes typed data the next steps in the automation can use.
  • Runs are logged — every execution keeps its output and result, in the automation's log (the Agent Chat can read it too — ask it "why did last night's run fail?").

Secrets stay secret

API keys and credentials the code needs live in the secure vault, never in the code:

  • Add a Secret in the automation's settings — or through the Agent Chat, where it's entered in a secure form so the value never touches the chat.
  • At runtime the Secret is injected into the sandbox — it doesn't appear in the code, the chat, or the logs.

The sandbox

Each run executes in an isolated environment that exists only for that run — separated from other automations, other users, and other systems. It gets your inputs and Secrets, does its work, returns its output, and is gone.

Trigger it however you need

A Code step runs from any trigger: when a record is created, updated, or deleted, at a scheduled time, or on demand — including straight from the Agent Chat.

What people build with it

  • Enrichment — on new record, call an external API (key stored as a Secret) and fill in the missing fields.
  • Scheduled digests — every morning, aggregate yesterday's records and post the summary where the team lives.
  • Guardrails — validate incoming data with real logic, beyond what formulas can express, and flag what fails.
  • Custom sync — push changes to an internal system that has an API but no Make app.

Next