Skip to content

feat(chat): add request options to agent requests#7088

Merged
anjola-adeuyi merged 7 commits into
masterfrom
feat/fx-3833-chat-request-options
Jun 25, 2026
Merged

feat(chat): add request options to agent requests#7088
anjola-adeuyi merged 7 commits into
masterfrom
feat/fx-3833-chat-request-options

Conversation

@anjola-adeuyi

@anjola-adeuyi anjola-adeuyi commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

FX-3833

Adds requestOptions for built-in agentId chat requests so consumers can pass persistent query parameters and headers to Agent Studio completion requests.

This is scoped to the built-in Agent Studio path only:

  • supports queryParameters
  • supports headers
  • rejects requestOptions with custom transport or custom chat
  • keeps body, metadata, resume/reconnect and custom transport behavior out of scope

Regenerate still forces cache=false.

Documentation

FX-3833 also includes a documentation update. The documentation source lives in algolia/docs-new, so this InstantSearch PR keeps the implementation scoped and the docs-new follow-up should verify/update the generated chat widget API docs for requestOptions.

Test plan

  • Focused connector tests for persistent query parameters
  • Focused connector tests for object headers and Headers
  • Per-call headers override persistent headers for one request
  • Regenerate keeps cache=false
  • yarn jest packages/instantsearch.js/src/connectors/chat/__tests__/connectChat-test.ts --runInBand
  • Prettier check
  • git diff --check
  • yarn lint:changed

@codacy-production

codacy-production Bot commented Jun 23, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes.

@pkg-pr-new

pkg-pr-new Bot commented Jun 23, 2026

Copy link
Copy Markdown
More templates

algoliasearch-helper

npm i https://pkg.pr.new/algolia/instantsearch/algoliasearch-helper@7088

instantsearch-ui-components

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch-ui-components@7088

instantsearch.css

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch.css@7088

instantsearch.js

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch.js@7088

react-instantsearch

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch@7088

react-instantsearch-core

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-core@7088

react-instantsearch-nextjs

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-nextjs@7088

react-instantsearch-router-nextjs

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-router-nextjs@7088

vue-instantsearch

npm i https://pkg.pr.new/algolia/instantsearch/vue-instantsearch@7088

commit: 603556f

@anjola-adeuyi anjola-adeuyi force-pushed the feat/fx-3833-chat-request-options branch from 09e2ac8 to 05cbadf Compare June 23, 2026 16:04
@Haroenv Haroenv requested a review from Copilot June 24, 2026 07:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for passing persistent request options (query parameters + headers) to the built-in Agent Studio (agentId) chat completion requests, while keeping custom transport/custom chat paths out of scope and ensuring regenerate continues to bypass cache.

Changes:

  • Introduces requestOptions typing restricted to the built-in agentId transport path (rejects with custom transport or custom chat).
  • Builds Agent Studio completion URLs with persistent query parameters and enforces compatibilityMode=ai-sdk-5 (and cache=false on regenerate).
  • Merges persistent headers into agent requests while preserving required Algolia identity headers.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/instantsearch.js/src/connectors/chat/connectChat.ts Adds requestOptions types and applies persistent query parameters/headers to built-in agent requests.
packages/instantsearch.js/src/connectors/chat/__tests__/connectChat-test.ts Adds type-level and runtime tests for requestOptions behavior (query params, headers, precedence, regenerate cache).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/instantsearch.js/src/connectors/chat/connectChat.ts Outdated
Comment thread packages/instantsearch.js/src/connectors/chat/connectChat.ts
@anjola-adeuyi anjola-adeuyi force-pushed the feat/fx-3833-chat-request-options branch from fc8bd2b to c358af9 Compare June 24, 2026 08:58
@anjola-adeuyi anjola-adeuyi marked this pull request as ready for review June 24, 2026 09:31
@anjola-adeuyi anjola-adeuyi requested review from a team, FabienMotte, Haroenv and afrencalg and removed request for a team June 24, 2026 09:31

@Haroenv Haroenv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great job! I think it can be simplified a bit

Comment thread packages/instantsearch.js/src/connectors/chat/__tests__/connectChat-test.ts Outdated
Comment thread packages/instantsearch.js/src/connectors/chat/__tests__/connectChat-test.ts Outdated
Comment thread packages/instantsearch.js/src/connectors/chat/connectChat.ts Outdated
Comment thread packages/instantsearch.js/src/connectors/chat/connectChat.ts
Comment thread packages/instantsearch.js/src/connectors/chat/connectChat.ts Outdated
@anjola-adeuyi anjola-adeuyi requested a review from Haroenv June 24, 2026 12:13

@Haroenv Haroenv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple small questions

Comment thread packages/instantsearch.js/src/connectors/chat/connectChat.ts Outdated
@anjola-adeuyi anjola-adeuyi requested a review from Haroenv June 25, 2026 11:01

@Haroenv Haroenv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! merge when you're ready :)

@anjola-adeuyi anjola-adeuyi merged commit d3ad7ca into master Jun 25, 2026
15 checks passed
@anjola-adeuyi anjola-adeuyi deleted the feat/fx-3833-chat-request-options branch June 25, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants