REST API

Workflow

Derived from the source of github.com/awee-ai/api/cmd/workflow.

Awee Workflow API · v1.0.0 · 6 endpoints

Activity

POST/v1/activity/publishAuth

Ingests an ActivityEvent from a trusted producer and fans it out to the hub on the event's org topic, plus the app topic when an app id is set

It authenticates with a shared service token compared in constant time, so it is mounted outside the browser-facing Logto middleware. A missing or wrong token is rejected, and an event without an org id has nowhere to route so it is refused too.

activity.PublishHandler

Body

application/jsonrequired
actor_idstring
actor_typestring
app_idstring
automation_idstring
dbstring

record mutation identity, set on record.* events.

kindActivityKindrequired

Discriminates the lifecycle stage an ActivityEvent describes.

org_idstring
payloadobject
record_idstring
run_idstring
sourcestring
statusstring
tablestring
tsstring (date-time)required
workflow_idstring

Responses

202 AcceptedAccepted

No response body.

400 Bad RequestBad Request
string
401 UnauthorizedUnauthorized
string
Request body
{
  "actor_id": "string",
  "actor_type": "string",
  "app_id": "string",
  "automation_id": "string",
  "db": "string",
  "kind": "string",
  "org_id": "string",
  "payload": {},
  "record_id": "string",
  "run_id": "string",
  "source": "string",
  "status": "string",
  "table": "string",
  "ts": "2024-01-15T09:30:00Z",
  "workflow_id": "string"
}
400 Bad Request
"string"
GET/v1/activity/streamAuth

GET /v1/activity/stream

getV1ActivityStream

Query parameters

appstring

Responses

200 OKOK
string
401 UnauthorizedUnauthorized
string
Request

No request body.

200 OK
"string"

Runner

POST/v1/runner/{id}/planAuth

Handles POST /v1/runner/{id}/plan

rest.Handler.PlanWorkflow.post_v1_runner_id_plan

Path parameters

idstringrequired

Body

application/jsonrequired
globalsobject
varsVars

Groups the three variable sources available to a workflow: config-level vars, environment variables, and user-supplied globals.

Configobject

represents variables present on the pipeline.Config vars field

Envobject

represents environment variables

Userobject

global represents variables passed into the pipeline e.g.

Responses

200 OKOK
planExecutionPlan

Represents the complete execution strategy for a workflow.

config_idstringrequired

Config.ID is the canonical name e.g.

config_namestringrequired

Is the workflow name

config_varsobject

Holds the original config-level variables

outputsobject

Maps output variable names to their template expressions

*stringany additional property
plan_idstringrequired

Uniquely identifies this workflow execution

stepsExecutionStep[]

Is the root-level execution steps

cacheCacheConfig

Controls how long a step's outputs are cached.

forstringrequired
componentstringrequired

Name to execute

conditionstring

Holds the "if" expression (empty if no condition)

descriptionstring

From Action.Description

disabledboolean

Flag

elseExecutionStep

Represents a single executable unit in the plan.

Recurses into ExecutionStep, shown above.

idstringrequired

Is hierarchical: "1", "1.1", "1.2.1", etc.

namestringrequired

From Action.Name

planExecutionPlan

Represents the complete execution strategy for a workflow.

Recurses into ExecutionPlan, shown above.

plan_idstringrequired

Is the parent plan ID

retryRetryConfig

Controls how many times a failing step is retried and the delay between attempts.

countinteger (int64)required
delayinteger (int64)required

in seconds

run_idstringrequired

Uniquely identifies this step execution (UUID)

stepsExecutionStep[]

For nested actions

varsobject

To pass (unresolved at plan time)

400 Bad Requestthe request could not be completed
errorstringrequired
Defaultthe request could not be completed
errorstringrequired
Request body
{
  "globals": {},
  "vars": {
    "Config": {},
    "Env": {},
    "User": {}
  }
}
200 OK
{
  "plan": {
    "config_id": "string",
    "config_name": "string",
    "config_vars": {},
    "outputs": {
      "key": "string"
    },
    "plan_id": "string",
    "steps": [
      {
        "cache": {
          "for": "string"
        },
        "component": "string",
        "condition": "string",
        "description": "string",
        "disabled": true,
        "else": null,
        "id": "string",
        "name": "string",
        "plan": null,
        "plan_id": "string",
        "retry": {
          "count": 0,
          "delay": 0
        },
        "run_id": "string",
        "steps": [
          null
        ],
        "vars": {}
      }
    ]
  }
}
POST/v1/runner/{id}/runAuth

Handles POST /v1/runner/{id}/run

Reserved identity fields (org_id, user_id) are rejected from the request body with 400 — clients must never supply them. The server injects the values from the authenticated request context (Logto org access token) into the workflow globals before executing, so a hostile client cannot forge them.

rest.Handler.RunWorkflow.post_v1_runner_id_run

Path parameters

idstringrequired

