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

@ag-ui/a2a

v0.0.6

Published

A TypeScript integration that connects AG-UI agents with remote services that expose the [A2A protocol](https://a2a.dev/). It converts AG-UI conversations into A2A payloads, forwards them through the official A2A SDK, and replays the responses back into A

Readme

@ag-ui/a2a

A TypeScript integration that connects AG-UI agents with remote services that expose the A2A protocol. It converts AG-UI conversations into A2A payloads, forwards them through the official A2A SDK, and replays the responses back into AG-UI event streams.

Status: Experimental. APIs may change while the integration stabilises.

Features

  • Message conversion helpers between AG-UI and A2A formats (user, assistant, tool, binary payloads).
  • A2AAgent implementation that streams or performs blocking requests against A2A endpoints.
  • Optional fallback from streaming to blocking requests when an agent does not support SSE.
  • Event conversion utilities that surface A2A messages, task status updates, and artifact chunks as AG-UI events.
  • Helper tool schema (send_message_to_a2a_agent) for orchestration scenarios.
  • Example client and Jest tests to validate conversions and streaming flows.

Installation

Once dependencies are installed in the monorepo:

pnpm install
pnpm --filter @ag-ui/a2a build

Quick start

import { A2AAgent } from "@ag-ui/a2a";

import { A2AClient } from "@a2a-js/sdk/client";

const client = new A2AClient("https://my-a2a-agent");

const agent = new A2AAgent({
  a2aClient: client,
  initialMessages: [
    { id: "user-1", role: "user", content: "Plan a team offsite" } as any,
  ],
});

const { result, newMessages } = await agent.runAgent();
console.log(result);
console.log(newMessages);

You can inject your own A2AClient instance via the client option, override default instructions, or force blocking mode by setting strategy: "blocking".

Configuration reference

| Option | Description | | ------ | ----------- | | a2aClient | Required. Provide an A2AClient instance (with any auth headers or custom fetch logic you need). |

Environment variables & authentication

The integration relies on the underlying A2A agent for authentication. Common patterns include:

  • A2A_AGENT_URL – set in deployment environments to point to the remote agent base URL.
  • A2A_API_KEY or A2A_BEARER_TOKEN – consumed by a wrapped fetch inside a custom A2AClient instance if the remote agent enforces API key or bearer authentication.

Pass any credentials to the A2AClient you provide to A2AAgent, or configure an HTTP proxy that injects the correct headers.

Utilities

  • convertAGUIMessagesToA2A(messages, options) — reshapes AG-UI history into A2A message objects, forwarding only user/assistant/tool turns and preserving the tool payloads.
  • convertA2AEventToAGUIEvents(event, options) — maps an A2A stream event to AG-UI text and tool events (TEXT_MESSAGE_CHUNK, TOOL_CALL_*, TOOL_CALL_RESULT).
  • sendMessageToA2AAgentTool — JSON schema describing a send_message_to_a2a_agent tool for orchestration agents.

Testing

pnpm --filter @ag-ui/a2a test

The suite covers conversion edge cases and streaming / fallback behaviour using mocked A2A clients.

Examples

  • examples/basic.ts – minimal script. If you set A2A_AGENT_URL, it will connect to that agent through the real A2AClient. Otherwise it falls back to a tiny in-memory mock client so you can observe the integration without hitting a remote endpoint.

Release checklist

  1. pnpm --filter @ag-ui/a2a build
  2. pnpm --filter @ag-ui/a2a test
  3. Update CHANGELOG / release notes.
  4. Publish with pnpm publish --filter @ag-ui/a2a.