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

# Migrate Ask AI to Agent Studio

> Move your Ask AI assistant to Agent Studio, then update DocSearch or your custom API integration.

Ask AI is now part of [Agent Studio](/doc/guides/algolia-ai/agent-studio),
where you build and manage AI agents.
Migrate your existing Ask AI assistant, publish the new agent,
then point DocSearch or your custom API client to Agent Studio.

## Migrate your assistant

<Steps>
  <Step title="Start the migration in the dashboard">
    1. Sign in to the [Algolia dashboard](https://dashboard.algolia.com/users/sign_in).
    2. Open [**Ask AI**](https://dashboard.algolia.com/ask-ai).
    3. Select your assistant and click **Migrate to Agent Studio**.

    The wizard creates a draft Agent Studio agent from your assistant configuration,
    including the prompt, model, indices, and related settings.
    After migration, the assistant and agent are independent and don't stay in sync.
  </Step>

  <Step title="Review and publish the agent">
    1. Open [**Agents**](https://dashboard.algolia.com/generativeAi/agent-studio/agents) in Agent Studio.
    2. Review the migrated agent.
    3. Publish the agent when you're ready to go live.

    Copy the **agent ID**.
    You use it in DocSearch and in custom API clients.
  </Step>

  <Step title="Update your integration">
    Choose the path that matches how you embed Ask AI today:

    * [DocSearch v4](#docsearch-v4)
    * [DocSearch v5](#docsearch-v5)
    * [Custom Ask AI API](#custom-ask-ai-api-integrations)

    Your existing Ask AI assistant keeps serving traffic until Ask AI is fully retired.
    Switch your client to the Agent Studio agent when you're ready.
  </Step>
</Steps>

## Update DocSearch

For the full DocSearch reference, see
[Migrate Ask AI to Agent Studio](https://docsearch.algolia.com/docs/v4/v4/migrating-askai-to-agent-studio)
in the DocSearch docs.

### DocSearch v4

Set `agentStudio` to `true` inside the `askAi` object
and pass your Agent Studio **agent ID** as `assistantId`:

<CodeGroup>
  ```js JavaScript theme={"system"}
  import docsearch from '@docsearch/js';

  import '@docsearch/css';

  docsearch({
    container: '#docsearch',
    appId: 'YourApplicationID',
    apiKey: 'YourSearchOnlyAPIKey',
    indexName: 'YourIndexName',
    askAi: {
      assistantId: 'YOUR_AGENT_ID',
      agentStudio: true,
    },
  });
  ```

  ```jsx React theme={"system"}
  import { DocSearch } from '@docsearch/react';

  import '@docsearch/css';

  function App() {
    return (
      <DocSearch
        appId="YourApplicationID"
        apiKey="YourSearchOnlyAPIKey"
        indexName="YourIndexName"
        askAi={{
          assistantId: 'YOUR_AGENT_ID',
          agentStudio: true,
        }}
      />
    );
  }

  export default App;
  ```
</CodeGroup>

Notes:

* Put `agentStudio` inside `askAi`, not as a top-level DocSearch prop.
* When `agentStudio` is `true`, DocSearch sends chat requests to Agent Studio for you.

### DocSearch v5

In DocSearch v5, Agent Studio is the default chat backend.
Pass your Agent Studio **agent ID** directly as `askAi`.
You don't need an `agentStudio` flag:

<CodeGroup>
  ```js JavaScript theme={"system"}
  import docsearch from '@docsearch/js';

  import '@docsearch/css';

  docsearch({
    container: '#docsearch',
    appId: 'YourApplicationID',
    apiKey: 'YourSearchOnlyAPIKey',
    indices: ['YourIndexName'],
    askAi: 'YOUR_AGENT_ID',
  });
  ```

  ```jsx React theme={"system"}
  import { DocSearchAI } from '@docsearch/react';

  import '@docsearch/css';

  function App() {
    return (
      <DocSearchAI
        appId="YourApplicationID"
        apiKey="YourSearchOnlyAPIKey"
        indices={['YourIndexName']}
        askAi="YOUR_AGENT_ID"
      />
    );
  }

  export default App;
  ```
</CodeGroup>

## Custom Ask AI API integrations

If you call the Ask AI HTTP API yourself instead of using DocSearch,
point your client at **Agent Studio** instead of `https://askai.algolia.com`.

Don't build new integrations against the Ask AI chat API.
Use the Agent Studio APIs:

* [Integrate Agent Studio](/doc/guides/algolia-ai/agent-studio/how-to/integration)
* [Agent Studio API](/doc/rest-api/agent-studio)
* Completions endpoint example:
  `https://{APPLICATION_ID}.algolia.net/agent-studio/1/agents/{AGENT_ID}/completions`

Authenticate with your application ID and a search-only API key.
For DocSearch users, prefer the SDK configuration above—
DocSearch wires the Agent Studio transport when `agentStudio` is `true`.

## See also

* [Ask AI overview](/doc/guides/algolia-ai/askai)
* [Ask AI API reference](/doc/guides/algolia-ai/askai/reference/api) for existing custom clients
* [Agent Studio](/doc/guides/algolia-ai/agent-studio)
* [DocSearch migration guide](https://docsearch.algolia.com/docs/v4/v4/migrating-askai-to-agent-studio)
