<a id="rtce-lightning-queries"></a>

# Lightning Queries in Confluent Cloud

A *lightning query* reads data from the materialized table Confluent
maintains for a topic that has the Real-Time Context Engine enabled. Confluent
refreshes that table within seconds of new data arriving. The table
persists independently of the topic’s own retention policy, so a
lightning query can return data that has already aged out of the
topic itself.

Unlike a streaming query, which runs continuously and returns results
incrementally, a lightning query runs once and returns an output. In
that respect, it works like a [snapshot query](../../flink/concepts/snapshot-queries.md#flink-sql-snapshot-queries). But a lightning query targets a
different performance profile: millisecond response times and high
concurrency for point lookups, range scans, and full scans, rather
than complex, exploratory analysis over historical data.

## Query through an AI agent

Today, you issue a lightning query by connecting an AI agent to the
Real-Time Context Engine. The agent uses Model Context Protocol (MCP) tools to discover
topics, inspect schemas, and query data on your behalf.

For setup instructions and example queries, see [Query Data](query-data.md#rtce-query-data).

#### NOTE
Direct API access, issuing a lightning query yourself without an
AI agent, is an Early Access Program feature in Confluent Cloud.

<!-- Admonition for product maturity stage: EAP -->
<!-- Use this file for standard legalese in docs for new Early access Program features. -->
<!-- Suggested usage: -->
<!-- .. note: (add a second colon here) -->
<!-- Feature X is an Early Access Program feature in |product|. -->
<!-- .. include:: ../.hidden/docs-common/home/includes/product-maturity-stage-admonition-eap.rst -->
<!-- (optional) If you would like to participate in the Early Access Program, email address@confluent.io. -->
<!-- Reference: Product maturity stages and docs -->
<!-- https://confluentinc.atlassian.net/wiki/spaces/DOC/pages/2695004342/Product+maturity+stages+and+docs -->

An Early Access feature is a component of Confluent Cloud introduced to gain
feedback. This feature should be used only for evaluation and non-production
testing purposes or to provide feedback to Confluent, particularly as it
becomes more widely available in follow-on preview editions.

Early Access Program features are intended for evaluation use in development
and testing environments only, and not for production use. Early Access Program
features are provided: (a) without support; (b) “AS IS”; and (c) without
indemnification, warranty, or condition of any kind. No service level commitment
will apply to Early Access Program features. Early Access Program features are
considered to be a Proof of Concept as defined in the Confluent Cloud Terms of Service.
Confluent may discontinue providing preview releases of the Early Access
Program features at any time in Confluent’s sole discretion.

To participate in the Early Access Program, see the [sign-up form](https://events.confluent.io/early-access-flink-features).

## Related content

- [Overview](overview.md#real-time-context-engine) - How the Real-Time Context Engine delivers
  real-time data to AI agents.
- [Get Started](get-started.md#rtce-get-started) - Enable the Real-Time Context Engine and run
  your first query.
- [Query Data](query-data.md#rtce-query-data) - MCP tools, example queries, and
  supported SQL.

#### NOTE
This website includes content developed at the [Apache Software Foundation](https://www.apache.org/)
under the terms of the [Apache License v2](https://www.apache.org/licenses/LICENSE-2.0.html).
