Overview
The HAIP TypeScript SDK provides a complete implementation of the Human-Agent Interaction Protocol, enabling developers to build real-time, multi-modal applications with AI agents. The SDK is production-ready with comprehensive test coverage and supports all major transport protocols.Protocol Compliant
Full HAIP 1.1.2 protocol implementation with comprehensive event handling.
Multi-Transport Support
WebSocket, SSE, and HTTP streaming transports with automatic fallback.
Tool Integration
Built-in support for Model Context Protocol (MCP) tool lifecycle management.
Flow Control
Credit-based flow control with automatic back-pressure management.
Error Handling
Comprehensive error handling with automatic recovery and reconnection.
Performance Monitoring
Real-time performance metrics and connection state monitoring.
Quick Start
Architecture
The SDK is built with a modular architecture that separates concerns and provides flexibility:1
Client Layer
High-level client interface that manages connection lifecycle, handshakes,
and protocol state.
2
Transport Layer
Pluggable transport implementations for different communication protocols.
3
Protocol Layer
Core protocol implementation with message validation, flow control, and
event handling.
4
Utility Layer
Helper functions for message creation, validation, and common operations.
Supported Environments
- Node.js: Full support with WebSocket and HTTP Streaming transports
 - Browser: Full support with WebSocket, SSE, and HTTP Streaming transports
 - TypeScript: Complete type definitions and IntelliSense support
 - JavaScript: Full compatibility with ES6+ features
 
Transport Options
| Transport | Node.js | Browser | Features | 
|---|---|---|---|
| WebSocket | ✅ | ✅ | Real-time, bidirectional, binary support | 
| SSE | ❌ | ✅ | Server-sent events, HTTP POST for sending | 
| HTTP Streaming | ✅ | ✅ | Fetch-based streaming, universal compatibility | 
Protocol Support
The SDK implements the complete HAIP v1.1.2 specification.View the spec
OpenAPI Specification