Overview

Haive Agent Protocol (HAP) is a framework for orchestrating AI agents in complex workflows. It provides the infrastructure for defining, executing, and managing multi-agent systems within the Haive ecosystem.

Concept

HAP is designed as “MCP for Agents” - while MCP (Model Context Protocol) exposes tools, resources, and prompts, HAP exposes agents, graphs, and workflows. This enables:

  • Agent Composition: Combine multiple specialized agents into workflows

  • State Management: Maintain context across agent interactions

  • Graph Execution: Define execution order and dependencies

  • Protocol Integration: JSON-RPC 2.0 protocol for distributed systems

Architecture

HAP consists of three main components:

Models

  • HAPContext: Extends StateSchema for execution tracking

  • HAPGraph: Manages workflow structure and node relationships

  • HAPNode: Individual nodes containing agents or entrypoints

Server

  • HAPRuntime: Executes graphs with proper context flow

  • Agent Loading: Smart initialization from various sources

  • Error Handling: Comprehensive error propagation

HAP Protocol

  • HAPContext: Execution context with logging and progress

  • Resource Providers: Pluggable resource access

  • Auth Providers: Authentication and authorization

  • JSON-RPC: Standard protocol for agent communication

Design Principles

  1. Simplicity First: Use BaseModel instead of complex inheritance

  2. Real Execution: No mocks, test with actual agents and LLMs (Haive philosophy)

  3. Haive Integration: Proper StateSchema inheritance

  4. Clear Naming: Renamed from AGP to HAP for better clarity

  5. Extensibility: Plugin system for future enhancements

Use Cases

Research Assistant

Combine multiple agents for comprehensive research:

graph = HAPGraph()
graph.add_agent_node("search", search_agent, ["analyze"])
graph.add_agent_node("analyze", analyzer_agent, ["summarize"])
graph.add_agent_node("summarize", summary_agent)

Content Pipeline

Process content through specialized agents:

graph = HAPGraph()
graph.add_agent_node("extract", extractor, ["enhance"])
graph.add_agent_node("enhance", enhancer, ["publish"])
graph.add_agent_node("publish", publisher)

Multi-Modal Processing

Handle different data types with appropriate agents:

graph = HAPGraph()
graph.add_agent_node("classify", classifier, ["text", "image"])
graph.add_agent_node("text", text_processor)
graph.add_agent_node("image", image_processor)

Comparison with MCP

Feature

MCP

HAP

Exposes

Tools, Resources, Prompts

Agents, Graphs, Workflows

Protocol

JSON-RPC 2.0

JSON-RPC 2.0 (HAP protocol)

State

Stateless tools

Stateful agent context

Execution

Single tool calls

Multi-agent workflows

Use Case

Tool integration

Agent orchestration

Future Development

  • HAP Server: Full protocol implementation

  • Plugin System: Auto-discovery and registration

  • Distributed Execution: Cross-server workflows

  • Resource Exposure: Agent-specific resources

  • Version Management: Agent versioning support