Skip to content
Technical preview. This site is published for review. Everything on it, including the API, tokens and module protocol, is subject to change.

Runs your workflows durably, start to finish.

AutoFlow turns a small Starlark program into a durable workflow. Call APIs, enforce policies, wait for people, coordinate across projects: every step is recorded, so the workflow picks up exactly where it left off, whatever happens in between.

deploy_approval.star - An AutoFlow workflow with Human-in-the-loop
load("module:policy", "evaluate", "REQUIRE_APPROVAL", "ALLOW")
load("module:gitlab", "call_api", "post_value")

def main(w, project_id, environment, token):
    headers = {
        "Authorization": "Bearer " + token,
        "Content-Type": "application/json",
    }

    decision = gather(evaluate(
        trigger = "com.gitlab.deploy.requested",
        resource = "projects/%d/environments/%s" % (project_id, environment),
    ))
    if decision["verdict"] == REQUIRE_APPROVAL:
        reply = channel()
        gather(post_value(
            "/api/v4/projects/%d/deploy_approvals" % project_id,
            value = {"environment": environment, "reply": reply},
            headers = headers,
        ))
        if gather(reply, timeout = 3 * 24 * time.hour) != "approved":
            fail("deployment not approved")
    elif decision["verdict"] != ALLOW:
        fail("deployment denied by policy")

    status, _, _, err = gather(call_api(
        "POST",
        "/api/v4/projects/%d/deployments" % project_id,
        headers = headers,
        body = json.encode({"environment": environment}),
    ))
    return status

Recorded history

  1. Workflow created
  2. Policy evaluation scheduled
  3. Policy evaluation completed: approval required
  4. Approval request scheduled
  5. Approval request completed: posted to GitLab
  6. Waiting for the answertimer started for 3 days, holding no resources
  7. Channel value received: approved
  8. Deployment call scheduled
  9. Deployment call completed: status 201
  10. Workflow completed

Durable

Every step is recorded. After a crash or a restart, a workflow resumes from its history instead of starting over.

Sandboxed Starlark

No I/O, no wall clock, no randomness inside the script. Every side effect is a module action that AutoFlow runs and records.

Governed

A workflow asks the policy module for a verdict before it acts: proceed, stop, or hand the decision to a person and wait for the answer.

Extensible

Modules add actions over gRPC and protobuf, in any language; a Go SDK is provided. Built in today: gitlab, policy, event and gitlab-function.

How it works

  1. Write a workflow definition

    A short Starlark program with a main function that loads modules and gathers the results of their actions.

  2. Start it over gRPC

    Call StartWorkflow on AutoFlow’s gRPC API with the definition and its arguments.

  3. AutoFlow runs it on autocore

    Everything the workflow does outside the interpreter is recorded in its history, so it resumes from that history after a restart or a failure.

  4. Interact with it while it runs

    Read its state and result, send it values or cancel it: the same gRPC API covers the workflow’s whole lifecycle.

Where it stands

AutoFlow is available to GitLab teams through the gRPC API today. A local try-out via Caproni is coming; the roadmap lives in the Theseus epic. The status page lists what works today and what is planned.

New here

What AutoFlow is and why it exists

Read the overview

Ready to build

Start a workflow over gRPC in ten minutes

Get started

Curious how it works

The engine underneath, explained without jargon

Read the deep dive