Call a Kestra runnable task as a tool
This tool exposes a tool for each Kestra task. The name of the tool will be kestra_task_<taskId>
.
When you define the tasks:
- You can set task properties as usual; these will not be overridden by the agent.
- If you want the agent to fill a mandatory property, set its value to
...
and the agent will fill it. - Optional properties that are not set may be filled by the agent if it chooses to do so.
WARNING: Since some model providers don't support JSON schema with anyOf
, when creating the JSON Schema to call the task, each anyOf
will be replaced by one of its sub-schemas.
You can view the generated schema in the debug logs.
yaml
type: "io.kestra.plugin.ai.tool.KestraTask"
Examples
Call a Kestra runnable task as a tool, letting the agent set the message
property for you
yaml
id: call_a_kestra_task
namespace: company.ai
tasks:
- id: agent
type: io.kestra.plugin.ai.agent.AIAgent
provider:
type: io.kestra.plugin.ai.provider.GoogleGemini
modelName: gemini-2.5-flash
apiKey: "{{ kv('GEMINI_API_KEY') }}"
tools:
- type: io.kestra.plugin.ai.tool.KestraTask
tasks:
- id: log
type: io.kestra.plugin.core.log.Log
message: "..." # This is a placeholder; the agent will fill it.
prompt: "Log the following message: 'Hello World!'"
Definitions
io.kestra.core.models.tasks.retrys.Constant
interval *Requiredstring
Format
duration
type *Requiredobject
behavior string
Default
RETRY_FAILED_TASK
Possible Values
RETRY_FAILED_TASK
CREATE_NEW_EXECUTION
maxAttempts integer
Minimum
>= 1
maxDuration string
Format
duration
warningOnRetry boolean
Default
false
io.kestra.core.models.tasks.retrys.Random
maxInterval *Requiredstring
Format
duration
minInterval *Requiredstring
Format
duration
type *Requiredobject
behavior string
Default
RETRY_FAILED_TASK
Possible Values
RETRY_FAILED_TASK
CREATE_NEW_EXECUTION
maxAttempts integer
Minimum
>= 1
maxDuration string
Format
duration
warningOnRetry boolean
Default
false
io.kestra.core.models.tasks.retrys.Exponential
interval *Requiredstring
Format
duration
maxInterval *Requiredstring
Format
duration
type *Requiredobject
behavior string
Default
RETRY_FAILED_TASK
Possible Values
RETRY_FAILED_TASK
CREATE_NEW_EXECUTION
delayFactor number
maxAttempts integer
Minimum
>= 1
maxDuration string
Format
duration
warningOnRetry boolean
Default
false
io.kestra.core.models.tasks.Cache
enabled *Requiredboolean
ttl string
Format
duration
io.kestra.core.models.tasks.WorkerGroup
fallback string
Possible Values
FAIL
WAIT
CANCEL