
Responses
Responses
yaml
type: "io.kestra.plugin.openai.Responses"Examples
yaml
id: simple_text
namespace: company.team
inputs:
- id: prompt
type: STRING
defaults: Explain what is Kestra in 3 sentences
tasks:
- id: explain
type: io.kestra.plugin.openai.Responses
apiKey: "{{ secret('OPENAI_API_KEY') }}"
model: gpt-4.1-mini
input: "{{ inputs.prompt }}"
- id: log
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.explain.outputText }}"
yaml
id: web_search
namespace: company.team
inputs:
- id: prompt
type: STRING
defaults: List recent trends in workflow orchestration
tasks:
- id: trends
type: io.kestra.plugin.openai.Responses
apiKey: "{{ secret('OPENAI_API_KEY') }}"
model: gpt-4.1-mini
input: "{{ inputs.prompt }}"
toolChoice: REQUIRED
tools:
- type: web_search_preview
- id: log
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.trends.outputText }}"
yaml
id: fetch_local_news
namespace: company.team
inputs:
- id: prompt
type: STRING
defaults: Summarize top 5 news from my region
tasks:
- id: news
type: io.kestra.plugin.openai.Responses
apiKey: "{{ secret('OPENAI_API_KEY') }}"
model: gpt-4.1-mini
input: "{{ inputs.prompt }}"
toolChoice: REQUIRED
tools:
- type: web_search_preview
search_context_size: low # optional; low, medium, high
user_location:
type: approximate # OpenAI doesn't provide other types atm, and it cannot be omitted
city: Berlin
region: Berlin
country: DE
- id: mail
type: io.kestra.plugin.notifications.mail.MailSend
from: your_email
to: your_email
username: your_email
host: mail.privateemail.com
port: 465
password: "{{ secret('EMAIL_PASSWORD') }}"
sessionTimeout: 6000
subject: Daily News Summary
htmlTextContent: "{{ outputs.news.outputText }}"
triggers:
- id: schedule
type: io.kestra.plugin.core.trigger.Schedule
cron: "0 9 * * *"
yaml
id: responses_functions
namespace: company.team
inputs:
- id: prompt
type: STRING
defaults: I love your product and would purchase it again!
tasks:
- id: openai
type: io.kestra.plugin.openai.Responses
apiKey: "{{ secret('OPENAI_API_KEY') }}"
model: gpt-4.1-mini
input: "{{ inputs.prompt }}"
toolChoice: AUTO
tools:
- type: function
name: respond_to_review
description: >-
Given the customer product review provided as input, determine how
urgently a reply is required and then provide suggested response text.
strict: true
parameters:
type: object
required:
- response_urgency
- response_text
properties:
response_urgency:
type: string
description: >-
How urgently this customer review needs a reply. Bad reviews must
be addressed immediately before anyone sees them. Good reviews
can wait until later.
enum:
- reply_immediately
- reply_later
response_text:
type: string
description: The text to post online in response to this review.
additionalProperties: false
- id: output
type: io.kestra.plugin.core.output.OutputValues
values:
urgency: "{{ fromJson(outputs.openai.outputText).response_urgency }}"
response: "{{ fromJson(outputs.openai.outputText).response_text }}"
yaml
id: stateful_chat
namespace: company.team
inputs:
- id: user_input
type: STRING
defaults: How can I get started with Kestra as a microservice developer?
- id: reset_conversation
type: BOOL
defaults: false
tasks:
- id: maybe_reset_conversation
runIf: "{{ inputs.reset_conversation }}"
type: io.kestra.plugin.core.kv.Delete
key: "RESPONSE_ID"
- id: chat_request
type: io.kestra.plugin.openai.Responses
apiKey: "{{ secret('OPENAI_API_KEY') }}"
model: gpt-4.1
previousResponseId: "{{ kv('RESPONSE_ID', errorOnMissing=false) }}"
input:
- role: user
content:
- type: input_text
text: "{{ inputs.user_input }}"
- id: store_response
type: io.kestra.plugin.core.kv.Set
key: "RESPONSE_ID"
value: "{{ outputs.chat_request.responseId }}"
- id: output_log
type: io.kestra.plugin.core.log.Log
message: "Response: {{ outputs.chat_request.outputText }}"
yaml
id: structured_output_demo
namespace: company.team
inputs:
- id: food
type: STRING
defaults: Avocado
tasks:
- id: generate_structured_response
type: io.kestra.plugin.openai.Responses
apiKey: "{{ secret('OPENAI_API_KEY') }}"
model: gpt-4.1-mini
input: "Fill in nutrients information for the following food: {{ inputs.food }}"
text:
format:
type: json_schema
name: food_macronutrients
schema:
type: object
properties:
food:
type: string
description: The name of the food or meal.
macronutrients:
type: object
description: Macro-nutritional content of the food.
properties:
carbohydrates:
type: number
description: Amount of carbohydrates in grams.
proteins:
type: number
description: Amount of proteins in grams.
fats:
type: number
description: Amount of fats in grams.
required:
- carbohydrates
- proteins
- fats
additionalProperties: false
vitamins:
type: object
description: Specific vitamins present in the food.
properties:
vitamin_a:
type: number
description: Amount of Vitamin A in micrograms.
vitamin_c:
type: number
description: Amount of Vitamin C in milligrams.
vitamin_d:
type: number
description: Amount of Vitamin D in micrograms.
vitamin_e:
type: number
description: Amount of Vitamin E in milligrams.
vitamin_k:
type: number
description: Amount of Vitamin K in micrograms.
required:
- vitamin_a
- vitamin_c
- vitamin_d
- vitamin_e
- vitamin_k
additionalProperties: false
required:
- food
Properties
apiKey*Requiredstring
input*Requiredobject
model*Requiredstring
clientTimeoutNon-dynamicinteger
Default
10maxOutputTokensintegerstring
parallelToolCallsbooleanstring
previousResponseIdstring
reasoningobject
SubTypestring
storebooleanstring
Default
truetemperaturenumberstring
Default
1.0textobject
toolChoicestring
Possible Values
NONEAUTOREQUIREDtoolsarray
SubTypeobject
topPnumberstring
Default
1.0userstring
Outputs
outputTextstring
rawResponseobject
responseIdstring
sourcesarray
SubTypestring