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
durationtype *Requiredobject
behavior string
Default
RETRY_FAILED_TASK Possible Values
RETRY_FAILED_TASKCREATE_NEW_EXECUTIONmaxAttempts integer
Minimum
>= 1maxDuration string
Format
durationwarningOnRetry boolean
Default
falseio.kestra.core.models.tasks.retrys.Random
maxInterval *Requiredstring
Format
durationminInterval *Requiredstring
Format
durationtype *Requiredobject
behavior string
Default
RETRY_FAILED_TASK Possible Values
RETRY_FAILED_TASKCREATE_NEW_EXECUTIONmaxAttempts integer
Minimum
>= 1maxDuration string
Format
durationwarningOnRetry boolean
Default
falseio.kestra.core.models.tasks.retrys.Exponential
interval *Requiredstring
Format
durationmaxInterval *Requiredstring
Format
durationtype *Requiredobject
behavior string
Default
RETRY_FAILED_TASK Possible Values
RETRY_FAILED_TASKCREATE_NEW_EXECUTIONdelayFactor number
maxAttempts integer
Minimum
>= 1maxDuration string
Format
durationwarningOnRetry boolean
Default
falseio.kestra.core.models.tasks.Cache
enabled *Requiredboolean
ttl string
Format
durationio.kestra.core.models.tasks.WorkerGroup
fallback string
Possible Values
FAILWAITCANCEL