AI KestraFlow

AI KestraFlow

Certified

Execute Kestra flows from an agent

Triggers Kestra flows as tools, either predefined (kestra_flow_<namespace>_<flowId>) or generic (kestra_flow with namespace/flowId provided by the prompt). A description is mandatory from the flow or the tool description; inputs, labels, and schedule provided by the LLM override tool defaults. Labels are not inherited unless inheritLabels=true, while the correlationId is inherited when none is supplied.

yaml
type: io.kestra.plugin.ai.tool.KestraFlow

Call a Kestra flow as a tool, explicitly defining the flow ID and namespace in the tool definition

yaml
id: agent_calling_flows_explicitly
namespace: company.ai

inputs:
  - id: use_case
    type: SELECT
    description: Your Orchestration Use Case
    defaults: Hello World
    values:
      - Business Automation
      - Business Processes
      - Data Engineering Pipeline
      - Data Warehouse and Analytics
      - Infrastructure Automation
      - Microservices and APIs
      - Hello World

tasks:
  - id: agent
    type: io.kestra.plugin.ai.agent.AIAgent
    prompt: Execute a flow that best matches the {{ inputs.use_case }} use case selected by the user
    provider:
      type: io.kestra.plugin.ai.provider.GoogleGemini
      modelName: gemini-2.5-flash
      apiKey: "{{ secret('GEMINI_API_KEY') }}"
    tools:
      - type: io.kestra.plugin.ai.tool.KestraFlow
        namespace: tutorial
        flowId: business-automation
        description: Business Automation

      - type: io.kestra.plugin.ai.tool.KestraFlow
        namespace: tutorial
        flowId: business-processes
        description: Business Processes

      - type: io.kestra.plugin.ai.tool.KestraFlow
        namespace: tutorial
        flowId: data-engineering-pipeline
        description: Data Engineering Pipeline

      - type: io.kestra.plugin.ai.tool.KestraFlow
        namespace: tutorial
        flowId: dwh-and-analytics
        description: Data Warehouse and Analytics

      - type: io.kestra.plugin.ai.tool.KestraFlow
        namespace: tutorial
        flowId: file-processing
        description: File Processing

      - type: io.kestra.plugin.ai.tool.KestraFlow
        namespace: tutorial
        flowId: hello-world
        description: Hello World

      - type: io.kestra.plugin.ai.tool.KestraFlow
        namespace: tutorial
        flowId: infrastructure-automation
        description: Infrastructure Automation

      - type: io.kestra.plugin.ai.tool.KestraFlow
        namespace: tutorial
        flowId: microservices-and-apis
        description: Microservices and APIs

Call a Kestra flow as a tool, implicitly passing the flow ID and namespace in the prompt

yaml
id: agent_calling_flows_implicitly
namespace: company.ai

inputs:
  - id: use_case
    type: SELECT
    description: Your Orchestration Use Case
    defaults: Hello World
    values:
      - Business Automation
      - Business Processes
      - Data Engineering Pipeline
      - Data Warehouse and Analytics
      - Infrastructure Automation
      - Microservices and APIs
      - Hello World

tasks:
  - id: agent
    type: io.kestra.plugin.ai.agent.AIAgent
    prompt: |
      Execute a flow that best matches the {{ inputs.use_case }} use case selected by the user. Use the following mapping of use cases to flow IDs:
      - Business Automation: business-automation
      - Business Processes: business-processes
      - Data Engineering Pipeline: data-engineering-pipeline
      - Data Warehouse and Analytics: dwh-and-analytics
      - Infrastructure Automation: infrastructure-automation
      - Microservices and APIs: microservices-and-apis
      - Hello World: hello-world
      Remember that all those flows are in the tutorial namespace.
    provider:
      type: io.kestra.plugin.ai.provider.GoogleGemini
      modelName: gemini-2.5-flash
      apiKey: "{{ secret('GEMINI_API_KEY') }}"
    tools:
      - type: io.kestra.plugin.ai.tool.KestraFlow
Properties

Select API authentication

Use either an API token or HTTP Basic (username/password); do not provide both.

Definitions
apiTokenstring

API token for bearer auth

autobooleanstring
Defaulttrue

Automatically retrieve credentials from Kestra's configuration if available

passwordstring

Password for HTTP Basic auth

usernamestring

Username for HTTP Basic auth

Description of the flow if not already provided inside the flow itself

Use it only if you define the flow in the tool definition. The LLM needs a tool description to identify whether to call it. If the flow has a description, the tool will use it. Otherwise, the description property must be explicitly defined.

Flow ID of the flow that should be called

Defaultfalse

Whether the flow should inherit labels from this execution that triggered it

By default, labels are not inherited. If you set this option to true, the flow execution will inherit all labels from the agent's execution. Any labels passed by the LLM will override those defined here.

Input values that should be passed to flow's execution

Any inputs passed by the LLM will override those defined here.

Override Kestra API endpoint

URL used for calls to the Kestra API. When null, renders {{ kestra.url }} from configuration; if still empty, defaults to http://localhost: 8080.

Labels that should be added to the flow's execution

Any labels passed by the LLM will override those defined here.

Namespace of the flow that should be called

Revision of the flow that should be called

Schedule the flow execution at a later date

If the LLM sets a scheduleDate, it will override the one defined here.

Override target tenant

Tenant identifier applied to API calls; defaults to the current execution tenant.