Body

application/jsonrequired
asyncboolean
globalsobject

Responses

200 OKOK
metricsExposedComponentMetric[]
actionstringrequired
componentstringrequired
cost_generalWorkflowGeneralCost

Accumulates the non-inference resource cost of a workflow.

bytes_deletedinteger (int64)
bytes_readinteger (int64)
bytes_writteninteger (int64)
cost_clientMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
cost_providerMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
files_deletedinteger (int64)
files_readinteger (int64)
files_writteninteger (int64)
network_bytes_readinteger (int64)
network_bytes_writteninteger (int64)
took_msinteger (int64)
cost_inferenceWorkflowInferenceCost

Accumulates the inference cost incurred by a workflow.

cost_clientMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
cost_providerMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
estimate_input_cost_clientMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
estimate_input_cost_providerMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
estimate_input_tokensinteger (int64)
estimate_took_msinteger (int64)
input_cost_clientMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
input_cost_providerMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
input_tokensinteger (int64)
input_took_msinteger (int64)
modelstring
output_cost_clientMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
output_cost_providerMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
output_tokensinteger (int64)
output_took_msinteger (int64)
providerstring
thinking_cost_clientMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
thinking_cost_providerMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
thinking_tokensinteger (int64)
thinking_took_msinteger (int64)
tokensinteger (int64)
took_msinteger (int64)
idstringrequired
iterationinteger (int64)required

-1 for non-loop, 0+ for loop iterations

retriesinteger (int64)required
run_idstringrequired

unique step execution ID (UUID)

step_idstringrequired

hierarchical step ID (e.g., "1", "1.1", "2.iter.0.1")

took_msinteger (int64)required
outputsobject
run_idstring
statusstring
400 Bad Requestthe request could not be completed
errorstringrequired
Defaultthe request could not be completed
errorstringrequired
Request body
{
  "async": true,
  "globals": {}
}
200 OK
{
  "metrics": [
    {
      "action": "string",
      "component": "string",
      "cost_general": {
        "bytes_deleted": 0,
        "bytes_read": 0,
        "bytes_written": 0,
        "cost_client": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "cost_provider": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "files_deleted": 0,
        "files_read": 0,
        "files_written": 0,
        "network_bytes_read": 0,
        "network_bytes_written": 0,
        "took_ms": 0
      },
      "cost_inference": {
        "cost_client": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "cost_provider": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "estimate_input_cost_client": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "estimate_input_cost_provider": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "estimate_input_tokens": 0,
        "estimate_took_ms": 0,
        "input_cost_client": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "input_cost_provider": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "input_tokens": 0,
        "input_took_ms": 0,
        "model": "string",
        "output_cost_client": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "output_cost_provider": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "output_tokens": 0,
        "output_took_ms": 0,
        "provider": "string",
        "thinking_cost_client": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "thinking_cost_provider": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "thinking_tokens": 0,
        "thinking_took_ms": 0,
        "tokens": 0,
        "took_ms": 0
      },
      "id": "string",
      "iteration": 0,
      "retries": 0,
      "run_id": "string",
      "step_id": "string",
      "took_ms": 0
    }
  ],
  "outputs": {},
  "run_id": "string",
  "status": "string"
}
POST/v1/runner/automations/{id}/planAuth

Handles POST /v1/runner/{id}/plan

rest.Handler.PlanWorkflow.post_v1_runner_automations_id_plan

Path parameters

idstringrequired

Body

application/jsonrequired
globalsobject
varsVars

Groups the three variable sources available to a workflow: config-level vars, environment variables, and user-supplied globals.

Configobject

represents variables present on the pipeline.Config vars field

Envobject

represents environment variables

Userobject

global represents variables passed into the pipeline e.g.

Responses

200 OKOK
planExecutionPlan

Represents the complete execution strategy for a workflow.

config_idstringrequired

Config.ID is the canonical name e.g.

config_namestringrequired

Is the workflow name

config_varsobject

Holds the original config-level variables

outputsobject

Maps output variable names to their template expressions

*stringany additional property
plan_idstringrequired

Uniquely identifies this workflow execution

stepsExecutionStep[]

Is the root-level execution steps

cacheCacheConfig

Controls how long a step's outputs are cached.

forstringrequired
componentstringrequired

Name to execute

conditionstring

Holds the "if" expression (empty if no condition)

descriptionstring

From Action.Description

disabledboolean

Flag

elseExecutionStep

Represents a single executable unit in the plan.

Recurses into ExecutionStep, shown above.

idstringrequired

Is hierarchical: "1", "1.1", "1.2.1", etc.

namestringrequired

From Action.Name

planExecutionPlan

Represents the complete execution strategy for a workflow.

Recurses into ExecutionPlan, shown above.

plan_idstringrequired

Is the parent plan ID

retryRetryConfig

Controls how many times a failing step is retried and the delay between attempts.

countinteger (int64)required
delayinteger (int64)required

