Repository navigation
docs: refresh v2 SDK reference - #6388
Conversation
Production Digest-Pinning AuditAll 42 services digest-pinned. Run 2026-09-16 10:31:51 PDT — 0 finding(s). |
…e reference (#7025) ## Summary The React Native `useAgent` reference page still documents the pre-`1.64.2` hook. Parameters list only `agentId` and `updates`, and the signature returns `{ agent: AbstractAgent }` with no `isReady`. React Native re-exports react-core's `useAgent` verbatim (`packages/react-native/src/headless.ts:53`, re-exporting from `@copilotkit/react-core/v2/headless`), so it is the same hook with the same props. The page is simply stale. This adds: - `threadId`, `runtimeAgentId` and `throttleMs` parameters - the `isReady` return value, and `isReady` in the signature - the `@copilotkit/react-native/headless` import note - the two valid option shapes, and a thread-scoped example - `Optional Throttling`, `Readiness` and `Thread Scoping` behavior bullets Content mirrors #6388, which makes the equivalent changes to the React page, so the two pages stay consistent. No overlap in files. Docs only. No source or public API change. ## Context Reported by a community user in #6125 for the React page: the thread-scoping API shipped in `v1.64.2` (#6141) and the Vue mirror in `v1.68.0` (#6234), but the docs site was never updated. #6388 covers the React page; this covers React Native. ## Testing Verified against a live `next dev` render of shell-docs on `origin/main` (`35c1e801ae`), with the edited page in place. **1. MDX compiles with the real compiler** (`@mdx-js/mdx` from `showcase/shell-docs/node_modules`, the untouched pages as controls): ``` OK .../worktrees/docs-rn-useagent/.../react-native/hooks/useAgent.mdx <- edited OK .../showcase/shell-docs/.../react-native/hooks/useAgent.mdx <- control OK .../showcase/shell-docs/.../hooks/useAgent.mdx <- control exit=0 ``` **2. Component tags balance** (no unclosed `<PropertyReference>`, which renders as silently swallowed content): ``` open: 23 close: 23 self-closing: 0 BALANCED fences: 20 (even=ok) ``` **3. Page serves 200 and renders the new content** (`next dev`, port 3003): ``` 200 /reference/react-native/hooks/useAgent threadId: 17 runtimeAgentId: 10 throttleMs: 5 isReady: 17 Thread-scoped Agent: 2 Thread Scoping: 2 react-native/headless: 2 preview-: 2 error markers: (none) ``` No `Unhandled Runtime Error`, `Build Error`, `Failed to compile`, or error overlay in the served HTML. **4. Prop descriptions actually render**, checked against the untouched React page as a negative control. The new text is present on the edited page and correctly absent on the React page, which is what #6388 adds: ``` === react-native (edited) === ID of the agent to retrieve PRESENT Controls which agent changes trigger PRESENT Thread ID for a private proxied agent PRESENT Unique identifier for the agent instance PRESENT === react (untouched control) === Thread ID for a private proxied agent absent ``` Not run: `showcase/shell-docs` `npm run dev` via its `predev` script fails in this environment on a pre-existing missing `js-yaml` in `showcase/harness`, unrelated to this change. I ran `next dev` directly instead, which is why the generators (registry, search index) did not run. Those generate demo and search content, not reference pages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Expanded `useAgent` reference documentation to cover shared and thread-scoped agent resolution. - Documented private proxied agents, headless imports, required option combinations, and runtime/type validation. - Added guidance for readiness states, provisional agents, connection failures, and thread-scoped usage. - Documented the `isReady` return value and `throttleMs` configuration for controlling update frequency. - Clarified agent ID resolution, including provider-level configuration and default fallback behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
BenTaylorDev
left a comment
There was a problem hiding this comment.
Reviewed against current origin/main. Content is accurate and I confirmed the substantive claims against source. Three things before it can land.
1. Blocker: inspectorDefaultAnchor no longer exists. Removed from react-core by b53fa8f1ea ("refactor(inspector): consolidate framework integration"), from both the provider and the bundled skill doc. It existed when you branched, so this is drift, not an error. Drop that <PropertyReference>.
2. Rebase needed, one conflict. The branch is behind main and CopilotKit.mdx conflicts in the onError paragraph. Your side is the correct one: onError is a plain copilotkit.subscribe({ onError }) with no publicApiKey gate (packages/react-core/src/v2/providers/CopilotKitProvider.tsx:869-882), so main's current "Requires publicApiKey" text is wrong and your rewrite fixes it. Main only renamed the product in that sentence, which is what produced the conflict. index.mdx auto-merges.
3. agentId resolution order is missing a step. The page says explicit agentId, then chat configuration, then "default". The hook resolves agentId ?? chatConfig?.agentId ?? providerAgentId ?? DEFAULT_AGENT_ID (use-agent.tsx:203-208), so the provider-level agentId sits between the chat configuration and the default. As written it reads as though <CopilotKitProvider agentId> is ignored.
Verified correct, no action needed: the headers function overload (CopilotKitProvider.tsx:131); licenseToken, selfManagedAgents, agents__unsafe_dev_only, openGenerativeUI, defaultThrottleMs and debug all exist on main and none were already documented; the headless-entry export list, including useRenderToolCall being exported (headless.ts:80) while useDefaultRenderTool, CopilotChat, CopilotPopup and CopilotSidebar are not; and the useAgent thread-scoping content.
Note that CI on this PR ran on 2026-08-05 against the old base, so it is not evidence about current main.
Context: a user hit the stale useAgent page in #6125. #7025 covered the React Native copy of that page and has merged. It mirrors your changes with no file overlap, and it already carries the fix for item 3.
…e reference
The React Native `useAgent` reference page still described the pre-1.64.2
hook: parameters listed only `agentId` and `updates`, and the signature
returned `{ agent: AbstractAgent }` with no `isReady`.
React Native re-exports react-core's `useAgent` verbatim from
`@copilotkit/react-core/v2/headless`, so the page was documenting props the
hook no longer has alone. Add `threadId`, `runtimeAgentId` and `throttleMs`,
add the `isReady` return value, note the headless entry point, and describe
the two valid option shapes. Mirrors the React page changes in CopilotKit#6388 so the
two stay consistent.
Reported for the React page in CopilotKit#6125.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe reference documentation updates v2 provider setup, provider props, import surfaces, runtime behavior, and ChangesV2 Documentation
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Other Merge Risk: ⚪ Minimal · up to The updated v2 reference documentation aligns with the supplied SDK contracts, with no concrete merge-blocking documentation defect identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-telegram
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/intelligence-langgraph
@copilotkit/intelligence-mastra
@copilotkit/mcp-apps-renderer
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
Summary
Refresh the v2 SDK reference against current main, preserving the existing three-page scope. Merge main into this branch without rewriting its history.
Why
The original reference update predates the explicit distinction between the v1
CopilotKitcompatibility wrapper and v2CopilotKitProvider, newer agent-ID defaults, and Inspector changes.How
CopilotKitProviderin v2 setup and error-handler examples, while retaining the legacy wrapper's public-key requirement foronError.inspectorDefaultAnchoraddition.useAgentdocumentation, add an example and headless imports, and clarify provider agent-ID fallback and throttle overrides.Validation: all three pages compile as MDX; documented provider prop names were checked against current TypeScript interfaces;
git diff --checkagainst current main passed. Focused validation ran through Nx. No full docs build was run. The merge-triggered broad package hook failed; its unrelated autoformat/lockfile changes were reverted, and lint/lockfile/package hooks were excluded for this docs-only merge. Binary, plugin-skill, Intelligence naming, and commit-message hooks remain enabled.Summary by CodeRabbit
CopilotKitProvider, including authentication tokens, dynamic headers, agent configuration, generative UI, throttling, debugging, and error handling.CopilotKitcomponent serves as a v1 compatibility wrapper.