StackA2A
utilitytypescript

A2A Ai Provider

29

by DracoBlue

Community A2A provider for the ai-sdk from vercel

24 starsUpdated 2025-10-14NOASSERTION
Quality Score29/100
Community
31
Freshness
36
Official
30
Skills
10
Protocol
40
🔒 Security
20

Getting Started

1Clone the repository
$ git clone https://github.com/DracoBlue/a2a-ai-provider
2Navigate to the project
$ cd a2a-ai-provider
3Install dependencies
$ npm install
4Run the agent
$ npm start

Or connect to the hosted endpoint: https://npmjs.com/package/a2a-ai-provider

README

a2a-ai-provider

An @ai-sdk compatible AI provider implementation for the A2A Protocol, enabling universal interoperability between LLMs, tools, streaming output, and file-based artifacts.

Hint: Is currently in alpha, not feature complete and should not be used for production workloads.

✨ Features

  • 🔌 Drop-in ai Provider (v5 and later)
  • 🔁 Full support for A2A JSON-RPC 2.0 API by using @a2a-js/sdk
  • ⚖️ MIT Licensed and easy to integrate

📦 Installation

pnpm install a2a-ai-provider

Make sure you also install ai:

pnpm install ai

🚀 Usage

import { a2a } from "a2a-ai-provider";
import { generateText } from "ai"

const chatId = "unique-chat-id"; // for each conversation to keep history in a2a server

const result = await generateText({
  model: a2a('https://your-a2a-server.example.com/.well-known/agent-card.json'),
  prompt: 'What is love?',
  providerOptions: {
    "a2a": {
      "contextId": chatId,
    }
  },
});

console.log(result.text);

or if you like the stream version, use:

import { a2a } from "a2a-ai-provider";
import { streamText } from "ai"

const chatId = "unique-chat-id"; // for each conversation to keep history in a2a server

const streamResult = streamText({
  model: a2a('https://your-a2a-server.example.com/.well-known/agent-card.json'),
  prompt: 'What is love?',
  providerOptions: {
    "a2a": {
      "contextId": chatId,
    }
  },
});

await streamResult.consumeStream();

console.log(await streamResult.content);

🛠 Provider Options

createA2a({
  idGenerator?: IdGenerator; // replace the default IdGenerator
});

🔒 License

a2a-ai-provider is licensed under the terms of MIT. See LICENSE for more information.

Capabilities

StreamingPush NotificationsMulti-TurnAuth: none
a2a-clientaiai-sdkvercel-ai-sdk
View on GitHub