> For the complete documentation index, see [llms.txt](https://ai-security-docs.akto.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-security-docs.akto.io/akto-argus-agentic-ai-security-for-homegrown-ai/agentic-red-teaming/get-started/manual-import/websocket-agent-import.md). Agents can also search and read this documentation through its [MCP server](https://ai-security-docs.akto.io/~gitbook/mcp).

# WebSocket Agent Import

Import an AI agent that communicates over WebSocket (ws or wss) into Akto by adding the connection first, then importing events into the same collection.

You can import an AI agent that communicates over **WebSocket** (`ws://` or `wss://`) into Akto. You first import the connection, then import as many events as you need into the same collection.

### 🔧 What You Need

* **WebSocket URL**: for example `wss://agent.example.com/ws/chat`. An `http(s)://` URL also works.
* **(Optional) Authentication**: custom headers, or a [scan role](https://ai-security-docs.akto.io/akto-argus-agentic-ai-security-for-homegrown-ai/agentic-red-teaming/concepts/test-role.md).
* **(Optional) Testing module**: a [testing module](https://ai-security-docs.akto.io/akto-argus-agentic-ai-security-for-homegrown-ai/agentic-red-teaming/how-to/install-testing-module-in-your-cloud.md), needed only when the agent is not publicly reachable but can be reached from a testing module in your network.

### ✅ Import the Connection and Events

Complete the connection import once per agent. Then repeat the event import for each event you want to add to the same collection.

{% stepper %}
{% step %}
**Import the WebSocket connection**

1. Go to Connectors → **Bring Your Own AI Agent** → **Connect**.
2. Fill in the form:
   * **Agent type**: `WebSocket`
   * **WebSocket URL**: for example `wss://agent.example.com/ws/chat`
   * **AI Agent name**: for example `support-bot`. The name becomes the collection name. If you leave the field empty, Akto uses the URL's hostname.
   * **Send a WebSocket event** *(optional)*: paste an event to import it along with the connection.
   * **Use test role for authentication** *(optional)*: select a scan role.
   * **Custom Headers** *(optional)*: add the headers the agent requires.
   * **Send requests via mini-testing** *(optional)*: select a testing module.
3. Click **Import**.

<div data-with-frame="true"><figure><img src="https://1895868029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkpBG2Nfd5ZbNmahr8W6H%2Fuploads%2Fgit-blob-42af68fba307c9002b05ca37c70db3f05f7cd262%2Fwebsocket-agent-import.png?alt=media" alt="WebSocket agent import form with agent type, WebSocket URL, AI agent name, event, test role, custom headers and testing module fields" width="563"><figcaption><p>Fill in the WebSocket URL and agent name, then click Import.</p></figcaption></figure></div>
{% endstep %}

{% step %}
**Import more events into the same collection**

1. Open **Bring Your Own AI Agent** again and fill in the form:
   * **Agent type**: `WebSocket`
   * **WebSocket URL**: leave empty.
   * **AI Agent name**: the name you used when importing the connection, for example `support-bot`.
   * **Send a WebSocket event**: paste the event, for example:

     ```json
     { "type": "chat", "message": "Hello, what can you do?" }
     ```
   * **Use test role for authentication**, **Custom Headers**, **Send requests via mini-testing** *(optional)*: use the same values as the connection import.
2. Click **Import**.
   {% endstep %}
   {% endstepper %}

### ⚠️ Troubleshooting Import Errors

| Issue                                                                    | Fix                                                                                                   |
| ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| `No WebSocket connection for this agent, import its WebSocket URL first` | Import the connection first, or check that the AI agent name matches the one used for the connection. |
| Connection fails with `401` or `403`                                     | Check the custom headers or the scan role.                                                            |

### Get Support for your Akto setup

There are multiple ways to request support from Akto. We are 24X7 available on the following:

1. In-app `intercom` support. Message us with your query on intercom in Akto dashboard and someone will reply.
2. Contact `support@akto.io` for email support.
3. Contact us [here](https://www.akto.io/contact-us).
