Skip to main content
connic

RabbitMQ

Every message in a queue starts an agent run, and results go to an exchange as persistent, confirmed messages. connic acknowledges each message once its runs are stored.

Modes
Inbound, Outbound
Set up in
Dashboard or connectors/*.yaml
Documentation
RabbitMQ docs
Publisher
By connic

Turn every message into an agent run

An inbound connector consumes one queue and starts each linked agent once per message, with the message as its input.

JSON keeps its shape
A JSON object arrives with its top-level fields, plus _rabbitmq with the queue, exchange, routing key, message ID, headers and timestamp.
Text arrives as text
Any other body arrives under message: other JSON values as parsed, plain text as a string.
Files in the message
A JSON object can carry a files array with each file's name, MIME type and base64 data, up to 50 files and 32 MiB in total.
message on orders
{
  "order_id": "ord_8812",
  "customer": "jana@example.com",
  "total": 184.5
}
context["payload"]
{
  "order_id": "ord_8812",
  "customer": "jana@example.com",
  "total": 184.5,
  "_rabbitmq": {
    "queue": "orders",
    "exchange": "events",
    "routing_key": "orders.created",
    "message_id": "ord_8812-created",
    "correlation_id": null,
    "content_type": "application/json",
    "headers": {},
    "timestamp": "2026-10-13T09:00:00+00:00",
    "redelivered": false
  }
}

Acknowledge each message after its runs are stored

connic acknowledges a message once a queued run exists for every linked agent, so a restart or a deploy doesn't drop work, and long runs don't hold the message.

One run per message
A message delivered again reuses its stored run, matched by message_id, or by body and headers without one.
Failed runs stay in Agent Runs
A run that fails after it was stored doesn't redeliver the message. It keeps its full input in Agent Runs, where you can re-run it.
Shared queues
Several connectors on the same queue split its messages: RabbitMQ delivers each message to one of them.
  1. Receive

    RabbitMQ sends up to prefetch messages ahead, and connic handles them in arrival order.

  2. Store

    connic stores a queued run for every linked agent. Stored runs survive worker restarts and deployments.

  3. Acknowledge

    The message is acknowledged. If storing a run fails, the message goes back to the queue and arrives again after a short delay.

    basic.ack
  4. Run

    Runs execute in parallel up to max_concurrent_runs. A concurrency rule on a field such as the order ID starts runs for the same value one at a time.

    concurrency.key: order_id

Keep the consumer next to your agents

Declare it as a YAML file in connectors/. Host, user and TLS live in a Connection, so the file names only the queue and the prefetch. A consumer declared in code starts reading when its deployment goes live.

TLS by default
connic connects over TLS and checks the broker's certificate. For a private CA, paste its PEM contents into the Connection.
Private brokers
Direct connections need a broker that resolves to public IP addresses. Reach a broker inside your network through a bridge.
connectors/order-events.yaml
type: rabbitmq
mode: inbound
name: Order events
connection: orders-rabbitmq
config:
  queue: orders
  prefetch: 10
agents:
  - order-processor
create: connectors/order-events.yaml (rabbitmq)

Publish results to an exchange

An outbound connector publishes each completed run to an exchange with its routing key, and waits for the broker to confirm it.

Persistent and confirmed
Messages use persistent delivery mode and publisher confirms. A message that no queue takes fails the delivery instead of disappearing.
Run ID as message ID
Each message carries the run ID as message_id, so consumers can drop duplicates after a retry.
Let the agent publish
Linked as an agent tool, the connector lets the model publish its own payload during the run.
connectors/order-results.yaml
type: rabbitmq
mode: outbound
name: Order results
connection: orders-rabbitmq
config:
  exchange: order-results
  routing_key: orders.processed
agents:
  - name: order-processor
    outbound:
      usage: automatic
      source: [order-events]
message on order-results (persistent, message_id = run_id)
{
  "run_id": "550e8400-e29b-41d4-a716-446655440000",
  "agent_name": "order-processor",
  "status": "completed",
  "output": "ord_8812 approved for standard shipping.",
  "error": null,
  "started_at": "2026-10-13T09:00:01Z",
  "ended_at": "2026-10-13T09:00:05Z",
  "token_usage": {
    "input_tokens": 642,
    "output_tokens": 38,
    "thinking_tokens": 0,
    "cached_input_tokens": 0,
    "total_tokens": 680
  }
}

Where RabbitMQ fits

Pick a setup to see which queue starts the run, what the agent receives and where the result goes.

Each order event starts a run, and the result lands on the order-results exchange.

Checkout service
RabbitMQ consumer
order-processor
Result on order-results
context["payload"]
{
  "order_id": "ord_8812",
  "customer": "jana@example.com",
  "total": 184.5,
  "_rabbitmq": {
    "queue": "orders",
    "exchange": "events",
    "routing_key": "orders.created",
    "message_id": "ord_8812-created",
    "correlation_id": null,
    "content_type": "application/json",
    "headers": {},
    "timestamp": "2026-10-13T09:00:00+00:00",
    "redelivered": false
  }
}
message on order-results
{
  "run_id": "550e8400-e29b-41d4-a716-446655440000",
  "agent_name": "order-processor",
  "status": "completed",
  "output": "ord_8812 approved for standard shipping.",
  "error": null,
  "started_at": "2026-10-13T09:00:01Z",
  "ended_at": "2026-10-13T09:00:05Z",
  "token_usage": {
    "input_tokens": 642,
    "output_tokens": 38,
    "thinking_tokens": 0,
    "cached_input_tokens": 0,
    "total_tokens": 680
  }
}

The agent reads each new ticket and publishes the team and priority for the helpdesk to pick up.

Helpdesk
RabbitMQ consumer
ticket-router
Routing on tickets.routed
context["payload"]
{
  "ticket_id": "T-48213",
  "subject": "Invoice shows the wrong VAT number",
  "customer": "acme-gmbh",
  "_rabbitmq": {
    "queue": "support-tickets",
    "exchange": "events",
    "routing_key": "tickets.opened",
    "message_id": "T-48213-opened",
    "correlation_id": null,
    "content_type": "application/json",
    "headers": {},
    "timestamp": "2026-10-13T09:00:00+00:00",
    "redelivered": false
  }
}
connector-payload.json
{
  "payload": {
    "ticket_id": "T-48213",
    "team": "billing",
    "priority": "normal"
  }
}

A scanned invoice arrives with the message, and the agent extracts the fields your ERP needs.

Mail gateway
RabbitMQ consumer
invoice-reader
Fields to the ERP queue
context["payload"]
{
  "supplier": "Nordlicht Logistik",
  "files": [
    { "name": "invoice-2210.pdf", "mime_type": "application/pdf", "data": "JVBERi0xLjcK..." }
  ],
  "_rabbitmq": {
    "queue": "invoices",
    "exchange": "events",
    "routing_key": "invoices.received",
    "message_id": "inv-2210",
    "correlation_id": null,
    "content_type": "application/json",
    "headers": {},
    "timestamp": "2026-10-13T09:00:00+00:00",
    "redelivered": false
  }
}
connector-payload.json
{
  "payload": {
    "invoice_number": "2210",
    "total": 1840.0,
    "currency": "EUR",
    "due_date": "2026-11-12"
  }
}

A delayed shipment starts a run, and the agent emails the customer the new delivery date.

Warehouse system
RabbitMQ consumer
delay-notifier
Email to the customer
context["payload"]
{
  "shipment_id": "shp_5531",
  "order_id": "ord_8812",
  "status": "delayed",
  "new_eta": "2026-10-16",
  "_rabbitmq": {
    "queue": "shipment-updates",
    "exchange": "events",
    "routing_key": "shipments.delayed",
    "message_id": "shp_5531-delayed",
    "correlation_id": null,
    "content_type": "application/json",
    "headers": {},
    "timestamp": "2026-10-13T09:00:00+00:00",
    "redelivered": false
  }
}
connector-payload.json
{
  "body": "Your order ord_8812 is running late. It now arrives on October 16.",
  "to": "jana@example.com",
  "subject": "New delivery date for your order"
}

RabbitMQ FAQ

Add a RabbitMQ connector in Inbound (Consumer) mode, pick a Connection with your broker, enter the queue and link the agent. Connectors created in the dashboard start paused, so click Resume when you're ready. Each message then starts a run for every linked agent, with the message properties under _rabbitmq.

As soon as a queued run is stored for every linked agent, before the runs execute. Long runs therefore never hit RabbitMQ's consumer timeout. If storing a run fails, connic closes the connection and RabbitMQ returns the message to the queue.

No. connic identifies a message by its message_id property, or by its body and headers when it has none, and reuses the run it already stored. A failed run isn't retried by redelivery, so re-run it from Agent Runs.

A body that isn't valid UTF-8 is rejected without requeueing, so RabbitMQ sends it to the queue's dead-letter exchange if it has one. On quorum queues, a message that keeps coming back is dead-lettered after 20 deliveries by default. The RabbitMQ docs list every case.