@ag-ui/proto (1.0.0)
Published 2026-09-22 14:30:31 +00:00 by ak
Installation
@ag-ui:registry=npm install @ag-ui/proto@1.0.0"@ag-ui/proto": "1.0.0"About this package
@ag-ui/proto
Protocol Buffer encoding/decoding for Agent-User Interaction (AG-UI) Protocol events.
@ag-ui/proto provides high-performance binary serialization of AG-UI events using Protocol Buffers. It includes generated TypeScript definitions and utilities for converting between AG-UI's JSON event format and compact binary representation.
Installation
npm install @ag-ui/proto
pnpm add @ag-ui/proto
yarn add @ag-ui/proto
Features
- ⚡ High performance – Binary protobuf encoding for minimal bandwidth usage
- 🔄 Round-trip safety – Compatible conversion between JSON and binary formats
- 📋 Generated types – Auto-generated TypeScript definitions from
.protoschemas - 🔧 Length-prefixed – Standard 4-byte length headers for streaming protocols
- 🖼️ Multimodal snapshots – Supports multimodal user content parts in message snapshots
Quick example
import { encode, decode, AGUI_MEDIA_TYPE } from "@ag-ui/proto";
import { EventType } from "@ag-ui/core";
const event = {
type: EventType.TEXT_MESSAGE_START,
messageId: "msg_123",
role: "assistant",
};
// Encode to binary protobuf format
const encoded = encode(event);
// Decode back to AG-UI event
const decoded = decode(encoded);
console.log(decoded); // Original event object
Documentation
- Concepts & architecture:
docs/concepts - Full API reference:
docs/sdk/js/proto
Contributing
Bug reports and pull requests are welcome! Please read our contributing guide first.
License
MIT © 2025 AG-UI Protocol Contributors
Dependencies
Dependencies
| ID | Version |
|---|---|
| @ag-ui/core | 1.0.0 |
| @bufbuild/protobuf | ^2.2.5 |
| @protobuf-ts/protoc | ^2.11.1 |
| zod | ^3.25.76 |
Development Dependencies
| ID | Version |
|---|---|
| @arethetypeswrong/cli | ^0.17.4 |
| @types/node | ^20.19.21 |
| @vitest/coverage-istanbul | ^4.0.18 |
| eslint | ^9.37.0 |
| publint | ^0.3.12 |
| ts-proto | ^2.7.0 |
| tsdown | ^0.20.1 |
| typescript | ^5.8.2 |
| vitest | ^4.0.18 |