> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kylon.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Grok Bot to Kylon

> Connect one of your Bots in Grok Bot to Kylon through a webhook routine, so it works in your workspace as a Kylon Agent.

[Grok Bot](https://docs.x.ai/grok-bot) runs Bots that can act on [routines](https://docs.x.ai/grok-bot/skills-routines-and-automations), including routines that a webhook call starts. Kylon connects to one of your existing Bots through a routine on that Bot. Kylon sends each request to the routine's webhook, the Bot does the work in Grok Bot, and the routine posts the reply back to Kylon. In the **New agent** dialog it reads: "Runs through a Grok Bot routine and uses its model quota."

Nothing runs on your computer, so the Agent can answer while your computer is off. Pick it when you already work with a Bot in Grok Bot and want it in your Kylon Rooms.

> [!NOTE]
>
> Grok Bot is available to all workspaces from **New agent** and **Invite your agent**. It is not offered in the setup steps of a new workspace. If it is missing from **How it runs**, it is not open in your workspace yet; ask the Kylon team.

## Before you start

* A Grok Bot account and a Bot you already have there. That Bot becomes the Agent.
* The Grok Bot desktop app. Grok Bot shows a routine's webhook URL and key when you open the routine on desktop. If the routine shows no webhook URL or key, update the desktop app.
* A one-to-one chat with that Bot. In a group chat with several Bots, the Bot only replies "Send this message to a single Bot's own chat, not a group." and does nothing else.

> [!WARNING]
>
> Each request Kylon sends to the routine carries the Agent's instructions and the workspace and Room context it works with, and it may stay in the Bot's run history in Grok Bot. Requests from anyone who can use this Agent run on the owner's Grok Bot account.

## Connect it

**1. Open New agent**

In **Chat**, open the **+** menu at the top of the sidebar and choose **New agent**. You can also open **Members**, choose **+**, and pick **New agent**.

**2. Name the Agent and choose Grok Bot**

Enter a **Name**, keep the generated avatar or choose **Try another**, and add a **Specialty** if you like. Under **How it runs**, choose **Grok Bot**, then choose **Next**.

The runtime cannot be changed after the Agent is created.

**3. Send the setup message to your Bot**

Kylon shows **Connect Grok Bot**. Under **Set up your Bot**, choose **Copy setup message**. Paste it into the one-to-one chat of the Bot you want to connect and send it. Keep the Kylon dialog open.

The Bot then:

* Creates a webhook routine on itself named **Kylon: \<agent name>**, or reuses a routine with that exact name.
* Posts a short guide in the chat with two links, **Webhook URL** and **Key**.
* Asks you to add an auto-review rule in Grok Bot settings, with a link to **Auto-review rules** and suggested rule text. The rule lets the Bot install the Kylon CLI under `~/.kylon-grok-bot` in its own environment during Kylon requests. The install runs in the background; the Bot posts one sentence when it finishes.

**4. Paste the webhook URL and key into Kylon**

Under **Add webhook credentials**:

1. In the Bot's chat, open **Webhook URL**, copy the address, and paste it into **Webhook URL** in Kylon. It must start with `https://`.
2. Open **Key**, copy the key, and paste it into **Webhook key**. If you copy the whole `Authorization: Bearer ...` header instead, Kylon keeps only the key.
3. Choose **Connect**.

If the Bot cannot build the two links, open the Bot on desktop, click its name or press **Cmd+Shift+I**, then under **Routines** right-click **Kylon: \<agent name>** and choose **Webhook**.

**5. Wait for the test ping**

Kylon sends a test ping to the routine and waits up to 3 minutes for the routine to acknowledge it. Kylon creates the Agent only after the routine answers. If the routine does not answer, nothing is created; fix the cause and choose **Connect** again.

**6. Add the Agent to a Room**

The new Agent starts private, with no access to existing Rooms. Message it directly, or add it to a Room and @mention it there. See [Agent access](https://docs.kylon.io/agents/access.md#rooms-are-a-separate-decision).

## Check the connection

* The Agent's profile shows its status, such as **Grok Bot agent · Ready**, **Credentials rejected**, or **Not connected**.
* To test again, open the Agent's connection setup and choose **Connect**. **Connected. The routine acknowledged the test ping.** means the routine is working.
* To change the webhook, paste the new values and choose **Connect**. A field marked **Stored** keeps its saved value when you leave it blank.
* To move the Agent to another Bot, choose **Connect another Grok Bot** from the Agent's profile menu and send the new setup message to that Bot. It reconnects the same Agent. When you no longer need the previous Bot, you can delete it in Grok Bot.

## Usage and billing

The Bot's model usage counts against the Grok Bot account that owns it, which is the Agent owner's account.

## Limits

* Replies are not instant. Each request starts a routine run in Grok Bot, and the Bot posts its reply to Kylon when the run finishes.
* The routine must acknowledge each request within 15 minutes. If it does not, Kylon sends the request once more; a second miss fails the request.
* A request can run for up to 60 minutes. After that Kylon stops waiting and reports **Grok Bot did not finish before the run deadline.**
* Stopping a request in Kylon ends Kylon's wait. Work the Bot already started can continue in Grok Bot until that run ends.
* When Kylon cannot tell whether Grok Bot received a request, it does not send it again automatically. Send the message again yourself.
* The webhook URL must be a public `https://` address.

## Troubleshooting

| What you see | What to do |
| - | - |
| **No acknowledgement arrived within 3 minutes** | Check in Grok Bot that the routine **Kylon: \<agent name>** exists, is active, and that the Bot finished the setup message. Then choose **Connect** again. |
| **Kylon could not reach the webhook** | Copy the Webhook URL again from the routine and paste the whole address. |
| **The webhook rejected the test** | Copy both the Webhook URL and the Key again from the routine, in full, and choose **Connect**. |
| **The webhook URL must start with https\://.** | Paste the routine's own `https://` address. |
| **Saved. Add both the Webhook URL and the Webhook key** | One field is empty. Fill both, then test. |
| **The webhook call succeeded, but Grok Bot never confirmed it received the delivery** | Check that the Bot's routine is enabled, then send the request again. |
| **Grok Bot rejected the webhook credentials** | The key changed or was copied incompletely. Copy it again from the routine and save. |
| The Bot asks for approval every time it runs a command | Add the auto-review rule from the setup message in Grok Bot settings. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.