qstashClient
: QStash client used by the serve method
workflowRunId
: Current workflow run ID
url
: Publically accessible workflow endpoint URL
failureUrl
: URL for workflow failure notifications.
requestPayload
: Incoming request payload
rawInitialPayload
: String version of the initial payload
headers
: Request headers
env
: Environment variables
await
a sleep
action to properly pause execution.sleepUntil
action to properly pause execution.context.api.openai.call
.
context.call
will still be treated as successful, and the workflow will continue executing.failureFunction
or failureUrl
will not be invoked.To handle non-success cases, you can check the status
field in the response and implement custom logic as needed.url
: The URL to send the HTTP request to.method
: The HTTP method to use for the request (e.g., GET, POST, PUT, etc.). Defaults to GET.body
: Body to use in the requestheaders
: An object representing the HTTP headers to include in the request.retries
: The number of retry attempts to make if the request fails. Retries use exponential backoff. Defaults to 0 (no retries).flowControl
: To limit the number of calls made to your endpoint. See Flow Control for more details. The default is no limit.
key
: The key to use for flow control.rate
: The maximum number of calls per second.parallelism
: The maximum number of calls that can be active at the same time.period
: Time window over which the rate limit is enforced.timeout
: The maximum duration to wait for a response from the endpoint, in seconds. If retries are enabled, this timeout applies individually to each retry attempt.workflow
: If you are using serveMany
, you can call another workflow defined under the same serveMany
method by passing it to the workflow
parameter of context.call
.context.notify
: Notify step explained belowclient.notify
: Notify method of the Workflow Client.notifyResponse
is a list of NotifyResponse
objects:
Waiter
object:
body
is the data returned by the invoked workflow, if any is returned.
context.cancel
is different.
context.cancel
allows you to cancel the current workflow:
retries
option.WorkflowNonRetryableError
allows you to fail workflow on will
without going into retry cycle. The run will be labeled as failed,
triggering the failure function and creating a dlq entry: