﻿---
title: Create and manage AI index automations
description: Create, inspect, run, schedule, update, and remove the workflow automations that generate Knowledge Indicators.
url: https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/create-and-manage-automations
products:
  - Elastic Documentation
  - Elastic Observability
  - Elastic Security
  - Elasticsearch
  - Kibana
applies_to:
  - Elastic Cloud Serverless: Experimental
  - Elastic Stack: Planned
---

# Create and manage AI index automations
<important>
  This page is currently hidden from the documentation navigation.The following Context Engine pages are live:
  - [Landing page](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine)
    - [Get started with Context Engine](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/quickstart)
  - [Context Engine concepts](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/concepts)
  - [Build and maintain an AI index](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/build-and-maintain-ai-index)
    - [Create and manage AI indices](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/create-and-manage-ai-indices)
  - [Add and manage sources](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/add-and-manage-sources)
  - [Create and manage automations](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/create-and-manage-automations)
  - [Evaluate and improve KIs](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/evaluate-and-improve-knowledge-indicators)
  - [Use Context Engine with agents and applications](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/use-context-engine-with-agents)
    - [Use Context Engine with Agent Builder](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/use-context-engine-with-agent-builder)
  - [Query AI indices from LangChain](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/langchain-integration)
  - [Context Engine APIs](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/context-engine-api)
</important>

Automations generate and refresh Knowledge Indicators (KIs) from an AI index's sources. Context Engine runs each automation as an [Elastic workflow](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/workflows). You can have Elastic Agent Builder propose and pilot one, author one in the Workflows UI, or manage workflows and their AI index associations programmatically.

## Before you begin

You need a custom AI index with at least one source, the **All** privilege for the **Context Engine** feature, and permission to create and manage workflows. To use the guided route, you also need access to Elastic Agent Builder and permission to run workflows.
Decide what each KI should represent before creating an automation. Refer to [Select a generation strategy](/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/build-and-maintain-ai-index#select-a-generation-strategy) and [Design useful Knowledge Indicators](/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/build-and-maintain-ai-index#design-useful-knowledge-indicators).

## Create an automation with Agent Builder

Use the guided route to have Elastic Agent Builder propose, pilot, and save a workflow for the AI index:
1. Open **Context**, then select the AI index.
2. In **Automations**, select **Suggest automation**.
3. Elastic Agent Builder opens a new conversation and sends a request to suggest an automation for the AI index.
4. Review the proposed generation strategy, source coverage, KI content, and verification plan.
5. Ask for changes where necessary, then confirm that Elastic Agent Builder should build and pilot the workflow.
6. Review the pilot summary and temporary KI output.
7. Tell Elastic Agent Builder to save the automation.
8. Return to the AI index and confirm that the saved workflow appears in **Automations**.

The pilot can create and delete temporary KIs while testing the workflow. Focus your review on the source data it reads, what each KI represents, the claims and query guidance it generates, and the checks it performs before writing a KI. You do not need to understand every line of the generated YAML.

## Create an automation manually

Use the manual route when you intend to author the workflow yourself:
1. Open the AI index and select **Create automation**.
2. Context Engine creates and attaches a workflow with **Enabled** turned off, then opens it in the Workflows YAML editor.
3. Replace the generic starter workflow with the trigger and steps that generate the intended KIs.
4. Include the appropriate Context Engine workflow steps to create, update, verify, or delete KIs.
5. Test the workflow, review its output, then save it.
6. Return to the AI index and confirm that the workflow appears in **Automations**.

For YAML editing and test runs, refer to [Use the YAML editor](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/workflows/authoring-techniques/use-yaml-editor).

## Inspect or edit an automation

The AI index lists each attached workflow and whether it is enabled.
To inspect or edit one:
1. Open the AI index.
2. In **Automations**, use the preview action to inspect the workflow YAML without leaving the page.
3. Select **Edit workflow** to open it in the Workflows editor.
4. Make and test the required changes, then save the workflow.

Saving a workflow creates a versioned snapshot. For information about comparing or restoring versions, refer to [Workflow version history](/elastic/docs-builder/docs/4300/explore-analyze/workflows/authoring-techniques/manage-workflows#workflows-version-history).

## Run, schedule, and monitor an automation

Operate an automation from the Workflows UI:
- [Run the workflow manually](/elastic/docs-builder/docs/4300/explore-analyze/workflows/authoring-techniques/manage-workflows#workflow-run) to generate or refresh KIs immediately.
- Add a [scheduled trigger](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/workflows/triggers/scheduled-triggers) when its KIs must refresh automatically.
- [Monitor the execution](/elastic/docs-builder/docs/4300/explore-analyze/workflows/authoring-techniques/monitor-workflows#workflows-monitor-execution) and inspect the inputs, outputs, and errors for each step.
- Use the **Enabled** toggle to control whether the workflow responds to its configured triggers.

After a successful run, return to the AI index's **Knowledge Indicators** tab and confirm that the expected KIs were created or updated.

## Detach or delete an automation

Removing an automation from an AI index detaches its workflow. It does not delete the workflow itself.
Detach an automation as follows:
1. Open the AI index.
2. In **Automations**, select **Edit**.
3. Remove the automation, then select **Save**.
4. Confirm that it no longer appears in the AI index.

To delete the detached workflow, delete it separately from the Workflows UI. You can also choose to delete attached automations when you [delete the AI index](/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/create-and-manage-ai-indices#delete-an-ai-index).

## Manage automations with the APIs

Use the Workflows APIs together with the Context Engine APIs when you need to provision or operate automations programmatically:
1. Create the workflow with the [create workflow API](https://www.elastic.co/docs/api/doc/kibana/operation/operation-post-workflows-workflow), or modify an existing workflow with the [update workflow API](https://www.elastic.co/docs/api/doc/kibana/operation/operation-put-workflows-workflow-id). Use the [get workflow API](https://www.elastic.co/docs/api/doc/kibana/operation/operation-get-workflows-workflow-id) to retrieve its current definition before changing it.
2. Attach the workflow by adding its ID to the AI index's `automations` array with the [create or update AI index API](https://www.elastic.co/docs/api/doc/kibana/operation/operation-put-context-engine-ai-index-aiindexid):
   ```json
   {
     "automations": [
       {
         "type": "workflow",
         "value": "my-workflow-id"
       }
     ]
   }
   ```
3. Run it with the [run workflow API](https://www.elastic.co/docs/api/doc/kibana/operation/operation-post-workflows-workflow-id-run), or enable its configured trigger. Use the [get workflow executions API](https://www.elastic.co/docs/api/doc/kibana/operation/operation-get-workflows-workflow-workflowid-executions) to inspect its runs.
4. To detach it, remove its entry from the AI index's `automations` array. To remove the workflow itself, use the [delete workflow API](https://www.elastic.co/docs/api/doc/kibana/operation/operation-delete-workflows-workflow-id) separately.

Updating an AI index replaces its complete record. For an example that preserves the other fields, refer to [Update an AI index with the API](/elastic/docs-builder/docs/4300/explore-analyze/ai-features/context-engine/create-and-manage-ai-indices#update-ai-index-api).