in seconds

run_idstringrequired

Uniquely identifies this step execution (UUID)

stepsExecutionStep[]

For nested actions

varsobject

To pass (unresolved at plan time)

400 Bad Requestthe request could not be completed
errorstringrequired
Defaultthe request could not be completed
errorstringrequired
Request body
{
  "globals": {},
  "vars": {
    "Config": {},
    "Env": {},
    "User": {}
  }
}
200 OK
{
  "plan": {
    "config_id": "string",
    "config_name": "string",
    "config_vars": {},
    "outputs": {
      "key": "string"
    },
    "plan_id": "string",
    "steps": [
      {
        "cache": {
          "for": "string"
        },
        "component": "string",
        "condition": "string",
        "description": "string",
        "disabled": true,
        "else": null,
        "id": "string",
        "name": "string",
        "plan": null,
        "plan_id": "string",
        "retry": {
          "count": 0,
          "delay": 0
        },
        "run_id": "string",
        "steps": [
          null
        ],
        "vars": {}
      }
    ]
  }
}
POST/v1/runner/automations/{id}/runAuth

Handles POST /v1/runner/{id}/run

Reserved identity fields (org_id, user_id) are rejected from the request body with 400 — clients must never supply them. The server injects the values from the authenticated request context (Logto org access token) into the workflow globals before executing, so a hostile client cannot forge them.

rest.Handler.RunWorkflow.post_v1_runner_automations_id_run

Path parameters

idstringrequired

Body

application/jsonrequired
asyncboolean
globalsobject

Responses

200 OKOK
metricsExposedComponentMetric[]
actionstringrequired
componentstringrequired
cost_generalWorkflowGeneralCost

Accumulates the non-inference resource cost of a workflow.

bytes_deletedinteger (int64)
bytes_readinteger (int64)
bytes_writteninteger (int64)
cost_clientMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
cost_providerMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
files_deletedinteger (int64)
files_readinteger (int64)
files_writteninteger (int64)
network_bytes_readinteger (int64)
network_bytes_writteninteger (int64)
took_msinteger (int64)
cost_inferenceWorkflowInferenceCost

Accumulates the inference cost incurred by a workflow.

cost_clientMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
cost_providerMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
estimate_input_cost_clientMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
estimate_input_cost_providerMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
estimate_input_tokensinteger (int64)
estimate_took_msinteger (int64)
input_cost_clientMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
input_cost_providerMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
input_tokensinteger (int64)
input_took_msinteger (int64)
modelstring
output_cost_clientMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
output_cost_providerMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
output_tokensinteger (int64)
output_took_msinteger (int64)
providerstring
thinking_cost_clientMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
thinking_cost_providerMoney

Is a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.

currency_codestring
nanosinteger (int32)
rateinteger (int64)
unitsinteger (int64)
thinking_tokensinteger (int64)
thinking_took_msinteger (int64)
tokensinteger (int64)
took_msinteger (int64)
idstringrequired
iterationinteger (int64)required

-1 for non-loop, 0+ for loop iterations

retriesinteger (int64)required
run_idstringrequired

unique step execution ID (UUID)

step_idstringrequired

hierarchical step ID (e.g., "1", "1.1", "2.iter.0.1")

took_msinteger (int64)required
outputsobject
run_idstring
statusstring
400 Bad Requestthe request could not be completed
errorstringrequired
Defaultthe request could not be completed
errorstringrequired
Request body
{
  "async": true,
  "globals": {}
}
200 OK
{
  "metrics": [
    {
      "action": "string",
      "component": "string",
      "cost_general": {
        "bytes_deleted": 0,
        "bytes_read": 0,
        "bytes_written": 0,
        "cost_client": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "cost_provider": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "files_deleted": 0,
        "files_read": 0,
        "files_written": 0,
        "network_bytes_read": 0,
        "network_bytes_written": 0,
        "took_ms": 0
      },
      "cost_inference": {
        "cost_client": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "cost_provider": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "estimate_input_cost_client": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "estimate_input_cost_provider": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "estimate_input_tokens": 0,
        "estimate_took_ms": 0,
        "input_cost_client": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "input_cost_provider": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "input_tokens": 0,
        "input_took_ms": 0,
        "model": "string",
        "output_cost_client": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "output_cost_provider": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "output_tokens": 0,
        "output_took_ms": 0,
        "provider": "string",
        "thinking_cost_client": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "thinking_cost_provider": {
          "currency_code": "string",
          "nanos": 0,
          "rate": 0,
          "units": 0
        },
        "thinking_tokens": 0,
        "thinking_took_ms": 0,
        "tokens": 0,
        "took_ms": 0
      },
      "id": "string",
      "iteration": 0,
      "retries": 0,
      "run_id": "string",
      "step_id": "string",
      "took_ms": 0
    }
  ],
  "outputs": {},
  "run_id": "string",
  "status": "string"
}