REST API
Workflow
Derived from the source of github.com/awee-ai/api/cmd/workflow.
Awee Workflow API · v1.0.0 · 6 endpoints
Activity
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/jsonrequiredactor_idstringactor_typestringapp_idstringautomation_idstringdbstringrecord mutation identity, set on record.* events.
kindActivityKindrequiredDiscriminates the lifecycle stage an ActivityEvent describes.
org_idstringpayloadobjectrecord_idstringrun_idstringsourcestringstatusstringtablestringtsstring (date-time)requiredworkflow_idstringResponses
No response body.
400 Bad RequestBad Request
401 UnauthorizedUnauthorized
{
"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"
}"string"GET /v1/activity/stream
getV1ActivityStream
Query parameters
appstringResponses
200 OKOK
401 UnauthorizedUnauthorized
No request body.
"string"Runner
Handles POST /v1/runner/{id}/plan
rest.Handler.PlanWorkflow.post_v1_runner_id_plan
Path parameters
idstringrequiredBody
application/jsonrequiredglobalsobjectvarsVarsGroups the three variable sources available to a workflow: config-level vars, environment variables, and user-supplied globals.
varsVarsConfigobjectrepresents variables present on the pipeline.Config vars field
Envobjectrepresents environment variables
Userobjectglobal represents variables passed into the pipeline e.g.
Responses
200 OKOK
planExecutionPlanRepresents the complete execution strategy for a workflow.
planExecutionPlanconfig_idstringrequiredConfig.ID is the canonical name e.g.
config_namestringrequiredIs the workflow name
config_varsobjectHolds the original config-level variables
outputsobjectMaps output variable names to their template expressions
outputsobject*stringany additional propertyplan_idstringrequiredUniquely identifies this workflow execution
stepsExecutionStep[]Is the root-level execution steps
stepsExecutionStep[]cacheCacheConfigControls how long a step's outputs are cached.
cacheCacheConfigforstringrequiredcomponentstringrequiredName to execute
conditionstringHolds the "if" expression (empty if no condition)
descriptionstringFrom Action.Description
disabledbooleanFlag
elseExecutionStepRepresents a single executable unit in the plan.
Recurses into ExecutionStep, shown above.
idstringrequiredIs hierarchical: "1", "1.1", "1.2.1", etc.
namestringrequiredFrom Action.Name
planExecutionPlanRepresents the complete execution strategy for a workflow.
Recurses into ExecutionPlan, shown above.
plan_idstringrequiredIs the parent plan ID
retryRetryConfigControls how many times a failing step is retried and the delay between attempts.
retryRetryConfigcountinteger (int64)requireddelayinteger (int64)requiredin seconds
run_idstringrequiredUniquely identifies this step execution (UUID)
stepsExecutionStep[]For nested actions
varsobjectTo pass (unresolved at plan time)
400 Bad Requestthe request could not be completed
errorstringrequiredDefaultthe request could not be completed
errorstringrequired{
"globals": {},
"vars": {
"Config": {},
"Env": {},
"User": {}
}
}{
"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": {}
}
]
}
}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
idstringrequiredBody
application/jsonrequiredasyncbooleanglobalsobjectResponses
200 OKOK
metricsExposedComponentMetric[]
metricsExposedComponentMetric[]actionstringrequiredcomponentstringrequiredcost_generalWorkflowGeneralCostAccumulates the non-inference resource cost of a workflow.
cost_generalWorkflowGeneralCostbytes_deletedinteger (int64)bytes_readinteger (int64)bytes_writteninteger (int64)cost_clientMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
cost_clientMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)cost_providerMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
cost_providerMoneycurrency_codestringnanosinteger (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_inferenceWorkflowInferenceCostAccumulates the inference cost incurred by a workflow.
cost_inferenceWorkflowInferenceCostcost_clientMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
cost_clientMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)cost_providerMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
cost_providerMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)estimate_input_cost_clientMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
estimate_input_cost_clientMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)estimate_input_cost_providerMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
estimate_input_cost_providerMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)estimate_input_tokensinteger (int64)estimate_took_msinteger (int64)input_cost_clientMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
input_cost_clientMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)input_cost_providerMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
input_cost_providerMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)input_tokensinteger (int64)input_took_msinteger (int64)modelstringoutput_cost_clientMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
output_cost_clientMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)output_cost_providerMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
output_cost_providerMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)output_tokensinteger (int64)output_took_msinteger (int64)providerstringthinking_cost_clientMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
thinking_cost_clientMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)thinking_cost_providerMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
thinking_cost_providerMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)thinking_tokensinteger (int64)thinking_took_msinteger (int64)tokensinteger (int64)took_msinteger (int64)idstringrequirediterationinteger (int64)required-1 for non-loop, 0+ for loop iterations
retriesinteger (int64)requiredrun_idstringrequiredunique step execution ID (UUID)
step_idstringrequiredhierarchical step ID (e.g., "1", "1.1", "2.iter.0.1")
took_msinteger (int64)requiredoutputsobjectrun_idstringstatusstring400 Bad Requestthe request could not be completed
errorstringrequiredDefaultthe request could not be completed
errorstringrequired{
"async": true,
"globals": {}
}{
"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"
}Handles POST /v1/runner/{id}/plan
rest.Handler.PlanWorkflow.post_v1_runner_automations_id_plan
Path parameters
idstringrequiredBody
application/jsonrequiredglobalsobjectvarsVarsGroups the three variable sources available to a workflow: config-level vars, environment variables, and user-supplied globals.
varsVarsConfigobjectrepresents variables present on the pipeline.Config vars field
Envobjectrepresents environment variables
Userobjectglobal represents variables passed into the pipeline e.g.
Responses
200 OKOK
planExecutionPlanRepresents the complete execution strategy for a workflow.
planExecutionPlanconfig_idstringrequiredConfig.ID is the canonical name e.g.
config_namestringrequiredIs the workflow name
config_varsobjectHolds the original config-level variables
outputsobjectMaps output variable names to their template expressions
outputsobject*stringany additional propertyplan_idstringrequiredUniquely identifies this workflow execution
stepsExecutionStep[]Is the root-level execution steps
stepsExecutionStep[]cacheCacheConfigControls how long a step's outputs are cached.
cacheCacheConfigforstringrequiredcomponentstringrequiredName to execute
conditionstringHolds the "if" expression (empty if no condition)
descriptionstringFrom Action.Description
disabledbooleanFlag
elseExecutionStepRepresents a single executable unit in the plan.
Recurses into ExecutionStep, shown above.
idstringrequiredIs hierarchical: "1", "1.1", "1.2.1", etc.
namestringrequiredFrom Action.Name
planExecutionPlanRepresents the complete execution strategy for a workflow.
Recurses into ExecutionPlan, shown above.
plan_idstringrequiredIs the parent plan ID
retryRetryConfigControls how many times a failing step is retried and the delay between attempts.
retryRetryConfigcountinteger (int64)requireddelayinteger (int64)requiredin seconds
run_idstringrequiredUniquely identifies this step execution (UUID)
stepsExecutionStep[]For nested actions
varsobjectTo pass (unresolved at plan time)
400 Bad Requestthe request could not be completed
errorstringrequiredDefaultthe request could not be completed
errorstringrequired{
"globals": {},
"vars": {
"Config": {},
"Env": {},
"User": {}
}
}{
"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": {}
}
]
}
}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
idstringrequiredBody
application/jsonrequiredasyncbooleanglobalsobjectResponses
200 OKOK
metricsExposedComponentMetric[]
metricsExposedComponentMetric[]actionstringrequiredcomponentstringrequiredcost_generalWorkflowGeneralCostAccumulates the non-inference resource cost of a workflow.
cost_generalWorkflowGeneralCostbytes_deletedinteger (int64)bytes_readinteger (int64)bytes_writteninteger (int64)cost_clientMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
cost_clientMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)cost_providerMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
cost_providerMoneycurrency_codestringnanosinteger (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_inferenceWorkflowInferenceCostAccumulates the inference cost incurred by a workflow.
cost_inferenceWorkflowInferenceCostcost_clientMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
cost_clientMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)cost_providerMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
cost_providerMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)estimate_input_cost_clientMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
estimate_input_cost_clientMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)estimate_input_cost_providerMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
estimate_input_cost_providerMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)estimate_input_tokensinteger (int64)estimate_took_msinteger (int64)input_cost_clientMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
input_cost_clientMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)input_cost_providerMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
input_cost_providerMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)input_tokensinteger (int64)input_took_msinteger (int64)modelstringoutput_cost_clientMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
output_cost_clientMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)output_cost_providerMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
output_cost_providerMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)output_tokensinteger (int64)output_took_msinteger (int64)providerstringthinking_cost_clientMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
thinking_cost_clientMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)thinking_cost_providerMoneyIs a currency amount expressed as whole units plus nanos (10^-9 units), matching the ISO 4217 layout the cloud and accounting code exchange.
thinking_cost_providerMoneycurrency_codestringnanosinteger (int32)rateinteger (int64)unitsinteger (int64)thinking_tokensinteger (int64)thinking_took_msinteger (int64)tokensinteger (int64)took_msinteger (int64)idstringrequirediterationinteger (int64)required-1 for non-loop, 0+ for loop iterations
retriesinteger (int64)requiredrun_idstringrequiredunique step execution ID (UUID)
step_idstringrequiredhierarchical step ID (e.g., "1", "1.1", "2.iter.0.1")
took_msinteger (int64)requiredoutputsobjectrun_idstringstatusstring400 Bad Requestthe request could not be completed
errorstringrequiredDefaultthe request could not be completed
errorstringrequired{
"async": true,
"globals": {}
}{
"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"
}