Migrate Ask AI to Agent Studio
Ask AI is now part of Agent Studio. Migrate your existing Ask AI assistant, publish the new agent, then point DocSearch at the agent ID.
DocSearch v5 uses Agent Studio as its only AI backend. There's no agentStudio flag.
If you're still on DocSearch v4, follow the v4 migration guide. To upgrade packages at the same time, see Migrate from DocSearch v4.
Migrate your assistant
1. Start the migration in the dashboard
- Sign in to the Algolia dashboard.
- Open Ask AI.
- 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.
2. Review and publish the agent
- Open Agents in Agent Studio.
- Review the migrated agent.
- Publish the agent when you're ready to go live.
Copy the agent ID. DocSearch calls this value agentId in its public API.
3. Update your integration
Choose the path that matches how you embed Ask AI today:
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.
Update DocSearch v5
Pass the Agent Studio agent ID as askAi.agentId, or as the askAi string shorthand. Rename any assistantId field to agentId.
- React
- JavaScript
Use DocSearchAI. Keyword-only DocSearch doesn't accept askAi.
import { DocSearchAI } from '@docsearch/react';
import '@docsearch/css';
export function Search() {
return (
<DocSearchAI
appId="YOUR_APPLICATION_ID"
apiKey="YOUR_SEARCH_API_KEY"
indices={['YOUR_DOCSEARCH_INDEX']}
askAi={{
agentId: 'YOUR_AGENT_ID',
}}
/>
);
}
The string shorthand remains supported:
<DocSearchAI
appId="YOUR_APPLICATION_ID"
apiKey="YOUR_SEARCH_API_KEY"
indices={['YOUR_DOCSEARCH_INDEX']}
askAi="YOUR_AGENT_ID"
/>
Keep the root @docsearch/js import. It renders the AI-capable component:
import docsearch from '@docsearch/js';
import '@docsearch/css';
docsearch({
container: '#docsearch',
appId: 'YOUR_APPLICATION_ID',
apiKey: 'YOUR_SEARCH_API_KEY',
indices: ['YOUR_DOCSEARCH_INDEX'],
askAi: {
agentId: 'YOUR_AGENT_ID',
},
});
Update searchParameters
Agent Studio search parameters are keyed by index name. Move any flat Ask AI searchParameters under the index:
askAi: {
- assistantId: 'YOUR_ASSISTANT_ID',
+ agentId: 'YOUR_AGENT_ID',
searchParameters: {
- filters: 'language:en',
- attributesToRetrieve: ['title', 'content', 'url'],
+ docs: {
+ filters: 'language:en',
+ attributesToRetrieve: ['title', 'content', 'url'],
+ },
},
}
Supported keys are filters, attributesToRetrieve, restrictSearchableAttributes, and distinct. Don't put facetFilters in this object. Put fixed facet conditions in filters. For per-request index selection, see dynamic indices.
Docusaurus adapter
The adapter requires themeConfig.docsearch.askAi as an object with agentId. It rejects the string shorthand and the removed agentStudio property. See the Docusaurus adapter guide.
Custom Ask AI API integrations
If you call the Ask AI HTTP API yourself instead of using DocSearch, configure your client for 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
- Agent Studio API
- 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. Prefer the DocSearch configuration above when you embed DocSearch—the SDK wires the Agent Studio transport for you.
Next steps
After the agent ID is live in DocSearch: