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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@dexwox-labs/a2a-server

v0.1.0

Published

TypeScript server implementation for Google's Agent-to-Agent (A2A) protocol - includes Express/WebSocket handlers, request validation and queue management

Readme

@dexwox-labs/a2a-server

A TypeScript server implementation for the Agent-to-Agent (A2A) protocol, enabling agent execution and task management.

This package provides a robust server implementation of the A2A protocol specification. Developed by Dexwox Innovations Pvt Ltd to deliver a production-ready TypeScript solution for hosting and managing A2A-compatible agents.

Features

  • Express-based HTTP server
  • WebSocket support for streaming
  • Request context management
  • Task lifecycle management
  • Error handling middleware
  • Configurable CORS and security

Installation

npm install @dexwox-labs/a2a-server
# or
pnpm add @dexwox-labs/a2a-server
# or use the unified package
npm install @dexwox-labs/a2a-node

Quick Start

// Import from the server package
import { A2AServer } from '@dexwox-labs/a2a-server';
import { AgentCard } from '@dexwox-labs/a2a-core';
import { RequestHandler } from './request-handler';

// Or import everything from the unified package
// import { A2AServer, AgentCard } from '@dexwox-labs/a2a-node';

const agentCard: AgentCard = {
  id: 'my-agent',
  name: 'My Agent',
  capabilities: ['task-processing'],
  endpoint: 'http://localhost:3000'
};

const requestHandler = new RequestHandler();
const server = new A2AServer(agentCard, requestHandler);

server.start(3000);

Configuration

A2AServer Options

| Parameter | Type | Description | |-----------|------|-------------| | agentCard | AgentCard | Required agent metadata | | requestHandler | RequestHandler | Handles incoming requests | | contextMiddleware | Function | Optional custom middleware |

Environment Variables

  • NODE_ENV: 'production' or 'development'
  • CORS_ORIGIN: Allowed origins (default: '*')
  • PORT: Server port (default: 3000)

API Reference

A2AServer Class

Methods

  • start(port: number): Starts the HTTP/WebSocket server
  • configureMiddleware(): Sets up Express middleware
  • configureRoutes(): Defines API routes
  • configureErrorHandling(): Error handler setup

RequestHandler

Handles all incoming requests with these key methods:

  • handleStreamMessage(): WebSocket message processing
  • normalizeError(): Standard error formatting
  • handleCreateTask(): Task creation endpoint
  • handleUpdateTask(): Task status updates

Examples

Custom Middleware

const customMiddleware = (req, res, next) => {
  // Add custom request processing
  next();
};

new A2AServer(agentCard, requestHandler, customMiddleware);

WebSocket Handling

server.start(3000); // Automatically starts WebSocket server

// Client connection example:
const ws = new WebSocket('ws://localhost:3000');
ws.onmessage = (event) => {
  console.log('Received:', JSON.parse(event.data));
};

Error Handling

The server provides standardized error responses:

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32603,
    "message": "Internal server error"
  }
}

Testing

Run tests with:

cd packages/server
pnpm test

Generate coverage report:

pnpm test -- --coverage

Contributing

See CONTRIBUTING.md for development guidelines.