AIAgent ​A​I​Agent

yaml
type: "io.kestra.plugin.ai.agent.aiagent"
yaml
id: simple_summarizer_agent
namespace: company.ai

inputs:
  - id: summary_length
    displayName: Summary Length
    type: SELECT
    defaults: medium
    values:
      - short
      - medium
      - long

  - id: language
    displayName: Language ISO code
    type: SELECT
    defaults: en
    values:
      - en
      - fr
      - de
      - es
      - it
      - ru
      - ja

  - id: text
    type: STRING
    displayName: Text to summarize
    defaults: |
      Kestra is an open-source orchestration platform that:
      - Allows you to define workflows declaratively in YAML
      - Allows non-developers to automate tasks with a no-code interface
      - Keeps everything versioned and governed, so it stays secure and auditable
      - Extends easily for custom use cases through plugins and custom scripts.

      Kestra follows a "start simple and grow as needed" philosophy. You can schedule a basic workflow in a few minutes, then later add Python scripts, Docker containers, or complicated branching logic if the situation calls for it.

tasks:
  - id: multilingual_agent
    type: io.kestra.plugin.ai.agent.AIAgent
    systemMessage: |
      You are a precise technical assistant.
      Produce a {{ inputs.summary_length }} summary in {{ inputs.language }}.
      Keep it factual, remove fluff, and avoid marketing language.
      If the input is empty or non-text, return a one-sentence explanation.
      Output format:
      - 1-2 sentences for 'short'
      - 2-5 sentences for 'medium'
      - Up to 5 paragraphs for 'long'
    prompt: |
      Summarize the following content: {{ inputs.text }}

  - id: english_brevity
    type: io.kestra.plugin.ai.agent.AIAgent
    prompt: Generate exactly 1 sentence English summary of "{{ outputs.multilingual_agent.textOutput }}"

pluginDefaults:
  - type: io.kestra.plugin.ai.agent.AIAgent
    values:
      provider:
        type: io.kestra.plugin.ai.provider.GoogleGemini
        modelName: gemini-2.5-flash
        apiKey: "{{ kv('GEMINI_API_KEY') }}"

yaml
id: agent_with_docker_mcp_server_tool
namespace: company.ai

inputs:
  - id: prompt
    type: STRING
    defaults: What is the current UTC time?

tasks:
  - id: agent
    type: io.kestra.plugin.ai.agent.AIAgent
    prompt: "{{ inputs.prompt }}"
    provider:
      type: io.kestra.plugin.ai.provider.OpenAI
      apiKey: "{{ kv('OPENAI_API_KEY') }}"
      modelName: gpt-5-nano
    tools:
      - type: io.kestra.plugin.ai.tool.DockerMcpClient
        image: mcp/time

yaml
id: agent_with_memory
namespace: company.ai

tasks:
  - id: first_agent
    type: io.kestra.plugin.ai.agent.AIAgent
    prompt: Hi, my name is John and I live in New York!

  - id: second_agent
    type: io.kestra.plugin.ai.agent.AIAgent
    prompt: What's my name and where do I live?

pluginDefaults:
  - type: io.kestra.plugin.ai.agent.AIAgent
    values:
      provider:
        type: io.kestra.plugin.ai.provider.OpenAI
        apiKey: "{{ kv('OPENAI_API_KEY') }}"
        modelName: gpt-5-mini
      memory:
        type: io.kestra.plugin.ai.memory.KestraKVStore
        memoryId: JOHN
        ttl: PT1M
        messages: 5

yaml
id: agent_with_content_retriever
namespace: company.ai

inputs:
  - id: prompt
    type: STRING
    defaults: What is the latest Kestra release and what new features does it include? Name at least 3 new features added exactly in this release.

tasks:
  - id: agent
    type: io.kestra.plugin.ai.agent.AIAgent
    prompt: "{{ inputs.prompt }}"
    provider:
      type: io.kestra.plugin.ai.provider.GoogleGemini
      modelName: gemini-2.5-flash
      apiKey: "{{ kv('GEMINI_API_KEY') }}"
    contentRetrievers:
      - type: io.kestra.plugin.ai.retriever.TavilyWebSearch
        apiKey: "{{ kv('TAVILY_API_KEY') }}"

