﻿---
title: Context Engine
description: Learn how AI indices, sources, automations, and Knowledge Indicators make context available to agents.
url: https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine
products:
  - Elastic Documentation
  - Elastic Observability
  - Elastic Security
  - Elasticsearch
  - Kibana
applies_to:
  - Elastic Cloud Serverless: Experimental
  - Elastic Stack: Planned
---

# Context Engine
<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/4384/explore-analyze/ai-features/context-engine)
    - [Context Engine quickstart](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/quickstart)
  - [Context Engine concepts](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/concepts)
  - [Build and maintain an AI index](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/build-and-maintain-ai-index)
    - [Create and manage AI indices](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/create-and-manage-ai-indices)
  - [Add and manage sources](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/add-and-manage-sources)
  - [Create and manage automations](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/create-and-manage-automations)
  - [Evaluate and improve KIs](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/evaluate-and-improve-knowledge-indicators)
  - [Use an AI index](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/use-an-ai-index)
    - [Retrieve context](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/retrieve-context-from-ai-index)
  - [Configure agents to use an AI index](https://www.elastic.co/elastic/docs-builder/docs/4384/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/4384/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/4384/explore-analyze/ai-features/context-engine/langchain-integration)
  - [Context Engine APIs](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/context-engine-api)
</important>

Context Engine enables you to distill raw source data into context optimized for retrieval by agents and applications. Without reusable context, agents can spend each run rediscovering which data to use, what it means, and how to query it. Building this context up front reduces repeated source data scanning and interpretation, helping agents respond faster and use fewer model tokens.
Automations distill source data into Knowledge Indicators, which agents and applications retrieve from an AI index:
![Sources feed automations that generate Knowledge Indicators in an AI index. Agents retrieve the Knowledge Indicators and can use their guidance to query source data directly for more detailed or up-to-date information. Agent traces can reveal where the context needs improvement.](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/images/context-engine-flow.svg)


## Context Engine use cases

Context Engine is useful when agents repeatedly need to interpret large, complex, or changing bodies of data. For example, you can:
- Turn technical documentation, policies, cases, or runbooks into reusable explanations, procedures, and limitations.
- Give agents business definitions and verified query patterns for working with structured data.
- Build context that develops across records, such as profiles of services, systems, accounts, or projects.
- Surface significant findings or conditions without making every agent analyze all source records.

These use cases share the same advantage: move recurring interpretation into an automation, reuse the resulting context across questions and agents, and improve it as agent traces reveal gaps.
For example, consider an agent asked to summarize the issues affecting your largest customers. The agent still needs access to the account, support, and contract data that contains the answer. Context Engine changes how much discovery and interpretation the agent must perform before it can use that data:

| Without Context Engine                                                          | With Context Engine                                                                  |
|---------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
| Discover the relevant sources and inspect their structure during the agent run. | Retrieve KIs that describe the relevant sources and when to use them.                |
| Infer business meaning, relationships between customers, and known limitations. | Reuse context that automations generated from the source data.                       |
| Develop and test queries before addressing the task.                            | Follow verified query guidance when source data must be queried directly.            |
| Repeat the same interpretation in later runs or other agents.                   | Refine the automation and regenerate its KIs so future runs can use the improvement. |


## How Context Engine works

To build and use context with Context Engine:
<stepper>
  <step title="Create an AI index">
    Create an [AI index](/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/concepts#ai-indices) for a defined area of context.
  </step>

  <step title="Add source data">
    Add one or more [sources](/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/concepts#sources) that contain the relevant data.
  </step>

  <step title="Generate Knowledge Indicators">
    Configure [automations](/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/concepts#automations-and-workflows), implemented as [Elastic Workflows](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/workflows), to generate and refresh [KIs](/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/concepts#knowledge-indicators) from those sources.
  </step>

  <step title="Make the context available">
    Make the AI index available to an [agent or application](/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/concepts#agents-and-applications).
  </step>

  <step title="Configure context retrieval">
    Configure the agent or application with the appropriate [tools and instructions](/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/concepts#tools-system-instructions-and-skills) to retrieve KIs as context and use KI guidance to query source data directly when more detailed or up-to-date information is required.
  </step>

  <step title="Evaluate and improve the context">
    Review KIs and [agent traces](/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/concepts#agent-traces) to identify missing, misleading, or underused context. Refine the sources or automations, regenerate the KIs, and repeat as questions and source data change.
  </step>
</stepper>


## Context Engine quickstart

Follow the [Context Engine quickstart](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/quickstart) to create an AI index from existing Elasticsearch data, generate your first KI, and test how an Elastic Agent Builder agent uses it.

## Context Engine concepts

Learn how AI indices, sources, automations, KIs, and agent access fit together in [Context Engine concepts](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/concepts).

## Build and maintain an AI index

Learn how to choose source data, select a KI generation strategy, review automations, and maintain useful context in [Build and maintain an AI index](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/build-and-maintain-ai-index).

## Use an AI index

Learn how to retrieve context directly or through an agent or application in [Use an AI index](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/use-an-ai-index).

## Reference

Use the [Context Engine API guide](https://www.elastic.co/elastic/docs-builder/docs/4384/explore-analyze/ai-features/context-engine/context-engine-api) to find the available operations and links to the complete Kibana API reference.