Cerebras ChatCompletionTrigger

Cerebras ChatCompletionTrigger

Certified

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.

yaml
type: io.kestra.plugin.cerebras.ChatCompletionTrigger

Trigger a flow when a Cerebras response meets a condition.

yaml
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.

yaml
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

Cerebras API key

Sent as a Bearer token. Store it in a secret, e.g. {{ secret('CEREBRAS_API_KEY') }}.

SubTypeobject

Messages

List of messages sent at each evaluation. Each message needs a role and its content.

Model ID

Cerebras model identifier, e.g. gpt-oss-120b.

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.

Defaultfalse

Specifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.

Defaulthttps://api.cerebras.ai/v1

Cerebras API base URL

Defaults to https://api.cerebras.ai/v1. Override it to target a different Cerebras-compatible endpoint.

DefaultPT5M
Formatduration

Polling interval

Time between two evaluations. Each evaluation calls the Cerebras API. Defaults to 5 minutes.

Max completion tokens

Upper bound on generated tokens, including reasoning tokens when the model uses them.

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

List of execution states after which a trigger should be stopped (a.k.a. disabled).

Sampling temperature

Not sent when unset.

Defaulttrue

A 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.

Assistant text

Content of the first choice. Empty when the model returned no text.

Full response

The completion as returned by Cerebras: id, model, finishReason and usage.

Definitions
contentstring

Generated text

Content of the first choice. Null when the model only returned tool calls.

finishReasonstring

Finish reason

Why generation stopped, e.g. stop, length or tool_calls.

idstring

Completion ID

modelstring

Model used

toolCallsarray

Tool calls requested by the model

Empty when the model did not request any tool call.

argumentsstring

Function arguments

JSON-encoded arguments, as returned by the model.

idstring

Tool call ID

namestring

Function name

usage

Token usage

completionTokensinteger

Completion tokens

promptTokensinteger

Prompt tokens

totalTokensinteger

Total tokens