feat(examples): migrate unique examples from arcjet-js - #193
Open
davidmytton wants to merge 7 commits into
Open
Conversation
Consolidates the remaining unique examples from the `arcjet/arcjet-js` `examples/` directory into this repository, rebuilt to the canonical example pattern (canonical metadata, README, Dockerfile, compose.yaml, devcontainer, LICENSE) with Arcjet packages pinned to published versions. Examples added: - bun — canonical Bun runtime example (mirrors the Deno example) - express-newman — testing Arcjet-protected Express routes with Newman - nextjs-bot-categories — advanced bot category allow/deny + filtering - react-router-middleware — React Router v8 middleware pattern - nextjs-ai-agent — Arcjet Guard AI agent guardrails - nextjs-sensitive-info — sensitive info detection incl. Rampart NER backend - nextjs-guard-policy — remotely-configured Guard policy for AI tool calls - node-guard-policy — Guard policy on a plain Node.js server The first four are wired into the root `compose.yaml` and the Docker build CI matrix. The Guard/AI examples are standalone (they need an AI gateway key, dashboard policy config, or a native NER backend) and are excluded from the default compose/CI run. Note: nextjs-guard-policy and node-guard-policy depend on the Arcjet Guard remote-policy API which is not yet published to npm; they are pinned to 1.10.0-rc.0 and documented as not building until that API ships. nextjs-ai-agent is pinned to 1.10.0-rc.0 (first release with the agent guardrail API) and nextjs-sensitive-info to 1.9.1 (Rampart's earliest release). All examples are registered in scripts/prepare-to-publish.ts for publishing to their own repositories. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This comment was marked as low quality.
This comment was marked as low quality.
davidmytton
marked this pull request as ready for review
August 7, 2026 19:10
This comment was marked as resolved.
This comment was marked as resolved.
Migrates the Vercel Eve agent example from arcjet-js, demonstrating Arcjet Guard AI guardrails (guardTool, guardApproval, guardInbound) on a Vercel Eve agent. Standalone example (not wired into compose/CI). Pinned to @arcjet/guard@1.10.0-rc.0; the Eve integration subpath (@arcjet/guard/vercel-eve) is not yet published to npm, so the README notes it will not build until that API ships. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a standalone Mastra agent example demonstrating @arcjet/guard/mastra/v1: inbound prompt injection via guardProcessor, tool deny via guardTool (structured result, no throw), PII on args, rate limiting, fail-closed defaults, correlation via mastraAgentContext (thread → resource → run; never mint an id), and guardHooks for unwrapped tools (proceed: false on DENY). Not wired into root compose/CI, matching other Guard/AI examples. Pinned to @arcjet/guard@1.10.0-rc.0; the Mastra integration subpath (@arcjet/guard/mastra/v1) is not yet published to npm, so the README notes it will not build until that API ships. Co-authored-by: David Mytton <davidmytton@users.noreply.github.com>
Align the React Router middleware compose/dev port on 5173 and the production image on 3000. Cap JSON bodies on the Node and Mastra demo servers. Bound AI question/message length. Replace the Bun devcontainer pipe-to-bash install with the official oven/bun image. Document accepted demo risk for unauthenticated AI routes, bot-category headers, and synthetic policy fixtures. Co-authored-by: David Mytton <davidmytton@users.noreply.github.com>
|
Sorted the open review threads on this PR (no new PR). Summary of the High Risk notes that did not have their own inline thread:
All 8 inline threads are replied to and resolved. |
Add an Arcjet sliding-window rate limit and question-length cap before start(workflow), gate bot diagnostic headers behind ARCJET_DEMO_BOT_HEADERS, and return labels only from the Guard policy context endpoint. Co-authored-by: David Mytton <davidmytton@users.noreply.github.com>
|
Follow-up on the remaining review items (HEAD
All 8 inline review threads were resolved via |
Adds a standalone Claude Agent SDK example demonstrating @arcjet/guard/claude-agent-sdk/v0 (UserPromptSubmit, PreToolUse, guardTool) from unpublished adapter SHA 69dd6010. Vendors @arcjet/guard via file:./vendor/arcjet-guard. Not wired into root compose/CI. Co-authored-by: David Mytton <davidmytton@users.noreply.github.com>
This was referenced Aug 15, 2026
feat(guard): add Claude Agent SDK support as @arcjet/guard/claude-agent-sdk/v0
arcjet/arcjet-js#6229
Open
Standalone Graph API (StateGraph + ToolNode) demo of unpublished @arcjet/guard/langgraph/v1: guardTool, guardToolNode, inbound screen before invoke, interrupt() as HITL not policy, caller-owned thread_id. Vendored from arcjet-js@baa23e7f (david/cursor/guard-langgraph-v1-e852). Co-authored-by: David Mytton <davidmytton@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Consolidates the remaining unique examples from
arcjet/arcjet-jsexamples/into this repository, rebuilt to the canonical example pattern (package metadata, templated README, Dockerfile,compose.yaml, devcontainer, LICENSE) with Arcjet packages pinned to published versions.Paired with the removal PR in arcjet-js: arcjet/arcjet-js#6217. Mastra helpers landed in arcjet/arcjet-js#6226. Claude Agent SDK helpers land in arcjet/arcjet-js#6229.
Examples added (11)
bundeno)express-newmannextjs-bot-categoriesreact-router-middlewarenextjs-ai-agentnextjs-sensitive-infonextjs-guard-policynode-guard-policymastra-agent@arcjet/guard/mastra/v1— processor, tool, hooks (#6226)eve-agent@arcjet/guard/vercel-eve/v0— inbound, approval, tool, hooks (#6208)claude-agent@arcjet/guard/claude-agent-sdk/v0— guardTool, guardHooks, canUseTool is not a gate (#6229)The first four are wired into the root
compose.yamland the Docker build CI matrix. Guard/AI examples are standalone (AI gateway key, dashboard policy, native NER, or unpublished Guard APIs) and stay out of the default compose/CI run.Pre-release note
nextjs-guard-policyandnode-guard-policyneed the Guard remote-policy API (policyInput,guardToolactor,launchArcjet({ sensitiveInfoBackend }),decision.policyResults) which is not on npm yet. They are pinned to1.10.0-rc.0with a README note thatnpm ci+ build will fail until that API ships.mastra-agentdepends on@arcjet/guard/mastra/v1, which is not published yet (arcjet-js#6226 merged; publish is arcjet-js#6227).eve-agentuses@arcjet/guard/vercel-eve/v0, which shipped in 1.10.0 (arcjet-js#6208).claude-agentdepends on@arcjet/guard/claude-agent-sdk/v0(arcjet-js#6229) and vendors a built@arcjet/guardfrom adapter SHA 69dd6010 because npm cannot install a monorepo subdir from git.Review follow-ups (resolved)
npm cion the compose/CI examplesnextjs-ai-agent: sliding-window (5/60s by IP) + 2,000-char cap before the workflow; 429 on DENYARCJET_DEMO_BOT_HEADERS=1oven/bun:1(no pipe-to-bash){ correlationId, metadata }recordWiring
compose.yaml— 4 non-AI examples.github/workflows/docker-build.yml— same 4scripts/prepare-to-publish.ts— all 11 registeredREADME.md— all 11 listed