Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ this project adheres to [Semantic Versioning](https://semver.org/).

### Changed

- Synced the vendored skill tree with
[arcjet/skills](https://github.com/arcjet/skills) `main` at
`8287f83a` (2026-09-17,
[arcjet/skills#62](https://github.com/arcjet/skills/pull/62)). Follow-up to
the #23 sync of `f8959e14` (skills#63). Files were fetched from GitHub at
that SHA, then this repo’s `dprint` formatter was applied. The tip is
the Microsoft Agent Framework for Go skill plus the Go SDK **v1.0.0**
release: new `integrate-arcjet-guard-agent-framework-go` skill,
`agentframework` module **v0.1.0** (Go 1.26+), `GuardAction` in the Go
Guard reference, and the `CorrelationId` → `CorrelationID` /
`WithCorrelationId` → `WithCorrelationID` rename. Skills `main` also
includes [arcjet/skills#64](https://github.com/arcjet/skills/pull/64)
(singular Claude Managed Agents example URL), already applied on this
repo in #23. Canonical copy is `plugins/arcjet/skills/` (`skills/` is
the inbound symlink). Skills `main` still has no JS
`integrate-arcjet-guard-*` dirs — JS adapters stay in `arcjet/`. Did
not wait for open
[arcjet/skills#59](https://github.com/arcjet/skills/pull/59). Evals
were not copied (prior syncs do not vendor `evals/`). Deprecated alias
skill directories are unchanged.
- Synced the vendored skill tree with
[arcjet/skills](https://github.com/arcjet/skills) `main` at
`f8959e14` (2026-09-16,
Expand Down
14 changes: 10 additions & 4 deletions plugins/arcjet/skills/arcjet/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: arcjet
license: Apache-2.0
description: Add Arcjet security protection to HTTP routes, AI agent tool calls, MCP servers, background jobs, and queue workers. Covers rate limiting, bot detection, email validation, prompt injection, sensitive information blocking (including Rampart NER), content moderation, capture/flush, remote Guard policies, typed inputs, and abuse prevention. Works in JavaScript/TypeScript, Python, and Go. HTTP frameworks share this skill. JS Guard adapters (Vercel AI SDK, Eve, Mastra, LangChain, LangGraph, OpenAI Agents, Genkit, Google ADK, Strands, TanStack AI, Claude Agent SDK, Claude Managed Agents) are per-adapter reference files loaded from Step 3 — do not keep the whole JS Guard reference in context. Official Python LangChain, CrewAI, OpenAI Agents, Claude Agent SDK, Claude Managed Agents, and Strands Agents have dedicated integrate-arcjet-guard skills. Use when the user wants security, rate limiting, bot protection, or abuse prevention – "protect my API," "rate limit tool calls," "block bots," "secure my endpoint," or "prevent abuse" – even without naming Arcjet.
description: Add Arcjet security protection to HTTP routes, AI agent tool calls, MCP servers, background jobs, and queue workers. Covers rate limiting, bot detection, email validation, prompt injection, sensitive information blocking (including Rampart NER), content moderation, capture/flush, remote Guard policies, typed inputs, and abuse prevention. Works in JavaScript/TypeScript, Python, and Go. HTTP frameworks share this skill. JS Guard adapters (Vercel AI SDK, Eve, Mastra, LangChain, LangGraph, OpenAI Agents, Genkit, Google ADK, Strands, TanStack AI, Claude Agent SDK, Claude Managed Agents) are per-adapter reference files loaded from Step 3 — do not keep the whole JS Guard reference in context. Official Python LangChain, CrewAI, OpenAI Agents, Claude Agent SDK, Claude Managed Agents, and Strands Agents have dedicated integrate-arcjet-guard skills. Microsoft Agent Framework for Go has a dedicated integrate-arcjet-guard-agent-framework-go skill. Use when the user wants security, rate limiting, bot protection, or abuse prevention – "protect my API," "rate limit tool calls," "block bots," "secure my endpoint," or "prevent abuse" – even without naming Arcjet.
metadata:
author: arcjet
---
Expand Down Expand Up @@ -61,7 +61,7 @@ See [references/cli.md](references/cli.md) for install options beyond `npx`, age

#### Install the SDK with the project's package manager

Once you know which SDK you need (see Step 3), install it with the package manager the project already uses: `npm install`, `pnpm add`, `yarn add`, `bun add`, `pip install`, `uv add`, `poetry add`, or `go get`. Don't hand-edit `package.json` / `requirements.txt` / `go.mod` and guess a version: typed versions go stale (`@arcjet/next` is currently `1.12.0`; Python `arcjet` is `1.1.0`; Go must use the module tag `@v1.0.0-rc.2`, not a copied pseudo-version), and the lockfile/module metadata won't get updated. Let the package manager pick the real version and pin it.
Once you know which SDK you need (see Step 3), install it with the package manager the project already uses: `npm install`, `pnpm add`, `yarn add`, `bun add`, `pip install`, `uv add`, `poetry add`, or `go get`. Don't hand-edit `package.json` / `requirements.txt` / `go.mod` and guess a version: typed versions go stale (`@arcjet/next` is currently `1.12.0`; Python `arcjet` is `1.1.0`; Go must use a module tag, not a copied pseudo-version), and the lockfile/module metadata won't get updated. Let the package manager pick the real version and pin it.

### Step 3: Detect protection type and read the reference

Expand All @@ -75,7 +75,7 @@ Determine which protection type applies:
| **Go SDK** | `github.com/arcjet/arcjet-go` (with `NewClient`) | `github.com/arcjet/arcjet-go` (with `NewGuardClient`) |
| **Entry point** | `protect(request)` / `Protect(ctx, r)` | `guard(label, rules)` / `Guard(ctx, request)` |

A single project can use both – for example, request-based on API routes and Guard on agent tool calls. If the project already uses a supported agent framework, prefer the official wrapper over hand-wrapping every tool. In Python, load the dedicated skill (table below) — not a raw `guard()` around every callable, and not the JS `@arcjet/guard/...` path. In JavaScript, load fundamentals plus **exactly one** adapter file from the JS table — not the sibling adapters.
A single project can use both – for example, request-based on API routes and Guard on agent tool calls. If the project already uses a supported agent framework, prefer the official wrapper over hand-wrapping every tool. In Python, load the dedicated skill (table below) — not a raw `guard()` around every callable, and not the JS `@arcjet/guard/...` path. In JavaScript, load fundamentals plus **exactly one** adapter file from the JS table — not the sibling adapters. In Go, load the Microsoft Agent Framework skill when that framework is present; otherwise use `GuardAction` from the Go Guard reference.

**Common misclassifications to watch for:**

Expand Down Expand Up @@ -106,6 +106,12 @@ When the project already uses an official Python agent framework, load the dedic
| Claude Managed Agents | `arcjet.guard.claude_managed_agents` | [integrate-arcjet-guard-claude-managed-agents-py](../integrate-arcjet-guard-claude-managed-agents-py/SKILL.md) |
| Strands Agents | `arcjet.guard.strands_agents` | [integrate-arcjet-guard-strands-agents-py](../integrate-arcjet-guard-strands-agents-py/SKILL.md) |

When the project is Go and already uses Microsoft Agent Framework for Go, load the dedicated skill:

| Go framework | Import | Skill |
| ----------------------------------------------------------------------------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| Microsoft Agent Framework (`functool`, `mcptool`, `agent.Config.Middlewares`) | `github.com/arcjet/arcjet-go/agentframework` | [integrate-arcjet-guard-agent-framework-go](../integrate-arcjet-guard-agent-framework-go/SKILL.md) |

These references explain architectural decisions and patterns that can't be inferred from the source code alone. For exact API signatures, read the installed package's types and doc comments.

### Step 4: Implement protection
Expand Down Expand Up @@ -197,7 +203,7 @@ For exact API signatures, parameter names, and the full set of rules and helpers
- **Python SDK**: https://github.com/arcjet/arcjet-py – `arcjet` package (request protection) and `arcjet.guard` subpackage (non-HTTP guard).
- **Python Guard integration skills**: [integrate-arcjet-guard-langchain-py](../integrate-arcjet-guard-langchain-py/SKILL.md), [integrate-arcjet-guard-crewai](../integrate-arcjet-guard-crewai/SKILL.md), [integrate-arcjet-guard-openai-agents-py](../integrate-arcjet-guard-openai-agents-py/SKILL.md), [integrate-arcjet-guard-claude-agent-sdk-py](../integrate-arcjet-guard-claude-agent-sdk-py/SKILL.md), [integrate-arcjet-guard-claude-managed-agents-py](../integrate-arcjet-guard-claude-managed-agents-py/SKILL.md), [integrate-arcjet-guard-strands-agents-py](../integrate-arcjet-guard-strands-agents-py/SKILL.md).
- **JavaScript / TypeScript SDK**: https://github.com/arcjet/arcjet-js – monorepo with framework-specific packages (`@arcjet/next`, `@arcjet/node`, `@arcjet/fastify`, `@arcjet/sveltekit`, `@arcjet/guard`). JS Guard adapter files: [references/guards_js_vercel_ai.md](references/guards_js_vercel_ai.md) and siblings listed in Step 3.
- **Go SDK**: https://github.com/arcjet/arcjet-go – `github.com/arcjet/arcjet-go` module with request and guard clients. Pin `go get github.com/arcjet/arcjet-go@v1.0.0-rc.2` (Go 1.25+). `go get ...@latest` may still resolve **v0.1.0**.
- **Go SDK**: https://github.com/arcjet/arcjet-go – `github.com/arcjet/arcjet-go` module with request and guard clients. `go get github.com/arcjet/arcjet-go` resolves **v1.0.0** (Go 1.25+). Microsoft Agent Framework helpers live in a separate module: `go get github.com/arcjet/arcjet-go/agentframework` resolves **v0.1.0** and needs Go 1.26+.
- **Guard policies**: author and publish via MCP (`list-guard-policies` / `describe-guard-policy` / `validate-guard-policy` / `put-guard-policy`). The CLI has no policy commands. Application policies select by `label` / `action`. Coding-agent policies attach by **Execute on** (Tool call or Prompt); publishing turns them on — the hook URL must not name a policy.
- **Docs**: https://docs.arcjet.com – narrative guides, blueprints, and product reference.
- **Console**: https://console.arcjet.com – sites, keys, and decision history.
26 changes: 22 additions & 4 deletions plugins/arcjet/skills/arcjet/references/guards_go.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ Guard protects code paths that do not have an HTTP request – agent tool calls,

## Installation

The current documented pre-release is **`github.com/arcjet/arcjet-go` v1.0.0-rc.2** (requires Go 1.25+). `go get ...@latest` may still resolve **v0.1.0** (June 30, 2026) — pin `@v1.0.0-rc.2`. Capture, Rampart, nested metadata, `WithIPSrc`, threat/billing, `GuardModerateContent`, and required Guard `Mode` are on that rc. If the project uses an older Go toolchain, warn the user and stop until it is upgraded.
The current release is **`github.com/arcjet/arcjet-go` v1.0.0** (September 17, 2026), which `go get ...@latest` resolves. It requires Go 1.25+. Capture, Rampart, nested metadata, `WithIPSrc`, threat/billing, `GuardModerateContent`, and required Guard `Mode` are all in it. If the project uses an older Go toolchain, warn the user and stop until it is upgraded.

The Microsoft Agent Framework helpers are a separate module, **`github.com/arcjet/arcjet-go/agentframework` v0.1.0**, which requires Go 1.26+ because the framework does.

Install with Go tooling:

Expand Down Expand Up @@ -105,15 +107,31 @@ An empty `Bucket` defaults to `default-token-bucket`, `default-fixed-window`, or

Go has no registration / free `guard()` API. Pass the client.

## Fail-closed helpers: `GuardAction`

For a sensitive tool call or action, wrap it in `arcjet.GuardAction` instead of hand-writing the `HasFailedOpen()` gate. It calls Guard (always, even with no rules), denies with `*arcjet.GuardDeniedError`, fails closed with `*arcjet.GuardUnavailableError` when policy could not be evaluated, runs the function otherwise, and records one capture event whose metadata `outcome` is `success`, `degraded`, `denied`, `error`, or `unavailable`.

```go
out, err := arcjet.GuardAction(ctx, guard, arcjet.GuardActionPolicy{
Action: "refund.issued",
Actor: userID,
Rules: []arcjet.GuardRuleInput{refundLimit.Key(userID, 1)},
}, func(ctx context.Context) (Receipt, error) { return refundPayment(ctx, id) })
```

Distinguish the two errors with `errors.As`. `OnGuardError: arcjet.OnGuardErrorAllow` opts a call site back into fail-open; a `DENY` still blocks. Use `arcjet.NewGuardDenialResult(decision)` and `arcjet.NewGuardUnavailableResult()` when the caller is a model and needs a JSON result rather than a Go error. Available from `arcjet-go` v1.0.0.

For Microsoft Agent Framework for Go, load [integrate-arcjet-guard-agent-framework-go](../../integrate-arcjet-guard-agent-framework-go/SKILL.md) instead of wrapping tools by hand.

## Capture and flush

`Capture` records that an action happened. It is not a security decision – it never denies, never returns an error, and never sets `HasFailedOpen()`.

```go
guard.Capture(arcjet.CaptureEvent{
Action: "refund.issued",
CorrelationId: runID,
DecisionId: decision.ID,
CorrelationID: runID,
DecisionID: decision.ID,
Metadata: arcjet.Metadata{
"invoice": map[string]any{"id": "inv_123", "amount": 4200},
"refunded": true,
Expand Down Expand Up @@ -143,7 +161,7 @@ for _, w := range decision.Warnings {

## Correlation IDs

Set `GuardRequest.CorrelationId` to correlate this guard call with HTTP requests, workflow runs, or agent traces. It is a dedicated field, not metadata, and does not affect the decision.
Set `GuardRequest.CorrelationID` to correlate this guard call with HTTP requests, workflow runs, or agent traces. It is a dedicated field, not metadata, and does not affect the decision. The agent helpers read `arcjet.ContextWithCorrelationID(ctx, id)`; `Guard` and `Capture` do not, so pass `CorrelationID` to them explicitly.

## Metadata

Expand Down
4 changes: 2 additions & 2 deletions plugins/arcjet/skills/arcjet/references/requests_go.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Request protection inspects `net/http` requests – headers, IP, body – to enf

## Installation

The current documented pre-release is **`github.com/arcjet/arcjet-go` v1.0.0-rc.2** (requires Go 1.25+). `go get ...@latest` may still resolve **v0.1.0** (June 30, 2026) — pin `@v1.0.0-rc.2`. Nested `Metadata`, `WithIPSrc`, Rampart, `decision.IP.Threat`, and Protect transport-failure ERROR decisions are on that rc. If the project uses an older Go toolchain, warn the user and stop until it is upgraded.
The current release is **`github.com/arcjet/arcjet-go` v1.0.0** (September 17, 2026), which `go get ...@latest` resolves. It requires Go 1.25+. Nested `Metadata`, `WithIPSrc`, Rampart, `decision.IP.Threat`, and Protect transport-failure ERROR decisions are all in it. If the project uses an older Go toolchain, warn the user and stop until it is upgraded.

Install with Go tooling, not by editing `go.mod` directly:

Expand Down Expand Up @@ -90,7 +90,7 @@ For user-based characteristics, use identity established by trusted authenticati

## Correlation IDs

Pass `arcjet.WithCorrelationId(id)` to `Protect` to correlate this decision with guard calls, workflow runs, or agent traces. It is a dedicated field, not `WithExtra` or `Metadata`, and does not affect the decision.
Pass `arcjet.WithCorrelationID(id)` to `Protect` to correlate this decision with guard calls, workflow runs, or agent traces. It is a dedicated field, not `WithExtra` or `Metadata`, and does not affect the decision.

## Explicit client IP

Expand Down
Loading