facebook / facebook/docusaurus
Support `agentStudio` flag in theme-search-algolia askAi config
- Dominant language
- TypeScript
- Stars
- 66.2k
- Forks
- 10k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 52
Description
## Have you read the Contributing Guidelines on issues?
Yes.
## Prerequisites
- Using Docusaurus 3.10.0
- DocSearch v4 (`@docsearch/react@4.6.2`) is installed
- Algolia DocSearch has shipped experimental Agent Studio support via an `agentStudio: true` flag on the askAi config
## Description
`@docsearch/react@4.6.x` exposes an experimental `agentStudio` flag on the `askAi` prop, which routes Ask AI through Algolia's Agent Studio backend (as advertised in the current Algolia docs / integration guides shared with customers). The underlying modal accepts it and it works end-to-end.
However, the theme's Joi schema in `packages/docusaurus-theme-search-algolia/src/validateThemeConfig.ts` does not currently accept `agentStudio` on `themeConfig.algolia.askAi`, so the config is rejected before reaching the modal:
```
"algolia.askAi.agentStudio" is not allowed
```
## Reproducible demo
```js
// docusaurus.config.js
themeConfig: {
algolia: {
appId: '…',
apiKey: '…',
indexName: '…',
askAi: {
assistantId: '…',
agentStudio: true, // ← rejected by Joi schema
},
},
},
```
## Expected behavior
Schema accepts `agentStudio: boolean` on `askAi` and passes it through to the DocSearch v4 modal.
## Additional notes
- Per the DocSearch v4 types, when `agentStudio: true` the `searchParameters` object is keyed by index name (`{ "INDEX_NAME": { distinct: false } }`) rather than the flat shape — so the schema should either accept both shapes or at least not reject the flag.
- Currently there's an additional gotcha: when `contextualSearch: true`, the theme auto-injects `facetFilters` into `askAi.searchParameters`, which agentStudio rejects (`invalid searchParameters for index 'facetFilters'`). Users have to disable `contextualSearch` as a workaround.
Happy to open a PR if this would be accepted — the minimal change is extending the Joi schema; the fuller change is handling the index-keyed `searchParameters` shape when `agentStudio: true`.
Contributor guide
Assessment
This issue has not been assessed yet.