← Back to Blog

How to Run an AI Kafka Message Queue Agent with OE Runtime

Publish events, check consumer lag, and monitor your Kafka topics with AI. OE Runtime lets you run a local Kafka agent that verifies topic health and delivers structured messages with confirmed offsets — no separate Kafka tooling required.

📨
Step 1
Check Topic Status
List available topics, their partition counts, and consumer group lag.
Step 2
Publish Test Events
Publish 3 structured JSON events one at a time and confirm each with the returned offset.
Step 3
Report
Summarise topics found, lag before publishing, events published, and delivery confirmation.

The Agent YAML

Create a file called agent.yaml inside a message-queues/ directory:

name: Queue Publisher
description: Publish messages to Kafka topics and verify delivery
instructions: |
  You are a message queue agent. Publish events to Kafka topics and confirm delivery.
  Format all payloads as JSON. Include event_type, timestamp, and payload in every message.
  Complete all steps fully before writing your report.
steps:
  - name: Check Topic Status
    content: |
      List the available Kafka topics and their partition counts.
      Check the consumer group lag for the main topic to see if messages are being consumed.
  - name: Publish Test Events
    content: |
      Publish 3 test events to the main topic with the following structure:
        { "event_type": "system.health_check", "timestamp": "<current ISO timestamp>", "payload": { "status": "ok", "sequence": <1, 2, 3> } }
      Publish them one at a time and confirm each delivery with the returned offset.
  - name: Report
    content: |
      Summarize queue activity:
      - Topics found and their partition counts
      - Consumer group lag before publishing
      - Events published (topic, offset, timestamp for each)
      - Delivery confirmation status
connectors:
  - connection_name: My Kafka
    connection_type: kafka

The Config File

Create oe-config.json in the same directory:

{
  "llm": {
    "provider": "openai",
    "model": "gpt-4o",
    "apiKey": "YOUR_OPENAI_API_KEY"
  },
  "server": {
    "enabled": false,
    "port": 3333,
    "apiKey": "your-secret-api-key"
  },
  "connectors": [
    {
      "connection_name": "My Kafka",
      "connection_type": "kafka",
      "brokers": ["localhost:9092"],
      "clientId": "oe-runtime",
      "topic": "my-topic"
    }
  ]
}

Replace localhost:9092 with your Kafka broker address. For managed Kafka services like Confluent Cloud or AWS MSK, add SSL and SASL authentication fields to the connector config.

Download OE Runtime

OE Runtime — Direct Downloads

Run the Agent

Windows

# Run the agent
oe-runtime-win.exe message-queues/agent.yaml --config message-queues/oe-config.json

macOS

# Make executable (first time only)
chmod +x oe-runtime-macos

# Run the agent
oe-runtime-macos message-queues/agent.yaml --config message-queues/oe-config.json

Linux

# Make executable (first time only)
chmod +x oe-runtime-linux

# Run the agent
oe-runtime-linux message-queues/agent.yaml --config message-queues/oe-config.json

macOS Gatekeeper: On first run, macOS may block the binary. Go to System Settings → Privacy & Security → click "Allow Anyway" next to oe-runtime-macos.

Running as an API Server

Add --serve to start OE Runtime as an HTTP server on port 3333:

oe-runtime-win.exe --serve --config message-queues/oe-config.json

Then send a request:

curl -X POST http://localhost:3333/run \
  -H "Content-Type: application/json" \
  -d '{"yaml": "message-queues/agent.yaml", "params": {}}'

Or import the Postman collection (download above) to test all endpoints visually.

Use Cases

Build your own agents with OE Runtime

Download OE Runtime and run any AI agent locally or as a server — no cloud required.

Get OE Runtime →