https://github.com/DracoBlue/a2a-ai-provider
Community A2A provider for the ai-sdk from vercel
https://github.com/DracoBlue/a2a-ai-provider
a2a a2a-client a2a-protocol ai ai-sdk vercel-ai-sdk
Last synced: 27 days ago
JSON representation
Community A2A provider for the ai-sdk from vercel
- Host: GitHub
- URL: https://github.com/DracoBlue/a2a-ai-provider
- Owner: DracoBlue
- License: other
- Created: 2025-07-01T21:45:00.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-10-14T19:34:24.000Z (8 months ago)
- Last Synced: 2026-01-21T00:33:40.152Z (5 months ago)
- Topics: a2a, a2a-client, a2a-protocol, ai, ai-sdk, vercel-ai-sdk
- Language: TypeScript
- Homepage: https://npmjs.com/package/a2a-ai-provider
- Size: 140 KB
- Stars: 24
- Watchers: 2
- Forks: 4
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-a2a - a2a-ai-provider - ai-provider?style=social)](https://github.com/DracoBlue/a2a-ai-provider) - Community A2A provider for the Vercel AI SDK, enabling drop-in interoperability with A2A agents via `generateText` and `streamText`. (⚙️ Implementations & Libraries)
README
# a2a-ai-provider
An `@ai-sdk` compatible AI provider implementation for the [A2A Protocol](https://a2aproject.github.io/A2A/), 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
```bash
pnpm install a2a-ai-provider
```
Make sure you also install `ai`:
```bash
pnpm install ai
```
## 🚀 Usage
```javascript
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:
```javascript
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
```ts
createA2a({
idGenerator?: IdGenerator; // replace the default IdGenerator
});
```
## 🔒 License
a2a-ai-provider is licensed under the terms of MIT. See LICENSE for more information.