yaml
id: agent_with_structured_output
namespace: company.ai

inputs:
  - id: customer_ticket
    type: STRING
    defaults: >-
      I can't log into my account. It says my password is wrong, and the reset link never arrives.

tasks:
  - id: support_agent
    type: io.kestra.plugin.ai.agent.AIAgent
    provider:
      type: io.kestra.plugin.ai.provider.MistralAI
      apiKey: "{{ kv('MISTRAL_API_KEY') }}"
      modelName: open-mistral-7b

    systemMessage: |
      You are a classifier that returns ONLY valid JSON matching the schema.
      Do not add explanations or extra keys.

    configuration:
      responseFormat:
        type: JSON
        jsonSchema:
          type: object
          required: ["category", "priority"]
          properties:
            category:
              type: string
              enum: ["ACCOUNT", "BILLING", "TECHNICAL", "GENERAL"]
            priority:
              type: string
              enum: ["LOW", "MEDIUM", "HIGH"]

    prompt: |
      Classify the following customer message:
        {{ inputs.customer_ticket }}

yaml
id: market_research_agent
namespace: company.ai

inputs:
  - id: prompt
    type: STRING
    defaults: |
      Research the latest trends in workflow and data orchestration.
      Use web search to gather current, reliable information from multiple sources.
      Then create a well-structured Markdown report that includes an introduction,
      key trends with short explanations, and a conclusion.
      Save the final report as `report.md` in the `/tmp` directory.

tasks:
  - id: agent
    type: io.kestra.plugin.ai.agent.AIAgent
    provider:
      type: io.kestra.plugin.ai.provider.GoogleGemini
      apiKey: "{{ kv('GEMINI_API_KEY') }}"
      modelName: gemini-2.5-flash
    prompt: "{{ inputs.prompt }}"
    systemMessage: |
      You are a research assistant that must always follow this process:
      1. Use the TavilyWebSearch content retriever to gather the most relevant and up-to-date information for the user prompt. Do not invent information.
      2. Summarize and structure the findings clearly in Markdown format. Use headings, bullet points, and links when appropriate.
      3. Save the final Markdown report as `report.md` in the `/tmp` directory by using the provided filesystem tool.

      Important rules:
      - Never output raw text in your response. The final result must always be written to `report.md`.
      - If no useful results are retrieved, write a short note in `report.md` explaining that no information was found.
      - Do not attempt to bypass or ignore the retriever or the filesystem tool.

    contentRetrievers:
      - type: io.kestra.plugin.ai.retriever.TavilyWebSearch
        apiKey: "{{ kv('TAVILY_API_KEY') }}"
        maxResults: 10

    tools:
      - type: io.kestra.plugin.ai.tool.DockerMcpClient
        image: mcp/filesystem
        command: ["/tmp"]
        binds: ["{{workingDir}}:/tmp"] # mount host_path:container_path to access the generated report
    outputFiles:
      - report.md
Properties
Default {}
SubType string
Possible Values
STOPLENGTHTOOL_EXECUTIONCONTENT_FILTEROTHER
SubType string
SubType string
SubType string
Default false
Default false
Format date-time
SubType string
Default false
Default false
Format duration
SubType
Default https://api.deepseek.com/v1
Possible Values
STOPLENGTHTOOL_EXECUTIONCONTENT_FILTEROTHER
Default TEXT
Possible Values
TEXTJSON
SubType string
SubType string
SubType string
Default false
Default 3
SubType string
Default false
Default false
Format duration
Default 3
Default NEVER
Possible Values
NEVERBEFORE_TASKRUNAFTER_TASKRUN
Default {{ labels.system.correlationId }}
Default 10
Default 6379
Default PT1H
Format duration
Default NEVER
Possible Values
NEVERBEFORE_TASKRUNAFTER_TASKRUN
Default {{ labels.system.correlationId }}
Default 10
Default PT1H
Format duration
Default COHERE
Possible Values
COHERETITAN