
Cerebras ChatCompletionTrigger
CertifiedTrigger a flow when a Cerebras response meets a condition
Cerebras ChatCompletionTrigger
Trigger a flow when a Cerebras response meets a condition
Polls the Cerebras Chat Completions API at each interval, then evaluates stopCondition against the current response. When it is true an execution is created; otherwise nothing happens until the next interval. The condition can use trigger.output (the assistant text) and trigger.response (the full response: model, finishReason, usage, ...). Every poll is a billable API call, so choose the interval accordingly. If the condition stays true, an execution is created at every interval.
type: io.kestra.plugin.cerebras.ChatCompletionTriggerExamples
Trigger a flow when a Cerebras response meets a condition.
id: cerebras_monitor
namespace: company.team
triggers:
- id: on_condition_met
type: io.kestra.plugin.cerebras.ChatCompletionTrigger
apiKey: "{{ secret('CEREBRAS_API_KEY') }}"
model: gpt-oss-120b
messages:
- role: user
content: "Is the system status healthy? Answer with YES or NO only."
interval: PT5M
stopCondition: "{{ trigger.output contains 'NO' }}"
tasks:
- id: handle_alert
type: io.kestra.plugin.core.log.Log
message: "Alert triggered by Cerebras response: {{ trigger.output }}"
Use the full response in the stop condition and in the flow.
id: cerebras_usage_monitor
namespace: company.team
triggers:
- id: on_long_answer
type: io.kestra.plugin.cerebras.ChatCompletionTrigger
apiKey: "{{ secret('CEREBRAS_API_KEY') }}"
model: gpt-oss-120b
messages:
- role: user
content: "Describe the current state of the market in one paragraph."
maxCompletionTokens: 200
interval: PT1H
stopCondition: "{{ trigger.response.finishReason == 'length' }}"
tasks:
- id: log
type: io.kestra.plugin.core.log.Log
message: "Model {{ trigger.response.model }} used {{ trigger.response.usage.totalTokens }} tokens"
Properties
apiKey *string
Cerebras API key
Sent as a Bearer token. Store it in a secret, e.g. {{ secret('CEREBRAS_API_KEY') }}.
messages *array
Messages
List of messages sent at each evaluation. Each message needs a role and its content.
model *string
Model ID
Cerebras model identifier, e.g. gpt-oss-120b.
stopCondition *booleanstring
Stop condition
Boolean expression evaluated against the current polling result. It can use trigger.output (assistant text) and trigger.response (full response). When true an execution is created; when false the trigger waits for the next interval.
allowConcurrent boolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
baseUrl string
https://api.cerebras.ai/v1Cerebras API base URL
Defaults to https://api.cerebras.ai/v1. Override it to target a different Cerebras-compatible endpoint.
interval string
PT5MdurationPolling interval
Time between two evaluations. Each evaluation calls the Cerebras API. Defaults to 5 minutes.
maxCompletionTokens integerstring
Max completion tokens
Upper bound on generated tokens, including reasoning tokens when the model uses them.
stopAfter array
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTEDList of execution states after which a trigger should be stopped (a.k.a. disabled).
temperature numberstring
Sampling temperature
Not sent when unset.
when string
trueA condition that determines whether the trigger should run.
A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.
Outputs
output string
Assistant text
Content of the first choice. Empty when the model returned no text.
response
Full response
The completion as returned by Cerebras: id, model, finishReason and usage.
io.kestra.plugin.cerebras.ChatCompletion-Output
Generated text
Content of the first choice. Null when the model only returned tool calls.
Finish reason
Why generation stopped, e.g. stop, length or tool_calls.
Completion ID
Model used
Tool calls requested by the model
Empty when the model did not request any tool call.
io.kestra.plugin.cerebras.ChatCompletion-Output-ToolCall
Function arguments
JSON-encoded arguments, as returned by the model.
Tool call ID
Function name
Token usage
io.kestra.plugin.cerebras.ChatCompletion-Output-Usage
Completion tokens
Prompt tokens
Total tokens