# Drive KubeMQ from an LLM (/deploy/scenarios/agents/drive-from-llm)



<Callout type="info">
  KubeMQ must be running — see the [Quickstart](/deploy/quickstart#get-your-key) (steps
  1–2 get you there; instant if it's already up).
</Callout>

The MCP gateway is already live on `http://localhost:9090/mcp` — no enable step. Once an
MCP host is pointed at it and at least one agent is registered, the same conversation can
enqueue durable work **and** call an agent — messaging and agents, one fabric, one session.

<Callout type="info" title="Two quick prerequisites">
  If you haven't done these yet: [connect an MCP host](/deploy/scenarios/agents/connect-mcp-host)
  to `http://localhost:9090/mcp`, and [register an agent](/deploy/scenarios/agents/register-first-agent)
  for it to call. Both take a couple of minutes.
</Callout>

## 1 · One prompt, two tool calls [#1--one-prompt-two-tool-calls]

Ask your connected LLM host something that needs both capabilities, for example:

> "Enqueue order 1042 for the fulfillment worker, then ask the order-status agent for
> an ETA."

The host resolves that into two MCP tool calls against the same `/mcp` session — one
against KubeMQ's durable queue, one against the agent bridge:

```json title="queue_send"
{ "name": "queue_send", "arguments": { "channel": "orders", "body": "{\"id\":1042}" } }
```

```json title="agent_send"
{ "name": "agent_send", "arguments": { "agent_id": "order-status-agent", "message": "What is the ETA for order 1042?" } }
```

## 2 · Verify [#2--verify]

You should see two results come back in the conversation, both round-tripped through
the same MCP session — no separate connection, no glue code.

<Callout type="info" title="Expected result">
  `queue_send` returns the MCP queue envelope with a generated message ID (and the
  `orders` channel ticks in the dashboard):

  ```json title="queue_send result"
  {
    "content": [
      { "type": "text", "text": "{\"message_id\":\"a1b2c3...\",\"sent_at\":\"2026-06-08T10:00:00Z\",\"is_error\":false}" }
    ],
    "isError": false
  }
  ```

  `agent_send` returns the order-status agent's reply, bridged from its A2A response:

  ```json title="agent_send result"
  {
    "content": [
      { "type": "text", "text": "{\"status\":\"in-transit\",\"eta\":\"2 days\"}" }
    ],
    "isError": false
  }
  ```
</Callout>

## Didn't work? [#didnt-work]

<Callout type="warn">
  * **MCP host has no tools** — confirm it completed the `initialize` handshake against
    `http://localhost:9090/mcp`; see [Connect an MCP host](/deploy/scenarios/agents/connect-mcp-host).
  * **`agent_send` returns "Agent not found"** — register the agent first; the `agent_id`
    must match exactly.
  * **`queue_send` returns a `-32602` error** — the channel name starts with the reserved
    `_AGENTS_.` prefix, or `channel`/`body` is missing.
</Callout>

## Go deeper [#go-deeper]

<Cards>
  <Card title="Orchestrate from an LLM" href="/aiway/tutorial/orchestrate-from-an-llm" description="The full tutorial step — connect, discover with agent_list, and invoke with agent_send — building on a registered agent." />

  <Card title="Aiway overview" href="/aiway" description="The big picture: an AI-agent fabric with two doors in — A2A and MCP — across one broker." />
</Cards>
