Context Engine

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

To build and use context with Context Engine:

  1. Create an AI index

    Create an AI index for a defined area of context.

  2. Add source data

    Add one or more sources that contain the relevant data.

  3. Generate Knowledge Indicators

    Configure automations, implemented as Elastic Workflows, to generate and refresh KIs from those sources.

  4. Make the context available

    Make the AI index available to an agent or application.

  5. Configure context retrieval

    Configure the agent or application with the appropriate tools and instructions to retrieve KIs as context and query source data when current detail is required.

  6. Evaluate and improve the context

    Review KIs and 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.

Follow Get started with Context Engine to create an AI index from existing Elasticsearch data, generate your first KI, and test how an Elastic Agent Builder agent uses it.

Learn how AI indices, sources, automations, KIs, and agent access fit together in Context Engine concepts.

Learn how to choose source data, select a KI generation strategy, review automations, and maintain useful context in Build and maintain an AI index.

Learn how to use Context Engine with agents and applications, including Elastic Agent Builder agents and agents built with LangChain.