OpenAI Responses
Certified
Call OpenAI Responses with tools
OpenAI Responses
Call OpenAI Responses with tools
Uses the Responses API for chat, tool calls, and structured text output. Supports web/file search and function tools, optional JSON Schema formatting, continuation via previousResponseId, and persistence enabled by default. See the Responses docs.
type: io.kestra.plugin.openai.ResponsesExamples
Send a simple text prompt to OpenAI and output the result as text.
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 }}"
Pass a list of messages with different roles as input instead of a single string. Each message holds a content list where every entry declares its type (e.g., input_text) and value.
id: openai_roles
namespace: company.team
tasks:
- id: openai
type: io.kestra.plugin.openai.Responses
apiKey: "{{ secret('OPENAI_API_KEY') }}"
model: gpt-4.1-mini
input:
- role: system
content:
- type: input_text
text: "Only respond with a single sentence"
- role: user
content:
- type: input_text
text: "Explain what is Kestra"
- id: log
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.openai.outputText }}"
Use the OpenAI's web-search tool to find recent trends in workflow orchestration.
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
- id: log
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.trends.outputText }}"
Use the OpenAI's web-search tool to get a daily summary of local news via email.
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
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.email.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 * * *"
Use the OpenAI's function-calling tool to respond to a customer review and determine urgency of response.
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 }}"
Run a stateful chat with OpenAI using the Responses API.
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 }}"
Return a structured output with nutritional information about a food item using OpenAI's Responses API.
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
Use a stored prompt template and MCP server with OpenAI's Responses API.
id: prompt_id_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-5-mini
input: "Summarize the Pull Requests assigned to me for review."
promptId: "pmpt_XYZ"
promptVariables:
repo: "kestra-io/kestra"
username: "your.name"
tools:
- type: mcp
server_label: GitHub_MCP
server_description: GitHub MCP Server
server_url: "https://api.githubcopilot.com/mcp/"
require_approval: never
authorization: "{{ secret('GITHUB_PERSONAL_ACCESS_TOKEN') }}"
headers:
X-MCP-Readonly: "true"
Installation
Our standard Docker images already include this plugin. If you use a -slim image or another setup, install it with the following command:
kestractl plugins get io.kestra.plugin:plugin-openai --compatible-for $KESTRA_VERSION For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.
Properties
apiKey *string
OpenAI API key
input *object
Input payload
The conversation input. Accepts two formats:
- String: a single text prompt (
input: "Explain what is Kestra"). The plugin sends it as oneusermessage. - List: a list of message objects for multi-turn or multi-role conversations. Each item has a
role(user,system,assistant, ordeveloper) and acontentlist. Each content entry has atype(usuallyinput_text) and the corresponding value (text).
Example list format:
input:
- role: system
content:
- type: input_text
text: "Only respond with a single sentence"
- role: user
content:
- type: input_text
text: "Explain what is Kestra"
See the Responses input docs.
model *string
Model ID
Required OpenAI model (e.g., gpt-4.1 or gpt-4o); see the model docs.
assets
Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.
io.kestra.core.models.assets.AssetsDeclaration
IGNOREFAILWARNAsset failure behavior
Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.
Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.
The assets consumed as inputs.
io.kestra.core.models.assets.AssetIdentifier
1The assets produced as outputs.
A dataset stored outside of a database table.
Declares a dataset that a task writes outside of a database table, such as files in a data lake. system, location and format are stored in the metadata of the asset, so they can be matched with metadataQuery on an asset trigger.
Register the dataset a task has written.
id: export_trips
namespace: company.data
tasks:
- id: export
type: io.kestra.plugin.core.log.Log
message: Exporting trips
assets:
outputs:
- type: io.kestra.plugin.ee.assets.Dataset
id: trips
system: s3
location: s3://company-lake/trips/
format: parquet1150100The day-2 actions offered on this asset, each backing onto a flow.
Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
1The namespace of the flow backing this action.
The label displayed on this action.
20The conditions under which this action is offered.
All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.
The format of the data, for example parquet or csv.
Where the dataset is stored, for example a bucket prefix.
{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The system storing the dataset, for example s3 or gcs.
A deployment, grouping the resources provisioned together.
Declares a deployment that groups the resources a flow provisions together. Other assets join a deployment by naming it in their partOf. A TtlTrigger targets deployments when no assetType is set.
Register a deployment and the virtual machine it is made of.
id: provision_environment
namespace: company.infra
tasks:
- id: provision
type: io.kestra.plugin.core.log.Log
message: Provisioning staging-eu
assets:
outputs:
- type: io.kestra.plugin.ee.assets.Deployment
id: staging-eu
displayName: Staging EU
- type: io.kestra.plugin.ee.assets.VM
id: staging-eu-web-01
provider: aws
region: eu-west-1
partOf:
id: staging-eu1150100The day-2 actions offered on this asset, each backing onto a flow.
Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
1The namespace of the flow backing this action.
The label displayed on this action.
20The conditions under which this action is offered.
All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.
{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
A file in a storage system.
Declares a single file that a task writes to a storage system. system and path are stored in the metadata of the asset, so they can be matched with metadataQuery on an asset trigger.
Register the file a task has uploaded.
id: upload_report
namespace: company.finance
tasks:
- id: upload
type: io.kestra.plugin.core.log.Log
message: Uploading the monthly report
assets:
outputs:
- type: io.kestra.plugin.ee.assets.File
id: monthly-report
system: s3
path: s3://company-reports/monthly.pdf1150100The day-2 actions offered on this asset, each backing onto a flow.
Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
1The namespace of the flow backing this action.
The label displayed on this action.
20The conditions under which this action is offered.
All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.
{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The path or URI of the file.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The storage system holding the file, for example s3 or sftp.
A database table.
Declares a database table that a task creates or loads. system, database, schema and name are stored in the metadata of the asset, so they can be matched with metadataQuery on an asset trigger.
Register the table a task has created.
id: create_orders_table
namespace: company.data
tasks:
- id: create
type: io.kestra.plugin.core.log.Log
message: Creating analytics.public.orders
assets:
outputs:
- type: io.kestra.plugin.ee.assets.Table
id: analytics.public.orders
system: postgres
database: analytics
schema: public
name: orders1150100The day-2 actions offered on this asset, each backing onto a flow.
Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
1The namespace of the flow backing this action.
The label displayed on this action.
20The conditions under which this action is offered.
All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.
The database the table belongs to.
{}The name of the table.
1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The schema the table belongs to.
The database system, for example postgres, snowflake or bigquery.
A virtual machine.
Declares a virtual machine that a task provisions or manages. provider, region and state are stored in the metadata of the asset, so they can be matched with metadataQuery on an asset trigger.
Register the virtual machine a task has provisioned.
id: provision_vm
namespace: company.infra
tasks:
- id: provision
type: io.kestra.plugin.core.log.Log
message: Provisioning web-01
assets:
outputs:
- type: io.kestra.plugin.ee.assets.VM
id: web-01
displayName: Web server 01
provider: aws
region: eu-west-1
state: running1150100The day-2 actions offered on this asset, each backing onto a flow.
Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
1The namespace of the flow backing this action.
The label displayed on this action.
20The conditions under which this action is offered.
All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.
{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The cloud provider or hypervisor hosting the virtual machine, for example aws, gcp or vsphere.
The region or zone the virtual machine runs in.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The state of the virtual machine, for example running or stopped.
io.kestra.core.models.assets.Custom
11501Custom asset type
100The day-2 actions offered on this asset, each backing onto a flow.
Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
1The namespace of the flow backing this action.
The label displayed on this action.
20The conditions under which this action is offered.
All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.
{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
clientTimeout integerstring
600The maximum number of seconds to wait for a response
The maximum time to wait for API responses, in seconds (minimum 1, default 600 seconds / 10 minutes). Applies per HTTP attempt. The underlying SDK retries twice by default, so a task can wait up to approximately 3 times this value before timing out.
maxOutputTokens integerstring
Max output tokens
Caps response tokens; leave unset to use OpenAI defaults.
parallelToolCalls booleanstring
Parallel tool calls
Whether tools may run in parallel; uses provider default when unset.
previousResponseId string
Previous response ID
Continue a conversation by supplying a prior response_id; requires prior persistence.
promptCaching booleanstring
Enable prompt caching
When true, enables OpenAI prompt caching to reduce latency and cost for repeated prefixes. See the prompt caching docs.
promptId string
Reference to a prompt stored in OpenAI Platform (optional)
If provided, the Platform-managed prompt will be used, with input added as a user input.
promptVariables object
Key-value pairs for substitution in the stored prompt (optional)
Ignored unless promptId is provided. Values will replace placeholders in the stored prompt.
reasoning object
Reasoning configuration
Optional reasoning options map passed to the API.
store booleanstring
truePersist response history
Defaults to true to store conversation in OpenAI; set false for ephemeral exchanges.
temperature numberstring
1.0Sampling temperature (0-2)
Default 1.0; higher values increase randomness.
text object
Text response config
Optional map for text output settings (e.g., json_schema formatted responses).
toolChoice string
NONEAUTOREQUIREDTool choice
NONE disables tools, AUTO (default) lets the model decide, REQUIRED forces a tool call when tools are provided.
tools array
Enabled tools
List of tool objects (web_search, file_search, function, etc.) sent to the API.
topP numberstring
Top-p nucleus sampling (0-1)
Lower values limit candidate tokens. Omit to let OpenAI apply its server-side default. Must be omitted for reasoning models (e.g., gpt-5.2+, gpt-5.4) which reject top_p.
user string
A unique identifier representing your end-user
Outputs
outputText string
Generated text
rawResponse object
Raw API response
Full response as a map for downstream processing.
responseId string
Response ID
sources array
Sources
URLs returned via web/file search annotations.