Run a function
Run the function once and answer when it ends. Every call it makes acts for the end user in Anlyon-End-User: impact limits, approvals, the end user’s connections, the halt switch and receipts apply as for any action call. Needs actions:invoke as well as functions:run.
mode says what happens to writes (a call to an action that is not a GET):
plan(the default): reads run for real; each write is recorded and answered with{ planned: true }, and nothing is sent. The run endsplannedwhen it made no writes. With writes it endsawaiting_approval, andplanlists them with one approval of kindfunction_planbound to the plan’s digest. The team decides it, or the end user when every write’s approval policy saysdecidedBy: end_user.apply, withplanRunId: carries out an approved plan, once, with the plan’s version, input and end user. Each write must equal the plan’s next write: same action, same input, same order. A matching write is sent as its own action invocation with its own receipt. A write that does not match ends the rundivergedbefore it is sent, and nothing further is sent; plan again for a new approval. Reads may differ.straight_through: every call is sent as it is made. A write must be to an action in the version’sstraightThroughpolicy, within itsmaxWrites; any other write is refused withPLAN_REQUIREDand nothing is sent.
A run can also end failed, or budget_exceeded with budget naming the budget that ran out. 409 when an apply’s plan is not approved (PLAN_NOT_APPROVED), has no writes (PLAN_HAS_NO_WRITES), was already applied (PLAN_ALREADY_APPLIED), was made with other input (PLAN_INPUT_MISMATCH) or was approved more than 24 hours ago (PLAN_EXPIRED).
503 FUNCTION_RUNNER_UNAVAILABLE when the function runner is not configured or cannot be reached. Nothing ran, and the run is not counted.
Runs are held to the workspace’s plan (GET /api/v2/billing/plans, planCatalogue[].functionRuns). 402 PAYMENT_REQUIRED when the workspace has no plan. 429 FUNCTION_RUN_CONCURRENCY_LIMIT when the plan’s runs at once are all going (retry when one ends), 429 FUNCTION_RUN_RATE_LIMITED past the plan’s run starts a minute, and 429 QUOTA_EXCEEDED past the plan’s runs a month (they come back on the 1st, UTC). In each case nothing ran and nothing was counted. A run’s own action calls count as governed actions, as any action call does.
/api/v2/functions/{name}/runsAuthorizationBearer token (Anlyon API key) · headerrequiredWorkspace API key sent as Authorization: Bearer <key>.
better-auth.session_tokenAPI key · cookierequiredBrowser session used by dashboard-only operations.
namestringrequiredThe function's name or id (fn_...).
X-Request-IdstringOptional caller correlation ID. Unsafe or oversized values are replaced.
Anlyon-End-UserstringThe end user this call acts for: your own id for them, 1 to 128 characters of letters, digits and . _ : @ -. Accepted only with an API key, which stays on your server; a session or an OAuth token that sends it is refused. A key created with endUserRequired must send it on every action call (400 END_USER_REQUIRED). On an /end-users/{endUserId} route it must name the same end user as the path.
application/jsoninputobjectPassed to `run(input
modestringWhat happens to writes: plan records them for approval, apply carries out an approved plan, straight_through sends them under the version's straight-through policy.
planapplystraight_throughplanRunIdstringFor apply: the approved plan run to carry out. Required with apply, and refused with another mode.
The finished run.
successbooleanrequiredtruedataFunctionRunrequiredShow propertiesHide properties
idstringrequiredfunctionIdstringrequiredfunctionNamestringrequiredfunctionVersionIdstringrequiredmodestringrequiredstraight_throughplanapplystatusstringrequiredrunningsucceededfailedbudget_exceededplannedawaiting_approvaldivergedendUserIdstring | nullrequiredThe end user the run acted for. Every call carried it.
inputobjectrequiredinputDigeststringrequiredoutputany | nullrequiredWhat run returned
errorobject | nullrequiredShow propertiesHide properties
codestringrequiredmessagestringrequiredlogsstring[]requiredLines from anlyon.log. At most 100.
budgetstring | nullrequiredThe budget that ended the run.
maxActionCallsmaxCpuMsmaxSubrequeststimeoutMsactionCallsintegerrequiredcallsFunctionRunCall[]requiredShow propertiesHide properties
FunctionRunCallsequenceintegerrequiredactionstringrequiredkindstringrequiredFrom the action's method. A GET reads.
readwritestatestringrequiredintent is a write a plan run recorded and did not send.
intentdispatchedrefusedfailedinvocationIdstring | nullrequiredThe invocation the call became
refusalstring | nullrequiredWhy the call was refused, when it was. RUN_DIVERGED for an apply run's write that did not match its plan.
plannedSequenceinteger | nullrequiredAn apply run's write
createdAtstring<date-time>requiredplanFunctionRunPlan | nullrequiredA plan run's plan
Show propertiesHide properties
digeststringrequiredCovers the version
writesobject[]requiredShow propertiesHide properties
objectsequenceintegerrequiredactionstringrequiredinputanyrequiredThe write's input
approvalobject | nullrequiredNull when the plan has no writes. It needs no approval.
Show propertiesHide properties
idstringrequiredstatusstringrequiredpendingapproveddeniedexpireddeciderstringrequiredteamend_userappliedByRunIdstring | nullrequiredThe apply run that carried out the plan. A plan is applied at most once.
nullplanRunIdstring | nullrequiredAn apply run's plan run.
planDigeststring | nullrequiredAn apply run's approved plan digest.
approvalIdstring | nullrequiredAn apply run's plan approval.
receiptFunctionRunReceipt | nullrequiredShow propertiesHide properties
functionIdstringrequiredfunctionVersionIdstringrequireddigeststringrequiredinputDigeststringrequiredmodestringrequiredstraight_throughplanapplyplanDigeststring | nullrequiredA plan run's plan
approvalIdstring | nullrequiredplanRunIdstring | nullrequiredFor an apply run
callsobject[]requiredShow propertiesHide properties
objectsequenceintegerrequiredactionstringrequiredkindstringrequiredreadwritestatestringrequiredintentdispatchedrefusedfailedinvocationIdstring | nullrequiredrefusalstring | nullrequiredplannedSequenceinteger | nullrequiredoutcomestringrequiredsucceededfailedbudget_exceededplannedawaiting_approvaldivergedbudgetstring | nullrequiredmaxActionCallsmaxCpuMsmaxSubrequeststimeoutMsfinishedAtstring<date-time>requirednulldurationMsinteger | nullrequiredcreatedAtstring<date-time>requiredfinishedAtstring<date-time> | nullrequiredBad Request - Invalid input data
successbooleanrequiredrequestIdstringrequiredCorrelation ID matching the X-Request-Id response header.
errorobjectrequiredShow propertiesHide properties
codestringmessagestringdetailsobjectfixErrorFixHow to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.
Show propertiesHide properties
summarystringrequiredOne sentence that says what to do.
commandstringAn exact anlyon CLI command that fixes it. Absent when no command does.
urlstring<uri>An absolute console link where a person fixes it.
docsstring<uri>A docs page that explains it.
Unauthorized - Invalid or missing API key
successbooleanrequiredrequestIdstringrequiredCorrelation ID matching the X-Request-Id response header.
errorobjectrequiredShow propertiesHide properties
codestringmessagestringdetailsobjectfixErrorFixHow to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.
Show propertiesHide properties
summarystringrequiredOne sentence that says what to do.
commandstringAn exact anlyon CLI command that fixes it. Absent when no command does.
urlstring<uri>An absolute console link where a person fixes it.
docsstring<uri>A docs page that explains it.
Payment Required - Usage quota exceeded
successbooleanrequiredrequestIdstringrequiredCorrelation ID matching the X-Request-Id response header.
errorobjectrequiredShow propertiesHide properties
codestringmessagestringdetailsobjectfixErrorFixHow to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.
Show propertiesHide properties
summarystringrequiredOne sentence that says what to do.
commandstringAn exact anlyon CLI command that fixes it. Absent when no command does.
urlstring<uri>An absolute console link where a person fixes it.
docsstring<uri>A docs page that explains it.
Authenticated credential lacks the required scope or workspace access.
successbooleanrequiredrequestIdstringrequiredCorrelation ID matching the X-Request-Id response header.
errorobjectrequiredShow propertiesHide properties
codestringmessagestringdetailsobjectfixErrorFixHow to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.
Show propertiesHide properties
summarystringrequiredOne sentence that says what to do.
commandstringAn exact anlyon CLI command that fixes it. Absent when no command does.
urlstring<uri>An absolute console link where a person fixes it.
docsstring<uri>A docs page that explains it.
Not Found - Resource does not exist
successbooleanrequiredrequestIdstringrequiredCorrelation ID matching the X-Request-Id response header.
errorobjectrequiredShow propertiesHide properties
codestringmessagestringdetailsobjectfixErrorFixHow to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.
Show propertiesHide properties
summarystringrequiredOne sentence that says what to do.
commandstringAn exact anlyon CLI command that fixes it. Absent when no command does.
urlstring<uri>An absolute console link where a person fixes it.
docsstring<uri>A docs page that explains it.
The request conflicts with current resource state or a concurrent decision.
successbooleanrequiredrequestIdstringrequiredCorrelation ID matching the X-Request-Id response header.
errorobjectrequiredShow propertiesHide properties
codestringmessagestringdetailsobjectfixErrorFixHow to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.
Show propertiesHide properties
summarystringrequiredOne sentence that says what to do.
commandstringAn exact anlyon CLI command that fixes it. Absent when no command does.
urlstring<uri>An absolute console link where a person fixes it.
docsstring<uri>A docs page that explains it.
Too Many Requests - either the request rate limit, or the plan's cap on how many of this resource may exist. The code distinguishes them: RATE_LIMIT_EXCEEDED clears on its own, QUOTA_EXCEEDED does not until you remove one or upgrade.
successbooleanrequiredrequestIdstringrequiredCorrelation ID matching the X-Request-Id response header.
errorobjectrequiredShow propertiesHide properties
codestringmessagestringdetailsobjectfixErrorFixHow to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.
Show propertiesHide properties
summarystringrequiredOne sentence that says what to do.
commandstringAn exact anlyon CLI command that fixes it. Absent when no command does.
urlstring<uri>An absolute console link where a person fixes it.
docsstring<uri>A docs page that explains it.
A required provider or platform dependency is not configured or available.
successbooleanrequiredrequestIdstringrequiredCorrelation ID matching the X-Request-Id response header.
errorobjectrequiredShow propertiesHide properties
codestringmessagestringdetailsobjectfixErrorFixHow to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.
Show propertiesHide properties
summarystringrequiredOne sentence that says what to do.
commandstringAn exact anlyon CLI command that fixes it. Absent when no command does.
urlstring<uri>An absolute console link where a person fixes it.
docsstring<uri>A docs page that explains it.

