<a id="rtce-manage-topics"></a>

# Manage Real-Time Context Engine Topics in Confluent Cloud

Enable, disable, and manage Real-Time Context Engine topics in your Confluent Cloud
cluster. For the quickest path to a working agent query, see
[Get Started](get-started.md#rtce-get-started).

## Prerequisites

You need the following to manage Real-Time Context Engine topics:

- A Basic, Standard, Enterprise, or Dedicated cluster on AWS in a
  [supported region](../../get-started/regions.md#providers-regions).
- A Apache Kafka® topic with a registered schema (Avro, Protobuf, or
  JSON Schema).
- At minimum, the CloudClusterAdmin role.
- A Cloud API key for CLI access.
- A Cloud API key or Global API key for Terraform access.

For full details on roles and permissions, see
[Access Control](access-control.md#rtce-access-control).

## Navigate to the Topics page

The Confluent Cloud Console procedures in the following sections all
start from the **Topics** page. To navigate to this page,
complete the following steps.

1. Sign in to [Confluent Cloud](https://confluent.cloud).
2. From the navigation menu, select **Environments** and then
   select your environment.
3. Click **Clusters** and then select your cluster.
4. From the navigation menu, select **Topics**.

## Enable the Real-Time Context Engine on a topic

When you enable the Real-Time Context Engine on a topic, Confluent Cloud materializes
the topic data into a table optimized for fast lookups. The
Real-Time Context Engine continuously ingests new data from the topic so that
the table always reflects the latest state.

### Cloud Console

To enable the Real-Time Context Engine on a topic, complete the following
steps.

1. In the topics list, find the **Context engine** column
   and click the status link for the topic you want to
   enable. This opens the Real-Time Context Engine side panel.
2. In the side panel, verify that all prerequisite checks
   pass. If any check shows a warning, the toggle is
   disabled.
3. Toggle the Real-Time Context Engine on.

   The status changes to **Turning on** while the data is
   materialized. When the process completes, the status
   changes to **On**.

### Confluent CLI

Use the following command to enable the Real-Time Context Engine on an
existing topic:

```bash
confluent rtce rtce-topic create \
  --cloud <CLOUD> \
  --region <REGION> \
  --topic-name <TOPIC_NAME> \
  --description "<TOPIC_DESCRIPTION>"
```

The following command-specific flags are supported:

* `--cloud`: Required. The cloud provider. Set to
  `aws`.
* `--region`: Required. The AWS region of the cluster.
* `--topic-name`: Required. The name of the Kafka topic
  to enable.
* `--description`: Optional. A description of the
  topic data.

The following example enables the Real-Time Context Engine on a topic:

```bash
confluent rtce rtce-topic create \
  --cloud aws \
  --region us-west-2 \
  --topic-name orders_topic \
  --description "Customer orders table"
```

### Confluent Cloud APIs

Send a POST request to enable the Real-Time Context Engine on a topic:

```bash
curl -X POST \
  https://api.confluent.cloud/rtce/v1/rtce-topics \
  -H "Content-Type: application/json" \
  -u "<API_KEY>:<API_SECRET>" \
  -d '{
    "spec": {
      "cloud": "<CLOUD>",
      "description": "<TOPIC_DESCRIPTION>",
      "environment": {"id": "<ENV_ID>"},
      "kafka_cluster": {"id": "<LKC_ID>"},
      "region": "<REGION>",
      "topic_name": "<TOPIC_NAME>"
    }
  }'
```

The following request body parameters are supported:

* `cloud`: Required. The cloud provider. Set to
  `AWS`.
* `region`: Required. The AWS region of the cluster.
* `topic_name`: Required. The name of the Kafka topic
  to enable.
* `environment.id`: Required. The ID of the Confluent Cloud
  environment.
* `kafka_cluster.id`: Required. The ID of the Kafka
  cluster.
* `description`: Optional. A description of the topic
  data.

The following example enables the Real-Time Context Engine on a topic:

```bash
curl -X POST \
  https://api.confluent.cloud/rtce/v1/rtce-topics \
  -H "Content-Type: application/json" \
  -u "$KEY:$SECRET" \
  -d '{
    "spec": {
      "cloud": "AWS",
      "description": "Customer orders table",
      "environment": {"id": "env-abc123"},
      "kafka_cluster": {"id": "lkc-abc123"},
      "region": "us-west-2",
      "topic_name": "orders_topic"
    }
  }'
```

### Terraform

Use the [confluent_rtce_topic](https://registry.terraform.io/providers/confluentinc/confluent/latest/docs/resources/confluent_rtce_topic)
resource to enable the Real-Time Context Engine on a topic:

```terraform
resource "confluent_rtce_topic" "example" {
  cloud = "<CLOUD>"
  description = "<TOPIC_DESCRIPTION>"
  environment {
    id = "<ENV_ID>"
  }
  kafka_cluster {
    id = "<LKC_ID>"
  }
  region = "<REGION>"
  topic_name = "<TOPIC_NAME>"
}
```

The following arguments are supported:

* `cloud`: Required. The cloud provider. Set to
  `"AWS"`.
* `region`: Required. The AWS region of the cluster.
* `topic_name`: Required. The name of the Kafka topic
  to enable.
* `environment.id`: Required. The ID of the Confluent Cloud
  environment.
* `kafka_cluster.id`: Required. The ID of the Kafka
  cluster.
* `description`: Optional. A description of the topic
  data.

The following example enables the Real-Time Context Engine on a topic:

```terraform
resource "confluent_rtce_topic" "example" {
  cloud = "AWS"
  description = "Customer orders table"
  environment {
    id = "env-abc123"
  }
  kafka_cluster {
    id = "lkc-abc123"
  }
  region = "us-west-2"
  topic_name = "orders_topic"
}
```

If enabling fails, verify that you meet the [prerequisites](#rtce-manage-topics).

## Disable the Real-Time Context Engine on a topic

When you disable the Real-Time Context Engine on a topic, the materialized table
is removed and AI agents lose access to the data immediately.

After you disable the Real-Time Context Engine on a topic, any AI agents that
query the topic receive errors until you re-enable the Real-Time Context Engine
and the data re-materializes.

### Cloud Console

To disable the Real-Time Context Engine on a topic, complete the following
steps.

1. In the topics list, find the **Context engine** column
   and click the status link for the topic you want to
   disable. This opens the Real-Time Context Engine side panel.
2. Toggle the Real-Time Context Engine off.

   The status changes to **Turning off**. When the process
   completes, the status changes to **Off**.

### Confluent CLI

Use the following command to disable the Real-Time Context Engine on a
topic:

```bash
confluent rtce rtce-topic delete <TOPIC_NAME>
```

The following example disables the Real-Time Context Engine on a topic:

```bash
confluent rtce rtce-topic delete orders_topic
```

### Confluent Cloud APIs

Send a DELETE request to disable the Real-Time Context Engine on a topic:

```bash
curl -X DELETE \
  "https://api.confluent.cloud/rtce/v1/rtce-topics/<TOPIC_NAME>?environment=<ENV_ID>&spec.kafka_cluster=<LKC_ID>" \
  -u "<API_KEY>:<API_SECRET>"
```

The following query parameters are required:

* `environment`: The ID of the Confluent Cloud environment.
* `spec.kafka_cluster`: The ID of the Kafka cluster.

The following example disables the Real-Time Context Engine on a topic:

```bash
curl -X DELETE \
  "https://api.confluent.cloud/rtce/v1/rtce-topics/orders_topic?environment=env-abc123&spec.kafka_cluster=lkc-abc123" \
  -u "$KEY:$SECRET"
```

### Terraform

To disable the Real-Time Context Engine on a topic, remove the
`confluent_rtce_topic` resource from your
Terraform configuration and run `terraform apply`.

## View enabled topics

You can view the list of topics that have the Real-Time Context Engine enabled and
check their current status.

### Cloud Console

The **Context engine** column shows the status of each
topic. Possible values are **On**, **Off**, **Turning on**,
and **Turning off**.

### Confluent CLI

Use the following command to list topics with the Real-Time Context Engine
enabled:

```bash
confluent rtce rtce-topic list
```

### Confluent Cloud APIs

Send a GET request to list topics with the Real-Time Context Engine
enabled:

```bash
curl -X GET \
  "https://api.confluent.cloud/rtce/v1/rtce-topics?environment=<ENV_ID>&spec.kafka_cluster=<LKC_ID>" \
  -u "<API_KEY>:<API_SECRET>"
```

The following query parameters are required:

* `environment`: The ID of the Confluent Cloud environment.
* `spec.kafka_cluster`: The ID of the Kafka cluster.

The following example lists enabled topics:

```bash
curl -X GET \
  "https://api.confluent.cloud/rtce/v1/rtce-topics?environment=env-abc123&spec.kafka_cluster=lkc-abc123" \
  -u "$KEY:$SECRET"
```

## Edit a table description

A table description helps AI agents understand the data in a
topic and select the right tool for their query. You can add or
update a description at any time after enabling the Real-Time Context Engine.

#### NOTE
Editing a table description is not supported in the
Cloud Console.

Send a PATCH request to update the description for a topic
that has the Real-Time Context Engine enabled:

```bash
curl -X PATCH \
  "https://api.confluent.cloud/rtce/v1/rtce-topics/<TOPIC_NAME>?environment=<ENV_ID>&spec.cloud=AWS&spec.kafka_cluster=<LKC_ID>" \
  -H "Content-Type: application/json" \
  -u "<API_KEY>:<API_SECRET>" \
  -d '{
    "spec": {
      "environment": {"id": "<ENV_ID>"},
      "kafka_cluster": {"id": "<LKC_ID>"},
      "description": "<NEW_DESCRIPTION>"
    }
  }'
```

The following query parameters are required:

* `environment`: The ID of the Confluent Cloud environment.
* `spec.cloud`: The cloud provider. Set to `AWS`.
* `spec.kafka_cluster`: The ID of the Kafka cluster.

The following example updates the description for an enabled
topic:

```bash
curl -X PATCH \
  "https://api.confluent.cloud/rtce/v1/rtce-topics/orders_topic?environment=env-abc123&spec.cloud=AWS&spec.kafka_cluster=lkc-abc123" \
  -H "Content-Type: application/json" \
  -u "$KEY:$SECRET" \
  -d '{
    "spec": {
      "environment": {"id": "env-abc123"},
      "kafka_cluster": {"id": "lkc-abc123"},
      "description": "Customer orders with status and shipping details"
    }
  }'
```

## Schema changes

Changing the schema for a topic that has the Real-Time Context Engine enabled
causes agents that query the topic to receive errors. To
resolve the issue, contact [Confluent Support](https://support.confluent.io).

## Related content

- [Get Started](get-started.md#rtce-get-started) - Enable the RTCE and
  run your first query.
- [Access Control](access-control.md#rtce-access-control) - Required roles
  for each operation.

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