npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@agents-js/validation

v0.4.0

Published

Schema validation for ACP envelopes, A2A requests/responses, runtime manifests, and JSON-RPC messages.

Readme

@agents-js/validation

Wire-format schema validation for ACP envelopes, A2A requests/responses, A2UI lifecycle messages, AG-UI events, JSON-RPC 2.0 envelopes, agent cards, and runtime manifests.

@agents-js/validation is the wire-format schema gateway for the agents-js project. It wraps the canonical schemas published by @agentclientprotocol/sdk, @a2a-js/sdk, @agents-js/a2ui-types, and @agents-js/agui-types, and exposes a uniform ValidationResult shape (with structured ValidationError issues) across every protocol and transport boundary.

Installation

npm install @agents-js/validation
bun add @agents-js/validation

Usage

Validate an inbound JSON-RPC envelope before dispatching it:

import { validateJsonRpcEnvelope, ValidationError } from "@agents-js/validation";

const payload: unknown = JSON.parse(rawBody);

try {
  const request = validateJsonRpcEnvelope(payload, "request", { mode: "strict" });
  // request is now typed and guaranteed to match the JSON-RPC 2.0 request shape.
  await dispatch(request);
} catch (err) {
  if (err instanceof ValidationError) {
    console.error("rejected envelope", err.issues);
  }
  throw err;
}

Type-guard a streaming AG-UI event without throwing:

import { isAguiEvent } from "@agents-js/validation/agui";

for await (const chunk of stream) {
  if (isAguiEvent(chunk)) {
    forward(chunk);
  }
}

For browser or extension bundles, prefer the narrowest subpath export:

import { validateAgentCard } from "@agents-js/validation/a2a";
import { validateA2uiMessage } from "@agents-js/validation/a2ui";
import { validateACPEnvelope } from "@agents-js/validation/acp";
import { validateRunAgentInput } from "@agents-js/validation/agui";

The root @agents-js/validation entrypoint remains supported for compatibility, but it exposes every validator and can pull more protocol code into bundled consumers.

agents-validate CLI

The package ships an agents-validate binary for ad-hoc schema checks against files or URLs. Output is a JSON document with ok: true|false; non-zero exit on failure.

# Validate an ACP request envelope from a local file.
npx agents-validate --source ./fixtures/session-new.json --target acp-request

# Validate an A2A agent card served over HTTP, in lenient mode.
npx agents-validate \
  --source https://example.com/.well-known/agent.json \
  --target agent-card \
  --mode loose

# Validate an ACP response — `--method` is required so the right schema is selected.
npx agents-validate \
  --source ./fixtures/session-new-response.json \
  --target acp-response \
  --method session/new

Run npx agents-validate --help for the full list of --target values (jsonrpc-request, jsonrpc-response, a2a-request, a2a-response, acp-envelope, acp-request, acp-response, agent-card, runtime-manifest).

Documentation

Full API reference and protocol guides: https://agents-js.bodal.dev/.

License

MIT — see LICENSE.