Event-driven AI agents

Stop polling every minute. Let events wake the agent.

The official MsgMesh MCP Server turns the event bus into tools an agent can call. The agent waits with watch_topic, handles an event, then waits again.

Where it fits

When an agent must wait for the outside world.

Schedules fit work at a known time. Event subscriptions fit work that must start whenever something happens.

01

Support and tickets

When a new issue, status change, or escalation enters a topic, the agent can reply, classify, or hand it off.

02

Operational alerts

Send actionable business alerts into a stream so an agent can gather context and propose the next step.

03

Orders and workflow handoffs

When an order, refund, or review result arrives, the agent can call the next tool while your system owns the write.

How it works

Separate event input from agent decisions.

The application publishes an event

Your service publishes a JSON event to an existing topic over HTTP or an SDK. MsgMesh does not interpret the payload.

The agent calls watch_topic

The tool long-polls for the next batch. It reads the whole topic and cannot filter by room.

The model decides and calls tools

The MCP client gives the event to the model. Your agent host and prompt policy decide whether execution is automatic or requires approval.

Wait again after processing

Keep the watch → react → watch loop bounded. Record cursors and outcomes so failures do not cause endless repeats.

Permissions and safety

Decide what the agent may do before sharing a key.

NeedRecommended keyWhy
Wait for events onlyConsumer key or subscribe-only capability keyA leaked key cannot publish or manage resources.
Receive events and publish resultsSubscribe + publish only on selected topicsKeep reads and writes inside the agent's workflow.
Create topics or keysAdmin keyGovernance tools need admin scope; keep them out of uncontrolled loops.

Keep reading

Let the agent see its first event.

MCP setup takes about five minutes. Keep human approval on governance tools.

View MCP setup →