Browse documentation

Functions

Functions

Create, AI-draft, deploy, edit, test, secure, monitor, and call serverless functions from workflows.

DevelopersAutomation buildersAdvancedAvailable

What this guide covers

  • Functions run custom JavaScript logic in a deployed Cloudflare-based runtime and become selectable by the workflow Function node.
  • Prerequisites: Code must define async function handler(request, env).
  • Result: Status is Deployed, a JSON test returns the expected result, and invocation history records calls.
  • Limit: Saving changes redeploys the function. AI-generated code is a draft and requires security and correctness review.

What this is and when to use it

Functions run custom JavaScript logic in a deployed Cloudflare-based runtime and become selectable by the workflow Function node.

When to use Functions
Use it whenExpected outcome
A supported node or integration cannot perform a required transformation or server-side call.Status is Deployed, a JSON test returns the expected result, and invocation history records calls.

Before you begin

  1. Code must define async function handler(request, env).
  2. Only deployed functions are selectable by a Function node.
  3. Secrets belong in Environment Secrets, not source code or AI prompts.

Complete the task

  1. Open Agent Project → Functions and select Create Function.
  2. Name the function and write code or request an AI draft.
  3. Review AI output before applying.
  4. Create and deploy.
  5. Open the function to edit code, add secrets, run JSON tests, and review invocation history.
  6. Save & redeploy after changes.
  7. Select it in a workflow Function node and set a 1–60 second node timeout.

Confirm it worked

  1. Status is Deployed, a JSON test returns the expected result, and invocation history records calls.

Common problems

Functions troubleshooting
SymptomWhat to check
Function is not selectableDeploy it successfully first.
Test is disabledThe function must be deployed.
Invocation times outReduce work or adjust the Function node timeout within 1–60 seconds.

Current limitations

Saving changes redeploys the function. AI-generated code is a draft and requires security and correctness review.

Where to go next