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.

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.

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

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.

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.

    Tip

    You might need to scroll the topics table to the right to see the Context engine column.

  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.

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

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:

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

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

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:

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"
    }
  }'

Use the confluent_rtce_rtce_topic resource to enable the Real-Time Context Engine on a topic:

resource "confluent_rtce_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:

resource "confluent_rtce_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.

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.

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.

    Tip

    You might need to scroll the topics table to the right to see the Context engine column.

  2. Toggle the Real-Time Context Engine off.

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

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

confluent rtce rtce-topic delete <TOPIC_NAME>

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

confluent rtce rtce-topic delete orders_topic

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

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:

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

To disable the Real-Time Context Engine on a topic, remove the confluent_rtce_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.

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

Tip

You might need to scroll the topics table to the right to see the Context engine column.

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

confluent rtce rtce-topic list

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

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:

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:

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:

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.