Workflows

Workflows quickstart

Write a workflow

Save this as hello.axg:

axg 1
workflow hello {
  input name
  greet = agent greeter:
    "Write a one-line friendly greeting for {{ input.name }}."
  greet -> return {
    greeting: greet.response
  }
}

Line by line:

  • axg 1 - the version header (required).
  • workflow hello { … } - names the workflow.
  • input name - declares a run input you'll pass in; read it as input.name.
  • greet = agent greeter: "…" - a node named greet that runs the registered agent greeter with a prompt. {{ input.name }} is substituted at runtime.
  • greet -> return { … } - when greet finishes, complete the run; greet.response is the agent's text output, and the object becomes the run's result.

(The agent key greeter must be a registered agent. Use whatever keys exist in your deployment.)

The AXG source compiles to a three-node DAG.Drag to pan · scroll to zoom

Check it compiles

axl workflow check hello.axg

This validates the graph locally - no run is created. You'll get line-pointed errors for anything malformed (unknown node references, cycles, missing fields).

Submit it

curl -sX POST "$AXL_HOST/api/v1/workflow/flow/source?name=hello&input=%7B%22name%22%3A%22Ada%22%7D" \
  -H "Authorization: Bearer $TOKEN" \
  --data-binary @hello.axg

?input= is URL-encoded JSON ({"name":"Ada"} above). The response is the standard envelope:

{ "status": 202, "msg": "Accepted", "data": { "run_id": "wf_…", "status": "queued" } }

Grab data.run_id.

Watch it run

Poll the run document:

curl -s "$AXL_HOST/api/v1/workflow/flow/$RUN_ID" -H "Authorization: Bearer $TOKEN"

…or stream events live:

curl -sN "$AXL_HOST/api/v1/workflow/flow/$RUN_ID/events" -H "Authorization: Bearer $TOKEN"

When status is completed, the run's output holds your { greeting: … }.

Notes

  • Every /api/v1 route needs a Bearer token (a JWT or an axl_key_ API key).
  • Successful JSON responses are wrapped as { status, msg, data } - your payload is under data.
  • You can also submit a pre-compiled JSON graph to POST /workflow/flow, or register a definition by name and run it repeatedly - see the Operations Guide.

Next

  • Language Guide - how the language works.
  • Tutorials - build up from this to branches, loops, parallelism, and more.

On this page