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

apcore-a2a

v0.2.1

Published

Automatic A2A Protocol Adapter for apcore Module Registry

Readme

apcore-a2a (TypeScript)

npm Node.js License Coverage

What is apcore-a2a?

apcore-a2a is the A2A (Agent-to-Agent) protocol adapter for the apcore ecosystem.

It solves a common problem: you've built AI capabilities with apcore modules, but you need them to talk to other AI agents over a standard protocol. apcore-a2a bridges that gap — it reads your existing module metadata (schemas, descriptions, examples) and automatically exposes them as a standards-compliant A2A server. No hand-written Agent Cards, no JSON-RPC boilerplate, no manual task lifecycle management.

In short: apcore modules + apcore-a2a = a fully functional A2A agent, ready to be discovered and invoked by any A2A-compatible client.

Built on @a2a-js/sdk and Express 5.

Also available in Python: apcore-a2a (PyPI)

Features

  • One-call server — launch a compliant A2A server with serve(registry)
  • Automatic Agent Card/.well-known/agent-card.json generated from module metadata
  • Skill mapping — apcore modules become A2A Skills with names, descriptions, tags, and examples
  • Full task lifecycle — submitted, working, completed, failed, canceled, input-required
  • SSE streamingmessage/stream with real-time status and artifact updates
  • JWT authentication — tokens bridged to apcore's Identity context
  • A2A Explorer UI — browser UI for discovering and testing skills, with auth bar and cURL generation
  • Built-in clientA2AClient for calling remote A2A agents
  • CLI supportnpx apcore-a2a serve for zero-code startup
  • Pluggable storage — swap in Redis or PostgreSQL via the TaskStore interface
  • Observability/health, /metrics endpoints
  • Dynamic registration — add/remove modules at runtime without restart

Requirements

  • Node.js >= 18.0.0
  • apcore-js >= 0.9.0

For Users: Getting Started

Installation

npm install apcore-a2a

Expose your modules as an A2A Agent

If you already have apcore modules, three lines turn them into a discoverable agent:

import { Registry } from "apcore-js";
import { serve } from "apcore-a2a";

const registry = new Registry({ extensionsDir: "./extensions" });

serve(registry); // Starts on http://0.0.0.0:8000

Your agent is now live at http://localhost:8000/.well-known/agent-card.json.

CLI (zero-code)

No code needed — use the CLI to serve modules directly:

npx apcore-a2a serve --extensions-dir ./extensions
npx apcore-a2a serve --extensions-dir ./extensions --port 3000 --explorer --metrics
npx apcore-a2a serve --extensions-dir ./extensions --auth-type bearer --auth-key mysecret

Call a remote A2A Agent

Use the built-in client to discover and invoke any A2A-compliant agent:

import { A2AClient } from "apcore-a2a";

const client = new A2AClient("http://agent.example.com", {
  auth: "Bearer my-token",
  timeout: 30_000,
});

// Discover what the agent can do
const card = await client.discover();
console.log(`Agent: ${card.name}, Skills: ${card.skills.length}`);

// Send a message
const task = await client.sendMessage(
  { role: "user", parts: [{ kind: "text", text: "hello" }] },
  { contextId: "ctx-1" },
);
console.log(`Result: ${task.status.state}`);

// Or stream the response
for await (const event of client.streamMessage(message)) {
  console.log(event);
}

client.close();

Add authentication

import { JWTAuthenticator } from "apcore-a2a";

const auth = new JWTAuthenticator("your-secret-key", {
  algorithms: ["HS256"],
  issuer: "https://auth.example.com",
  audience: "my-agent",
  claimMapping: {
    idClaim: "sub",
    typeClaim: "type",
    rolesClaim: "roles",
    attrsClaims: ["org", "dept"],
  },
  requireClaims: ["sub"],
});

serve(registry, { auth });

For Developers: API Reference

serve()

Blocking call — starts an HTTP server and serves until SIGINT/SIGTERM.

import { serve } from "apcore-a2a";

serve(registryOrExecutor, {
  host: "0.0.0.0",           // Bind host (default: "0.0.0.0")
  port: 8000,                // Bind port (default: 8000)
  name: "my-agent",          // Agent name (fallback: registry config)
  description: "...",        // Agent description
  version: "1.0.0",          // Agent version
  url: "https://...",        // Public URL (default: http://{host}:{port})
  auth: authenticator,       // Authenticator instance
  taskStore: store,          // TaskStore instance (default: InMemoryTaskStore)
  corsOrigins: ["http://localhost:3000"],
  explorer: true,            // Enable A2A Explorer UI
  explorerPrefix: "/explorer",
  executionTimeout: 300_000, // ms (default: 300000)
  metrics: true,             // Enable /metrics endpoint
  shutdownTimeout: 30,       // Graceful shutdown timeout in seconds
});

asyncServe()

Returns the Express app without starting a server — use for embedding in larger applications or testing.

import { asyncServe } from "apcore-a2a";

const app = await asyncServe(registryOrExecutor, options);
// app is an Express application — mount it or start your own server

TaskStore

Default in-memory task store. Implement the TaskStore interface (save, load) for persistent backends.

import { InMemoryTaskStore } from "apcore-a2a/storage";

const store = new InMemoryTaskStore();
serve(registry, { taskStore: store });

Architecture

apcore Registry
       |
       v
+---------------------------------------------+
|  apcore-a2a                                 |
|  +----------+  +-----------+  +----------+  |
|  | Adapters |  |  Server   |  |   Auth   |  |
|  | SkillMap |  | Executor  |  |  JWT     |  |
|  | Schema   |  | Factory   |  |  Middle  |  |
|  | Parts    |  | Health    |  |  Storage |  |
|  | ErrorMap |  | Metrics   |  |          |  |
|  | AgentCard|  |           |  |          |  |
|  +----------+  +-----------+  +----------+  |
|  +----------+  +-----------+                |
|  |  Client  |  | Explorer  |                |
|  | A2AClient|  | HTML UI   |                |
|  | CardFetch|  |           |                |
|  +----------+  +-----------+                |
+---------------------------------------------+
       |
       v
  @a2a-js/sdk + Express 5

| A2A Concept | apcore Mapping | | -------------- | ----------------------------------------- | | Agent Card | Derived from Registry configuration | | Skill | Maps 1:1 to an apcore Module | | Task | Managed execution of Executor.callAsync() | | Streaming | Wrapped Executor.stream() via SSE | | Security | Bridged to apcore's Identity context |

Examples

The examples/ directory contains 5 runnable demo modules covering both integration styles:

# Run all 5 modules with Explorer UI
npx tsx examples/run.ts

# With JWT auth
JWT_SECRET=my-secret npx tsx examples/run.ts

Open http://127.0.0.1:8000/explorer/ to discover and test skills interactively.

See examples/README.md for details on class-based vs programmatic module patterns.

Contributing

git clone https://github.com/aipartnerup/apcore-a2a-typescript.git
cd apcore-a2a-typescript
npm install
npm test

Documentation

License

Apache 2.0 — see LICENSE.