Add CopilotKit agent framework guide#1031
Conversation
Add a guide for using Arcade tools with CopilotKit, mirroring the existing Mastra and Vercel AI framework pages. It covers wrapping Arcade tools with defineTool, the authorize-then-execute pattern, a single-route CopilotRuntime, and rendering the authorization step as generative UI with useRenderTool. - New page: app/en/get-started/agent-frameworks/copilotkit/page.mdx - Register the page in agent-frameworks/_meta.tsx - Add a CopilotKit card to the JavaScript tab in agent-framework-tabs.tsx - Add public/images/icons/copilotkit.svg - Add tests/copilotkit-guide.test.ts (contract test, written test-first) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@jerelvelarde is attempting to deploy a commit to the Arcade AI Team on Vercel. A member of the Team first needs to authorize it. |
Replace the placeholder icon with CopilotKit's authoritative brand mark and drop invertInDark on the card, since the mark is full-color (matching the CrewAI / Google ADK full-color icon pattern rather than the monochrome invert pattern). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A 7-reviewer pass surfaced a false-success render path and a dropped security note; fix both and tighten the contract test. - Render: show the "email sent" card only on the positive success discriminant (authorizationRequired === false). An unparseable or missing tool result now renders an error card instead of a false green "sent" card, in both the inline snippet and the full-file listing. This matches the guide's own "failures come back as data" Callout, which the render layer previously contradicted. - Restore a "Before you expose this publicly" warning callout (authenticate the runtime, scope every call to a server-verified user, disposable keys + rate limiting + security headers) that the adaptation had dropped from the upstream recipe. - Bump the Node prerequisite to 20+ (the CopilotKit v2 / Next.js stack needs it; Node 18 is end-of-life). - Tighten the contract test: assert the _meta key and title together, require non-empty frontmatter values, check the SVG closing tag, and hoist regexes to module scope. Update the stale header comment. Deferred as matching the authoritative Arcade-authored recipe / SDK contract: the success===false failure check and the runtime auth gate's dev-open default (the restored callout documents the hardening steps). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`title=` on code fences (carried over from the upstream Starlight-based recipe) broke Nextra's rehype pipeline with "Cannot convert undefined or null to object", returning a 500 for the page. The Arcade docs use `filename=` for code-block labels (150 existing usages); switch all six fences to match. Caught by rendering the page in the local dev server — the unit tests and an mdx-js compile check don't exercise Nextra's loader. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Local preview review surfaced two gaps: - The page rendered no title. Nextra does not promote the frontmatter `title` to an on-page H1 (the Vercel AI guide includes an explicit one); add `# Build an AI agent with Arcade and CopilotKit`. - Step 1 linked to the quickstart but showed no create command, unlike the Mastra/Vercel guides. Add `npx copilotkit@latest init` (CopilotKit CLI) in the package-manager tabs before the Arcade SDK install. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Heads up for review: the |
📸 PreviewThe new guide rendered locally at Shows the page title, the |
…wiring Validated the guide by building it as a runnable app — a Next.js demo that reproduces the three "Complete code" files verbatim. The build surfaced fixes: - Step 1: replace `copilotkit init` (interactive-only, account-gated, and with no Built-in Agent template) with `create-next-app` plus explicit installs, the path that actually reproduces the app. - Install `zod` (both files import it; it otherwise resolves only as a peer dependency of the CopilotKit packages). - `app/page.tsx`: parse into a discriminated-union `ToolResult` instead of `any`, so the sample passes `eslint` (no-explicit-any) as well as `tsc`. - Show the `<CopilotKit>` provider wiring (`app/providers.tsx` and `app/layout.tsx`); the provider is a client component the prose only described. - Note that `BuiltInAgent` model ids are `provider/model` strings. Extend the contract test to lock in these invariants. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Flipping this out of draft — ready for review. ✅ Heads-up on the red checks: they're all fork-PR infrastructure limitations, not content problems.
Every substantive check is green on the head commit: For extra confidence, the code samples were validated by building them as a runnable Next.js app — 🤖 Generated with Claude Code |

What this PR does
Adds a CopilotKit guide to the agent-frameworks section, mirroring the existing Mastra and Vercel AI framework pages.
This is the reciprocal of CopilotKit/CopilotKit#5514, where Arcade added a CopilotKit cookbook recipe into CopilotKit's docs — this PR brings the equivalent "use Arcade with CopilotKit" guide into the Arcade docs.
The guide gives a CopilotKit Built-in Agent OAuth-backed Arcade tools (Gmail, Google News) and renders Arcade's one-time authorization step as a generative-UI Connect card in the chat. It covers:
defineToolrunArcadeTool)CopilotRuntimeuseRenderToolChanges
app/en/get-started/agent-frameworks/copilotkit/page.mdxcopilotkitinapp/en/get-started/agent-frameworks/_meta.tsxapp/_components/agent-framework-tabs.tsxpublic/images/icons/copilotkit.svg(official CopilotKit mark)tests/copilotkit-guide.test.ts(contract test, written test-first)Testing
pnpm test— full suite green (57 files, 742 tests), includingbroken-link-checkandinternal-link-checkwith the new page presentpnpm exec ultracite check— clean on the changed files@mdx-js/mdx/resources/integrations,/guides/user-facing-agents/secure-auth-production); all CopilotKit links point tohttps://docs.copilotkit.ai; no absolutedocs.arcade.devlinksReview
A 7-reviewer code-review pass ran on the diff. Fixes applied (commit
Harden the CopilotKit guide after code review):authorizationRequired === falsediscriminant; an unparseable/missing tool result renders an error card instead of a green "sent" card (it previously contradicted the guide's own "failures come back as data" Callout).Verified-and-dismissed:
Gmail.ListEmailscorrectly takesn_emails(per the repo's owntoolkit-docs-generator/data/toolkits/gmail.json);GuideOverview/DashboardLinkare global components inmdx-components.ts. Deferred as matching the upstream Arcade-authored recipe / SDK contract: thesuccess === falsecheck and the runtime auth gate's dev-open default (the restored callout documents the hardening).Optional follow-up
🤖 Generated with Claude Code