﻿---
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/4300/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/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>

Context Engine enables you to distill raw source data into context optimized for retrieval by agents and applications. This upfront investment reduces repeated source data scanning and interpretation, helping agents respond faster and use fewer model tokens.

## 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.

## 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/4300/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/4300/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/4300/explore-analyze/ai-features/context-engine/concepts#automations-and-workflows), implemented as [Elastic Workflows](https://www.elastic.co/elastic/docs-builder/docs/4300/explore-analyze/workflows), to generate and refresh [KIs](/elastic/docs-builder/docs/4300/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/4300/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/4300/explore-analyze/ai-features/context-engine/concepts#tools-system-instructions-and-skills) to retrieve KIs as context and query source data when current detail is required.
  </step>

  <step title="Evaluate and improve the context">
    Review KIs and [agent traces](/elastic/docs-builder/docs/4300/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>


## Get started with Context Engine

Follow [Get started with Context Engine](https://www.elastic.co/elastic/docs-builder/docs/4300/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/4300/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/4300/explore-analyze/ai-features/context-engine/build-and-maintain-ai-index).

## Use Context Engine with agents and applications

Learn how to [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), including Elastic Agent Builder agents and agents built with LangChain.