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 asinput.name.greet = agent greeter: "…"- a node namedgreetthat runs the registered agentgreeterwith a prompt.{{ input.name }}is substituted at runtime.greet -> return { … }- whengreetfinishes, complete the run;greet.responseis 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.)
Check it compiles
axl workflow check hello.axgThis 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/v1route needs a Bearer token (a JWT or anaxl_key_API key). - Successful JSON responses are wrapped as
{ status, msg, data }- your payload is underdata. - 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.