> ## Documentation Index
> Fetch the complete documentation index at: https://guide.beenos-solutions.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy Your AI Agent: Chat Widget, Link, or REST API

> Deploy your Beenos Solutions AI agent as an embedded chat widget, a shareable link, or via the REST API to integrate it into any custom application.

After creating and configuring your agent, you are ready to put it in front of your users. Beenos Solutions offers three deployment methods so you can meet your audience wherever they are — embedded directly in your product, shared as a standalone link, or integrated into any application through the REST API. Open the **Deploy** tab on your agent's detail page to access all options.

<Tabs>
  <Tab title="Chat Widget">
    The chat widget embeds a floating chat button on any webpage. When a visitor clicks it, a conversation panel opens and they can start asking questions immediately — without leaving your site.

    ### Get your Agent ID

    <Steps>
      <Step title="Open the Deploy tab">
        Navigate to your agent's detail page in the Beenos Solutions dashboard and click the **Deploy** tab.
      </Step>

      <Step title="Copy your Agent ID">
        Under the **Chat Widget** section, locate your **Agent ID**. It is a short alphanumeric string that uniquely identifies your agent (for example, `agt_k8x2p1mq`). Copy this value.
      </Step>

      <Step title="Add the script to your site">
        Paste the snippet below into the `<body>` of any HTML page, replacing `YOUR_AGENT_ID` with the value you copied. The widget loads asynchronously and will not affect your page's load performance.
      </Step>
    </Steps>

    ```html theme={null}
    <script
      src="https://cdn.beenossolutions.com/widget.js"
      data-agent-id="YOUR_AGENT_ID"
      data-primary-color="#ef7025"
      async
    ></script>
    ```

    You can customize the widget's accent color by changing the `data-primary-color` attribute to any valid hex value. Additional widget options — including position, button label, and initial open state — are available in the dashboard under **Widget Appearance**.

    <Note>
      The widget script is versioned automatically. You never need to update the snippet to receive bug fixes or performance improvements.
    </Note>
  </Tab>

  <Tab title="Shareable Link">
    Every agent has a hosted page that you can share directly with users. No installation or embedding is required — just send the link.

    ### Your agent's URL

    Your agent's public page is available at:

    ```
    https://agents.beenossolutions.com/{agent-id}
    ```

    Replace `{agent-id}` with your agent's ID, which you can find on the **Deploy** tab in the dashboard.

    ### Visibility settings

    Control who can access your agent's hosted page:

    | Setting                | Behavior                                                                                                                             |
    | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
    | **Public**             | Anyone with the link can open and use the agent. No login required.                                                                  |
    | **Password-protected** | Visitors must enter a password before the chat interface loads. Set the password in the dashboard under **Shareable Link → Access**. |
    | **Disabled**           | The link returns a 404 page. Use this to temporarily take the page offline without deleting the agent.                               |

    <Tip>
      The shareable link is a great way to run a private beta or share the agent with a specific team before a full public launch. Set it to password-protected and distribute the password to your testers.
    </Tip>
  </Tab>

  <Tab title="REST API">
    The REST API lets you integrate your agent into any application, backend workflow, or custom chat interface. Use it when you need full control over the user experience or when you are building a native mobile app.

    ### Send a message

    Make a `POST` request to the chat endpoint, passing your message and a `session_id` to maintain conversation context across multiple turns.

    ```bash theme={null}
    curl -X POST https://api.beenossolutions.com/v1/agents/YOUR_AGENT_ID/chat \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"message": "What is the return policy?", "session_id": "user-123"}'
    ```

    Replace `YOUR_AGENT_ID` with your agent's ID and `YOUR_API_KEY` with a key generated under **Settings → API Keys** in the dashboard.

    ### Request parameters

    | Parameter    | Type   | Required | Description                                                                                                              |
    | ------------ | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------ |
    | `message`    | string | Yes      | The user's message text.                                                                                                 |
    | `session_id` | string | Yes      | A unique identifier for the conversation session. Use a consistent value across requests to maintain multi-turn context. |
    | `language`   | string | No       | Override the agent's language setting for this request (e.g., `"es"` for Spanish).                                       |

    ### Response format

    The API returns a JSON object containing the agent's answer and an array of source citations:

    ```json theme={null}
    {
      "answer": "Our return policy allows returns within 30 days of purchase...",
      "sources": [
        {
          "title": "Returns & Refunds Policy",
          "url": "https://help.acme.com/returns",
          "excerpt": "Items must be returned within 30 days in original condition."
        }
      ],
      "session_id": "user-123"
    }
    ```

    <Warning>
      Keep your API key secret. Do not embed it in client-side JavaScript or expose it in public repositories. Use environment variables or a secrets manager to store it securely.
    </Warning>
  </Tab>
</Tabs>

## Managing deployed agents

You can adjust your agent's deployment state at any time from the **Deploy** tab without affecting its configuration or knowledge base connections.

* **Enable / Disable** — Toggle the agent on or off for each deployment method independently. Disabling a widget or shareable link takes effect within seconds.
* **Regenerate embed code** — If you need to rotate your agent ID (for example, after a security incident), click **Regenerate** to issue a new ID. Update the snippet or API calls in your codebase with the new value. The old ID stops working immediately.
* **Usage metrics** — The Deploy tab shows basic usage statistics for each deployment method, including total conversations, average turns per session, and fallback trigger rate.

<Tip>
  Consider deploying separate agents for different audiences or product areas — for example, one agent for your developer documentation and another for your end-user help center. Each can connect to its own knowledge base and carry its own persona, so users always get responses tailored to their context.
</Tip>
